glsl: Allow vector logic ops to be generated.
authorMatt Turner <mattst88@gmail.com>
Wed, 18 Mar 2015 06:27:38 +0000 (23:27 -0700)
committerMatt Turner <mattst88@gmail.com>
Tue, 24 Mar 2015 21:42:51 +0000 (14:42 -0700)
They're not accessible from the source language, but optimizations are
allowed to generate them.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/glsl/ir_validate.cpp
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp

index 7a7688cb23bb86732464d80f0ea4623c6d0f7f0c..72c5f061c20a1c6fdcc5d113c26e4095d9c06cbe 100644 (file)
@@ -543,9 +543,9 @@ ir_validate::visit_leave(ir_expression *ir)
    case ir_binop_logic_and:
    case ir_binop_logic_xor:
    case ir_binop_logic_or:
-      assert(ir->type == glsl_type::bool_type);
-      assert(ir->operands[0]->type == glsl_type::bool_type);
-      assert(ir->operands[1]->type == glsl_type::bool_type);
+      assert(ir->type->base_type == GLSL_TYPE_BOOL);
+      assert(ir->operands[0]->type->base_type == GLSL_TYPE_BOOL);
+      assert(ir->operands[1]->type->base_type == GLSL_TYPE_BOOL);
       break;
 
    case ir_binop_dot:
index 933fdde24f923edf4e9376c224186fb1b9f945ce..4049b09797c047d7c43c0f22cd6e10f7fa10741b 100644 (file)
@@ -271,6 +271,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_binop_bit_and:
    case ir_binop_bit_xor:
    case ir_binop_bit_or:
+   case ir_binop_logic_and:
+   case ir_binop_logic_xor:
+   case ir_binop_logic_or:
    case ir_binop_less:
    case ir_binop_greater:
    case ir_binop_lequal:
@@ -329,12 +332,6 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
       break;
    }
 
-   case ir_binop_logic_and:
-   case ir_binop_logic_xor:
-   case ir_binop_logic_or:
-      ir->fprint(stderr);
-      fprintf(stderr, "\n");
-      unreachable("not reached: expression operates on scalars only");
    case ir_binop_all_equal:
    case ir_binop_any_nequal: {
       ir_expression *last = NULL;