[Mesa-dev] [PATCH 2/7] glsl: Add default precision qualifiers to the symbol table

Tapani Pälli tapani.palli at intel.com
Thu Nov 5 05:00:45 PST 2015



On 11/05/2015 01:33 PM, Tapani Pälli wrote:
> From: Iago Toral Quiroga <itoral at igalia.com>
>
> The GLSL ES spec specifies default precision qualifiers for certain types,
> so populate the symbol table with these.
>
> Notice that the desktop GLSL spec also indicates defaults for some types
> but this is not really useful since precision qualifiers are completely
> ignored in desktop GLSL.
>
> v2: simplify and add samplerExternalOES, specified by
>      OES_EGL_image_external (Tapani)
> ---
>   src/glsl/glsl_parser.yy | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 4636435..4bef345 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -312,6 +312,17 @@ translation_unit:
>      {
>         delete state->symbols;
>         state->symbols = new(ralloc_parent(state)) glsl_symbol_table;
> +      if (state->es_shader) {
> +         if (state->stage == MESA_SHADER_FRAGMENT) {
> +            state->symbols->add_default_precision_qualifier("int", ast_precision_medium);
> +         } else {
> +            state->symbols->add_default_precision_qualifier("float", ast_precision_high);
> +            state->symbols->add_default_precision_qualifier("int", ast_precision_high);
> +         }
> +         state->symbols->add_default_precision_qualifier("sampler2D", ast_precision_low);
> +         state->symbols->add_default_precision_qualifier("samplerExternalOES", ast_precision_low);
> +         state->symbols->add_default_precision_qualifier("samplerCube", ast_precision_low);

I missed atomic_uint here, will fix and send new version.

> +      }
>         _mesa_glsl_initialize_types(state);
>      }
>      ;
>


More information about the mesa-dev mailing list