Mesa (master): glsl: update default precision qualifier when it is set in the shader

Samuel Iglesias Gonsálvez samuelig at kemper.freedesktop.org
Wed Oct 26 10:05:19 UTC 2016


Module: Mesa
Branch: master
Commit: 0e742926c6895dcaf8bdbe43022c8a0bc74fdd96
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e742926c6895dcaf8bdbe43022c8a0bc74fdd96

Author: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Date:   Fri Oct 21 08:23:59 2016 +0200

glsl: update default precision qualifier when it is set in the shader

Default precision qualifier for a data type could be set several times
inside a shader. This patch allows to update the default precision
qualifier for the given type that is saved in the symbol table.

If it is not in the symbol table, just add it.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97804
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

---

 src/compiler/glsl/glsl_symbol_table.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/compiler/glsl/glsl_symbol_table.cpp b/src/compiler/glsl/glsl_symbol_table.cpp
index 3162bb6..15e819e 100644
--- a/src/compiler/glsl/glsl_symbol_table.cpp
+++ b/src/compiler/glsl/glsl_symbol_table.cpp
@@ -213,7 +213,10 @@ bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
    symbol_table_entry *entry =
       new(mem_ctx) symbol_table_entry(default_specifier);
 
-   return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
+   if (!get_entry(name))
+      return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
+
+   return _mesa_symbol_table_replace_symbol(table, name, entry) == 0;
 }
 
 void glsl_symbol_table::add_global_function(ir_function *f)




More information about the mesa-commit mailing list