[Mesa-dev] [PATCH 49/51] glsl: HACK: Lower builtin float outputs to 16-bits by default

Topi Pohjolainen topi.pohjolainen at gmail.com
Fri Nov 24 12:27:16 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 45cf75b53c..bae18c9bfb 100644
--- a/src/compiler/glsl/lower_mediump.cpp
+++ b/src/compiler/glsl/lower_mediump.cpp
@@ -173,6 +173,17 @@ lower_mediump_visitor::can_be_lowered(const ir_variable *var) const
    if (var->data.mode == ir_var_shader_in)
       return false;
 
+   /* Builtin outputs such as gl_FragColor don't have precision qualifier.
+    * Lower them by default.
+    * 
+    * TODO: If this gets assigned with full precision value, output would
+    *       need to be in full precision instead of the value being converted
+    *       to 16-bits?
+    */
+   if (var->data.mode == ir_var_shader_out &&
+       var->data.how_declared == ir_var_declared_implicitly)
+      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