diff options
author | Iago Toral Quiroga <[email protected]> | 2015-02-26 12:15:17 +0100 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2015-11-12 09:50:13 +0200 |
commit | e3082fb2732c2af836875201b8d7f49e864c8e4e (patch) | |
tree | 73255f76c66c1d3bae47630d7591f09b5c3793e2 /src | |
parent | d6a61673543deeebac773801cbd717b7a342626e (diff) |
glsl: Add default precision qualifiers to the symbol table
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)
v3: add atomic_uint (reported missing by Marta)
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/glsl_parser.yy | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 4ac8e45b63a..31e254a4fd3 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -313,6 +313,18 @@ 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); + state->symbols->add_default_precision_qualifier("atomic_uint", ast_precision_high); + } _mesa_glsl_initialize_types(state); } ; |