diff options
author | Timothy Arceri <[email protected]> | 2015-11-14 13:09:46 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2015-11-21 07:27:09 +1100 |
commit | efa34e4a1d09c6f140fba7ff339a989ea079e212 (patch) | |
tree | a0db93ae719c4871fb99b60126f5f4ed306b3cef /src/glsl/ast_to_hir.cpp | |
parent | 1d87d6f9ca543631b2bc30ac8d82b6a23159fb55 (diff) |
glsl: replace index layout min boundary check
Use new helper that will in a later patch allow for
compile time constants.
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index f0f2d52d811..fde3df5d9b6 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2804,7 +2804,10 @@ apply_explicit_location(const struct ast_type_qualifier *qual, break; } - if (qual->flags.q.explicit_index) { + unsigned qual_index; + if (qual->flags.q.explicit_index && + process_qualifier_constant(state, loc, "index", qual->index, + &qual_index)) { /* From the GLSL 4.30 specification, section 4.4.2 (Output * Layout Qualifiers): * @@ -2814,12 +2817,12 @@ apply_explicit_location(const struct ast_type_qualifier *qual, * Older specifications don't mandate a behavior; we take * this as a clarification and always generate the error. */ - if (qual->index < 0 || qual->index > 1) { + if (qual_index > 1) { _mesa_glsl_error(loc, state, "explicit index may only be 0 or 1"); } else { var->data.explicit_index = true; - var->data.index = qual->index; + var->data.index = qual_index; } } } |