summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>2015-03-18 10:52:53 +0100
committerSamuel Iglesias Gonsalvez <siglesias@igalia.com>2015-07-14 07:04:04 +0200
commit9f651dbf7924938a8aa2c9c940ae3ed1366d6198 (patch)
treef6382c8a0eadf97921e1010dd83340cb03a43bfc /src
parent20b2907db7b93656cbafe1d24302498e5817dbe2 (diff)
glsl: buffer variables cannot be defined outside interface blocks
Section 4.3.7 "Buffer Variables", GLSL 4.30 spec: "Buffer variables may only be declared inside interface blocks (section 4.3.9 “Interface Blocks”), which are then referred to as shader storage blocks. It is a compile-time error to declare buffer variables at global scope (outside a block)." Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 6299bf09a1..61020cf015 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3378,6 +3378,18 @@ ast_declarator_list::hir(exec_list *instructions,
decl_type = this->type->glsl_type(& type_name, state);
+ /* Section 4.3.7 "Buffer Variables" of the GLSL 4.30 spec:
+ * "Buffer variables may only be declared inside interface blocks
+ * (section 4.3.9 “Interface Blocks”), which are then referred to as
+ * shader storage blocks. It is a compile-time error to declare buffer
+ * variables at global scope (outside a block)."
+ */
+ if (type->qualifier.flags.q.buffer && !decl_type->is_interface()) {
+ _mesa_glsl_error(&loc, state,
+ "buffer variables cannot be declared outside "
+ "interface blocks");
+ }
+
/* An offset-qualified atomic counter declaration sets the default
* offset for the next declaration within the same atomic counter
* buffer.