[Mesa-dev] [PATCH 4/8] i965: Use UniformBooleanTrue value for boolean literal true.

Matt Turner mattst88 at gmail.com
Sun Aug 10 16:18:34 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 4 +++-
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index c16401b..7f463c2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2127,7 +2127,9 @@ fs_visitor::visit(ir_constant *ir)
 	    emit(MOV(dst_reg, fs_reg(ir->value.i[i])));
 	    break;
 	 case GLSL_TYPE_BOOL:
-	    emit(MOV(dst_reg, fs_reg((int)ir->value.b[i])));
+            emit(MOV(dst_reg,
+                     fs_reg(ir->value.b[i] != 0 ? ctx->Const.UniformBooleanTrue
+                                                : 0)));
 	    break;
 	 default:
 	    unreachable("Non-float/uint/int/bool constant");
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 1b46850..c0b3b74 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -2202,7 +2202,9 @@ vec4_visitor::emit_constant_values(dst_reg *dst, ir_constant *ir)
 	 emit(MOV(*dst, src_reg(ir->value.u[i])));
 	 break;
       case GLSL_TYPE_BOOL:
-	 emit(MOV(*dst, src_reg(ir->value.b[i])));
+         emit(MOV(*dst,
+                  src_reg(ir->value.b[i] != 0 ? ctx->Const.UniformBooleanTrue
+                                              : 0)));
 	 break;
       default:
 	 unreachable("Non-float/uint/int/bool constant");
-- 
1.8.5.5



More information about the mesa-dev mailing list