aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2015-11-14 12:22:49 +1100
committerTimothy Arceri <[email protected]>2015-11-21 07:26:55 +1100
commitde8f0c9ab99ac6140f6560e776a42a22eeff6721 (patch)
tree5ac8781e0049614c15882b83ca0707863edcc873 /src
parentf57285c8fc8c3128fc07a59bc0d56645f7e0ef18 (diff)
glsl: add process_qualifier_constant() helper
For now this just validates that a qualifier is inside its minimum boundary, in a later patch we will expand it to evaluate compile time constants. Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/ast_to_hir.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index a9b1c0ed34b..334561d4eb6 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2505,6 +2505,23 @@ validate_matrix_layout_for_type(struct _mesa_glsl_parse_state *state,
}
static bool
+process_qualifier_constant(struct _mesa_glsl_parse_state *state,
+ YYLTYPE *loc,
+ const char *qual_indentifier,
+ int qual_value,
+ unsigned *value)
+{
+ if (qual_value < 0) {
+ _mesa_glsl_error(loc, state, "%s layout qualifier is invalid (%d < 0)",
+ qual_indentifier, qual_value);
+ return false;
+ }
+
+ *value = (unsigned) qual_value;
+ return true;
+}
+
+static bool
validate_binding_qualifier(struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
const glsl_type *type,