return true;
}
+static bool
+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);
+ return false;
+ }
+
+ return true;
+}
+
static bool
validate_binding_qualifier(struct _mesa_glsl_parse_state *state,
YYLTYPE *loc,
qual->flags.q.out && qual->flags.q.stream) {
unsigned qual_stream;
if (process_qualifier_constant(state, loc, "stream", qual->stream,
- &qual_stream)) {
+ &qual_stream) &&
+ validate_stream_qualifier(loc, state, qual_stream)) {
var->data.stream = qual_stream;
}
}
unsigned qual_stream;
if (!process_qualifier_constant(state, &loc, "stream", this->layout.stream,
- &qual_stream)) {
+ &qual_stream) ||
+ !validate_stream_qualifier(&loc, state, qual_stream)) {
/* If the stream qualifier is invalid it doesn't make sense to continue
* on and try to compare stream layouts on member variables against it
* so just return early.
if (state->stage == MESA_SHADER_GEOMETRY &&
state->has_explicit_attrib_stream()) {
- if (q.flags.q.stream && q.stream >= state->ctx->Const.MaxVertexStreams) {
- _mesa_glsl_error(loc, state,
- "`stream' value is larger than MAX_VERTEX_STREAMS - 1 "
- "(%d > %d)",
- q.stream, state->ctx->Const.MaxVertexStreams - 1);
- }
- if (this->flags.q.explicit_stream &&
- this->stream >= state->ctx->Const.MaxVertexStreams) {
- _mesa_glsl_error(loc, state,
- "`stream' value is larger than MAX_VERTEX_STREAMS - 1 "
- "(%d > %d)",
- this->stream, state->ctx->Const.MaxVertexStreams - 1);
- }
-
if (!this->flags.q.explicit_stream) {
if (q.flags.q.stream) {
this->flags.q.stream = 1;