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 <siglesias@igalia.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Timothy Arceri 2015-11-14 12:22:49 +11:00 committed by Timothy Arceri
parent f57285c8fc
commit de8f0c9ab9
1 changed files with 17 additions and 0 deletions

View File

@ -2504,6 +2504,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,