[Mesa-dev] [PATCH V2 09/12] glsl: add validate_stream_qualifier() helper

Timothy Arceri t_arceri at yahoo.com.au
Sun Nov 8 14:34:38 PST 2015


From: Timothy Arceri <timothy.arceri at collabora.com>

---
 src/glsl/ast_to_hir.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 21a956d..fcf7566 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2303,6 +2303,18 @@ process_qualifier_constant(struct _mesa_glsl_parse_state *state,
    return true;
 }
 
+static void
+validate_stream_qualifier(YYLTYPE *loc, struct _mesa_glsl_parse_state *state,
+                          unsigned stream)
+{
+   if (stream >= state->ctx->Const.MaxVertexStreams) {
+      _mesa_glsl_error(loc, state,
+                       "invalid stream specified %d is larger than "
+                       "MAX_VERTEX_STREAMS - 1 (%d).",
+                       stream, state->ctx->Const.MaxVertexStreams - 1);
+   }
+}
+
 static bool
 validate_binding_qualifier(struct _mesa_glsl_parse_state *state,
                            YYLTYPE *loc,
-- 
2.4.3



More information about the mesa-dev mailing list