[Mesa-dev] [PATCH 47/51] glsl: HACK: Force texture return into 16-bits

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


and convert coordinates unconditionally to 32-bits.

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

diff --git a/src/compiler/glsl/lower_mediump.cpp b/src/compiler/glsl/lower_mediump.cpp
index 07f1f1ba9d..094ab4e743 100644
--- a/src/compiler/glsl/lower_mediump.cpp
+++ b/src/compiler/glsl/lower_mediump.cpp
@@ -132,6 +132,7 @@ public:
 
    virtual ir_visitor_status visit_leave(ir_assignment *ir);
    virtual ir_visitor_status visit_leave(ir_expression *ir);
+   virtual ir_visitor_status visit_leave(ir_texture *ir);
    virtual ir_visitor_status visit_leave(ir_swizzle *ir);
 
    virtual void handle_rvalue(ir_rvalue **rvalue);
@@ -238,6 +239,24 @@ lower_mediump_visitor::visit_leave(ir_assignment *ir)
 }
 
 ir_visitor_status
+lower_mediump_visitor::visit_leave(ir_texture *ir)
+{
+   ir_rvalue_visitor::visit_leave(ir);
+
+   /* HACK: Intel compiler backend isn't prepared for 16-bit texture
+    *       arguments.
+    * TODO: Convert the rest of the operands.
+    */
+   if (is_16_bit(ir->coordinate))
+      ir->coordinate = convert(ir->coordinate, ir_unop_h2f);
+
+   if (ir->type->is_float())
+      retype_to_float16(&ir->type);
+
+   return visit_continue;
+}
+
+ir_visitor_status
 lower_mediump_visitor::visit_leave(ir_swizzle *ir)
 {
    ir_rvalue_visitor::visit_leave(ir);
-- 
2.11.0



More information about the mesa-dev mailing list