i965: Remove remaining uses of ctx->Const.UniformBooleanTrue in visitors
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 16 Apr 2015 00:39:25 +0000 (17:39 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 22 Apr 2015 23:00:33 +0000 (16:00 -0700)
Since commit 2881b123, we have used 0/~0 for representing booleans on all
gens.  However, we still had a bunch of places in the visitor code where we
were still referring to ctx->Const.UniformBooleanTrue.  Since this is
always ~0, we can just remove them.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 2b8dfe4476679d9dcdd92071a0b2df661b83330f..4d1afb140742e84c95814a28cea3305f7b772b85 100644 (file)
@@ -2639,9 +2639,7 @@ 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(ir->value.b[i] != 0 ? (int)ctx->Const.UniformBooleanTrue
-                                                : 0)));
+            emit(MOV(dst_reg, fs_reg(ir->value.b[i] != 0 ? ~0 : 0)));
            break;
         default:
            unreachable("Non-float/uint/int/bool constant");
index 20e61099e618d381d7c696cbe2eadc7460f356e8..c9a496e6c74977cf192b5d15fce4a50915f4e6b6 100644 (file)
@@ -1635,7 +1635,7 @@ vec4_visitor::visit(ir_expression *ir)
          ir->operands[1]->type->is_vector()) {
         emit(CMP(dst_null_d(), op[0], op[1], BRW_CONDITIONAL_Z));
         emit(MOV(result_dst, src_reg(0)));
-         inst = emit(MOV(result_dst, src_reg((int)ctx->Const.UniformBooleanTrue)));
+         inst = emit(MOV(result_dst, src_reg(~0)));
         inst->predicate = BRW_PREDICATE_ALIGN16_ALL4H;
       } else {
         emit(CMP(result_dst, op[0], op[1], BRW_CONDITIONAL_Z));
@@ -1653,7 +1653,7 @@ vec4_visitor::visit(ir_expression *ir)
         emit(CMP(dst_null_d(), op[0], op[1], BRW_CONDITIONAL_NZ));
 
         emit(MOV(result_dst, src_reg(0)));
-         inst = emit(MOV(result_dst, src_reg((int)ctx->Const.UniformBooleanTrue)));
+         inst = emit(MOV(result_dst, src_reg(~0)));
         inst->predicate = BRW_PREDICATE_ALIGN16_ANY4H;
       } else {
         emit(CMP(result_dst, op[0], op[1], BRW_CONDITIONAL_NZ));
@@ -1667,7 +1667,7 @@ vec4_visitor::visit(ir_expression *ir)
       emit(CMP(dst_null_d(), op[0], src_reg(0), BRW_CONDITIONAL_NZ));
       emit(MOV(result_dst, src_reg(0)));
 
-      inst = emit(MOV(result_dst, src_reg((int)ctx->Const.UniformBooleanTrue)));
+      inst = emit(MOV(result_dst, src_reg(~0)));
       inst->predicate = BRW_PREDICATE_ALIGN16_ANY4H;
       break;
 
@@ -1862,9 +1862,7 @@ vec4_visitor::visit(ir_expression *ir)
                                             const_offset % 16 / 4,
                                             const_offset % 16 / 4);
 
-      /* UBO bools are any nonzero int.  We need to convert them to use the
-       * value of true stored in ctx->Const.UniformBooleanTrue.
-       */
+      /* UBO bools are any nonzero int.  We need to convert them to 0/~0. */
       if (ir->type->base_type == GLSL_TYPE_BOOL) {
          emit(CMP(result_dst, packed_consts, src_reg(0u),
                   BRW_CONDITIONAL_NZ));
@@ -2370,9 +2368,7 @@ 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] != 0 ? (int)ctx->Const.UniformBooleanTrue
-                                              : 0)));
+         emit(MOV(*dst, src_reg(ir->value.b[i] != 0 ? ~0 : 0)));
         break;
       default:
         unreachable("Non-float/uint/int/bool constant");