[Mesa-dev] [PATCH 2/2] glsl: Reject illegal qualifiers on atomic counter uniforms.

Kenneth Graunke kenneth at whitecape.org
Tue Apr 12 01:39:09 UTC 2016


This fixes

dEQP-GLES31.functional.uniform_location.negative.atomic_fragment
dEQP-GLES31.functional.uniform_location.negative.atomic_vertex

Both of which have lines like

layout(location = 3, binding = 0, offset = 0) uniform atomic_uint uni0;

The ARB_explicit_uniform_location spec makes a very tangential mention
regarding atomic counters, but location isn't something that makes sense
with them.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/ast_to_hir.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

Here's a respin of an earlier patch by Ilia, implementing Timothy's
suggestion.  It preserves the nicer error messages, as requested by
Nicolai.

I kept Ilia's signoff because he wrote the commit message. :)

diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 7c9be81..82eb22a 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -4300,6 +4300,17 @@ ast_declarator_list::hir(exec_list *instructions,
             state->atomic_counter_offsets[qual_binding] = qual_offset;
          }
       }
+
+      ast_type_qualifier allowed_atomic_qual_mask;
+      allowed_atomic_qual_mask.flags.i = 0;
+      allowed_atomic_qual_mask.flags.q.explicit_binding = 1;
+      allowed_atomic_qual_mask.flags.q.explicit_offset = 1;
+      allowed_atomic_qual_mask.flags.q.uniform = 1;
+
+      type->qualifier.validate_flags(&loc, state,
+                                     "invalid layout qualifier for "
+                                     "atomic_uint",
+                                     allowed_atomic_qual_mask);
    }
 
    if (this->declarations.is_empty()) {
-- 
2.8.0



More information about the mesa-dev mailing list