From 26b1141a78cfec0e2eface4b399009ee5eb421df Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Mon, 17 Aug 2015 01:28:57 +0300 Subject: [PATCH] glsl: Allow precision qualifiers on general opaque types. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit From the GLSL ES 3.1 spec, section 4.7.3: "Any floating point, integer, opaque type declaration can have the type preceded by one of these precision qualifiers: [...] highp [...], mediump [...], lowp [...]." Reviewed-by: Timothy Arceri Reviewed-by: Tapani Pälli --- src/glsl/ast_to_hir.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index ff57ec3a97d..e8b61ae3133 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -3414,7 +3414,7 @@ validate_identifier(const char *identifier, YYLTYPE loc, static bool precision_qualifier_allowed(const glsl_type *type) { - /* Precision qualifiers apply to floating point, integer and sampler + /* Precision qualifiers apply to floating point, integer and opaque * types. * * Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says: @@ -3444,7 +3444,7 @@ precision_qualifier_allowed(const glsl_type *type) return type->is_float() || type->is_integer() || type->is_record() - || type->is_sampler(); + || type->contains_opaque(); } ir_rvalue * @@ -4155,7 +4155,7 @@ ast_declarator_list::hir(exec_list *instructions, _mesa_glsl_error(&loc, state, "precision qualifiers apply only to floating point" - ", integer and sampler types"); + ", integer and opaque types"); } /* From section 4.1.7 of the GLSL 4.40 spec: @@ -5463,6 +5463,8 @@ is_valid_default_precision_type(const struct glsl_type *const type) /* "int" and "float" are valid, but vectors and matrices are not. */ return type->vector_elements == 1 && type->matrix_columns == 1; case GLSL_TYPE_SAMPLER: + case GLSL_TYPE_IMAGE: + case GLSL_TYPE_ATOMIC_UINT: return true; default: return false; @@ -5511,7 +5513,7 @@ ast_type_specifier::hir(exec_list *instructions, if (!is_valid_default_precision_type(type)) { _mesa_glsl_error(&loc, state, "default precision statements apply only to " - "float, int, and sampler types"); + "float, int, and opaque types"); return NULL; } -- 2.30.2