[Mesa-dev] [PATCH] glsl: reject invalid input layout qualifiers

Timothy Arceri timothy.arceri at collabora.com
Sat Feb 13 05:47:07 UTC 2016


Global in validation is already handled, this will do the validation
for variables, blocks and block members.

This fixes some CTS tests for the new enhanced layouts transform
feedback qualifiers.
---
 Applies on top of my component qualifier series:

 https://patchwork.freedesktop.org/series/2101/

 src/compiler/glsl/ast_type.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
index f7c89af..f40ba86 100644
--- a/src/compiler/glsl/ast_type.cpp
+++ b/src/compiler/glsl/ast_type.cpp
@@ -147,6 +147,12 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
    stream_layout_mask.flags.i = 0;
    stream_layout_mask.flags.q.stream = 1;
 
+   ast_type_qualifier input_layout_mask;
+   input_layout_mask.flags.i = 0;
+   input_layout_mask.flags.q.in = 1;
+   input_layout_mask.flags.q.explicit_component = 1;
+   input_layout_mask.flags.q.explicit_location = 1;
+
    /* Uniform block layout qualifiers get to overwrite each
     * other (rightmost having priority), while all other
     * qualifiers currently don't allow duplicates.
@@ -271,6 +277,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
 
    this->flags.i |= q.flags.i;
 
+   if (this->flags.q.in &&
+       (this->flags.i & ~input_layout_mask.flags.i) != 0) {
+      _mesa_glsl_error(loc, state,
+		       "invalid input layout qualifier used");
+      return false;
+   }
+
    if (q.flags.q.explicit_location)
       this->location = q.location;
 
-- 
2.5.0



More information about the mesa-dev mailing list