summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ast_to_hir.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-06-13 15:22:34 -0700
committerIan Romanick <[email protected]>2016-06-16 09:33:53 -0700
commit9c872820413f6183db0eb47828a7afcf703f9930 (patch)
treeed45e48fbbf8d642ebd214bcb283fc8a288d84b9 /src/compiler/glsl/ast_to_hir.cpp
parentd04f652b757d1c9e53ee338e92d18c4c516c9507 (diff)
glsl: Always strip arrayness in precision_qualifier_allowed
Previously some callers of precision_qualifier_allowed would strip the arrayness from the type and some would not. As a result, some places would not notice that float[6], for example, needed a precision qualifier. Fixes the new piglit test no-default-float-array-precision.frag. Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96358 Cc: "12.0" <[email protected]> Cc: Gregory Hainaut <[email protected]> Cc: Ilia Mirkin <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ast_to_hir.cpp')
-rw-r--r--src/compiler/glsl/ast_to_hir.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index ea32924b3de..7da734c1d07 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -2278,10 +2278,10 @@ precision_qualifier_allowed(const glsl_type *type)
* From this, we infer that GLSL 1.30 (and later) should allow precision
* qualifiers on sampler types just like float and integer types.
*/
- return (type->is_float()
- || type->is_integer()
- || type->contains_opaque())
- && !type->without_array()->is_record();
+ const glsl_type *const t = type->without_array();
+
+ return (t->is_float() || t->is_integer() || t->contains_opaque()) &&
+ !t->is_record();
}
const glsl_type *
@@ -4994,13 +4994,8 @@ ast_declarator_list::hir(exec_list *instructions,
state->check_precision_qualifiers_allowed(&loc);
}
-
- /* If a precision qualifier is allowed on a type, it is allowed on
- * an array of that type.
- */
- if (!(this->type->qualifier.precision == ast_precision_none
- || precision_qualifier_allowed(var->type->without_array()))) {
-
+ if (this->type->qualifier.precision != ast_precision_none &&
+ !precision_qualifier_allowed(var->type)) {
_mesa_glsl_error(&loc, state,
"precision qualifiers apply only to floating point"
", integer and opaque types");