diff options
author | marha <marha@users.sourceforge.net> | 2014-09-21 18:11:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-09-21 18:11:28 +0200 |
commit | 438af0c7d4bf60b408b259c88205ff2193195466 (patch) | |
tree | 46fd6465cb7431f64a3cb475a40587a261983af4 /mesalib/src/glsl/ast_to_hir.cpp | |
parent | d0f70707dde032e662dbd5bc70df6ac915403abe (diff) | |
download | vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.gz vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.bz2 vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.zip |
libxtrans xkeyboard-config xserver mesa plink glproto git update 21 Sep 2014
plink revision 10233
xserver commit 28337cb14e4347e1dd7936c5393a22e042866687
xkeyboard-config commit 48e1c0b351b6711edc0f167cbb81e4424b75291a
glproto commit bd3d751e1eb17efb39f65093271bb4ac071aa9e0
libxtrans commit fb7f198c88e97d22c8c89e76e9cd06b2b2720a96
mesa commit 4eb2bbefd2bf0359aff7ebbb8e931a1c7833606f
Diffstat (limited to 'mesalib/src/glsl/ast_to_hir.cpp')
-rw-r--r-- | mesalib/src/glsl/ast_to_hir.cpp | 77 |
1 files changed, 42 insertions, 35 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 897505c60..5ec1614be 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -3202,6 +3202,41 @@ 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 + * types. + * + * Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says: + * "Any floating point or any integer declaration can have the type + * preceded by one of these precision qualifiers [...] Literal + * constants do not have precision qualifiers. Neither do Boolean + * variables. + * + * Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30 + * spec also says: + * + * "Precision qualifiers are added for code portability with OpenGL + * ES, not for functionality. They have the same syntax as in OpenGL + * ES." + * + * Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says: + * + * "uniform lowp sampler2D sampler; + * highp vec2 coord; + * ... + * lowp vec4 col = texture2D (sampler, coord); + * // texture2D returns lowp" + * + * 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->is_record() + || type->is_sampler(); +} ir_rvalue * ast_declarator_list::hir(exec_list *instructions, @@ -3689,41 +3724,13 @@ ast_declarator_list::hir(exec_list *instructions, } - /* Precision qualifiers apply to floating point, integer and sampler - * types. - * - * Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says: - * "Any floating point or any integer declaration can have the type - * preceded by one of these precision qualifiers [...] Literal - * constants do not have precision qualifiers. Neither do Boolean - * variables. - * - * Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30 - * spec also says: - * - * "Precision qualifiers are added for code portability with OpenGL - * ES, not for functionality. They have the same syntax as in OpenGL - * ES." - * - * Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says: - * - * "uniform lowp sampler2D sampler; - * highp vec2 coord; - * ... - * lowp vec4 col = texture2D (sampler, coord); - * // texture2D returns lowp" - * - * From this, we infer that GLSL 1.30 (and later) should allow precision - * qualifiers on sampler types just like float and integer types. + /* 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 - && !var->type->is_float() - && !var->type->is_integer() - && !var->type->is_record() - && !var->type->is_sampler() - && !(var->type->is_array() - && (var->type->fields.array->is_float() - || var->type->fields.array->is_integer()))) { + if (!(this->type->qualifier.precision == ast_precision_none + || precision_qualifier_allowed(var->type) + || (var->type->is_array() + && precision_qualifier_allowed(var->type->fields.array)))) { _mesa_glsl_error(&loc, state, "precision qualifiers apply only to floating point" @@ -5455,7 +5462,7 @@ ast_interface_block::hir(exec_list *instructions, } if (this->instance_name != NULL) { _mesa_glsl_error(&loc, state, - "gl_PerVertex input may not be redeclared with " + "gl_PerVertex output may not be redeclared with " "an instance name"); } break; |