[Mesa-dev] [PATCH v3 02/14] glsl: add process_qualifier_constant() helper
Timothy Arceri
t_arceri at yahoo.com.au
Sat Nov 14 05:42:37 PST 2015
From: Timothy Arceri <timothy.arceri at collabora.com>
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.
---
src/glsl/ast_to_hir.cpp | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 06ba97c..2e55a49 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,
--
2.4.3
More information about the mesa-dev
mailing list