[Mesa-dev] [PATCH 50/51] glsl: HACK: Lower all temporary float variables to 16-bits

Topi Pohjolainen topi.pohjolainen at gmail.com
Fri Nov 24 12:27:17 UTC 2017


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/compiler/glsl/lower_mediump.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/compiler/glsl/lower_mediump.cpp b/src/compiler/glsl/lower_mediump.cpp
index bae18c9bfb..73b8aa577c 100644
--- a/src/compiler/glsl/lower_mediump.cpp
+++ b/src/compiler/glsl/lower_mediump.cpp
@@ -184,6 +184,17 @@ lower_mediump_visitor::can_be_lowered(const ir_variable *var) const
        var->data.how_declared == ir_var_declared_implicitly)
       return true;
 
+   /* Such as builtins, temporary variables don't have have precision
+    * qualifiers either. Lower them by default.
+    *
+    * TODO: Surrounding expressions should really be examined to tell if
+    *       full precision needed. Moreover, these can be referred from
+    *       multiple locations. If any requires full precision, then all
+    *       expressions involved would need to operate on full precision?
+    */
+   if (var->data.mode == ir_var_temporary)
+      return true;
+
    return var->data.precision == ast_precision_low ||
           var->data.precision == ast_precision_medium;
 }
-- 
2.11.0



More information about the mesa-dev mailing list