glsl: Remove the ir_binop_cross opcode.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 17 Nov 2010 21:59:17 +0000 (13:59 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 17 Nov 2010 21:59:17 +0000 (13:59 -0800)
src/glsl/ir.cpp
src/glsl/ir.h
src/glsl/ir_constant_expression.cpp
src/glsl/ir_validate.cpp
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/program/ir_to_mesa.cpp

index 4b886018dcab89f1fa4299c5a9def5f6c5e6e0a7..a7ebc0c2b66557a98fe1730a7560a355a936a10a 100644 (file)
@@ -252,7 +252,6 @@ ir_expression::get_num_operands(ir_expression_operation op)
       2, /* ir_binop_logic_or */
 
       2, /* ir_binop_dot */
-      2, /* ir_binop_cross */
       2, /* ir_binop_min */
       2, /* ir_binop_max */
 
@@ -317,7 +316,6 @@ static const char *const operator_strs[] = {
    "^^",
    "||",
    "dot",
-   "cross",
    "min",
    "max",
    "pow",
index 6a70dede9b28713076b663f00bf655de98a6de4c..38ed2b23efbad70abb7e3eba18c3754ab847579c 100644 (file)
@@ -771,7 +771,6 @@ enum ir_expression_operation {
    ir_binop_logic_or,
 
    ir_binop_dot,
-   ir_binop_cross,
    ir_binop_min,
    ir_binop_max,
 
index 740246897a48702424f4737c195712ab2ba89d79..8a54fc78cca32da1167c4ffad7e1a987550cba3e 100644 (file)
@@ -412,17 +412,6 @@ ir_expression::constant_expression_value()
       }
       break;
 
-   case ir_binop_cross:
-      assert(op[0]->type == glsl_type::vec3_type);
-      assert(op[1]->type == glsl_type::vec3_type);
-      data.f[0] = (op[0]->value.f[1] * op[1]->value.f[2] -
-                  op[1]->value.f[1] * op[0]->value.f[2]);
-      data.f[1] = (op[0]->value.f[2] * op[1]->value.f[0] -
-                  op[1]->value.f[2] * op[0]->value.f[0]);
-      data.f[2] = (op[0]->value.f[0] * op[1]->value.f[1] -
-                  op[1]->value.f[0] * op[0]->value.f[1]);
-      break;
-
    case ir_binop_add:
       assert(op[0]->type == op[1]->type || op0_scalar || op1_scalar);
       for (unsigned c = 0, c0 = 0, c1 = 0;
@@ -1064,7 +1053,14 @@ ir_call::constant_expression_value()
       for (unsigned c = 0; c < op[0]->type->components(); c++)
         data.f[c] = coshf(op[0]->value.f[c]);
    } else if (strcmp(callee, "cross") == 0) {
-      expr = new(mem_ctx) ir_expression(ir_binop_cross, type, op[0], op[1]);
+      assert(op[0]->type == glsl_type::vec3_type);
+      assert(op[1]->type == glsl_type::vec3_type);
+      data.f[0] = (op[0]->value.f[1] * op[1]->value.f[2] -
+                  op[1]->value.f[1] * op[0]->value.f[2]);
+      data.f[1] = (op[0]->value.f[2] * op[1]->value.f[0] -
+                  op[1]->value.f[2] * op[0]->value.f[0]);
+      data.f[2] = (op[0]->value.f[0] * op[1]->value.f[1] -
+                  op[1]->value.f[0] * op[0]->value.f[1]);
    } else if (strcmp(callee, "degrees") == 0) {
       assert(op[0]->type->is_float());
       for (unsigned c = 0; c < op[0]->type->components(); c++)
index d22789f990aa7f6fae772f527c23b231c99b1196..77f48968b814605b58a0b620d16b4b412b62b6fa 100644 (file)
@@ -372,12 +372,6 @@ ir_validate::visit_leave(ir_expression *ir)
       assert(ir->operands[0]->type->is_vector());
       assert(ir->operands[0]->type == ir->operands[1]->type);
       break;
-
-   case ir_binop_cross:
-      assert(ir->operands[0]->type == glsl_type::vec3_type);
-      assert(ir->operands[1]->type == glsl_type::vec3_type);
-      assert(ir->type == glsl_type::vec3_type);
-      break;
    }
 
    return visit_continue;
index 4648298c1f5eb517ebc359296ff5fd8eafb2cb10..9c03b61c82e49c3d39c62b74b1e892d7389a6c0e 100644 (file)
@@ -850,7 +850,6 @@ fs_visitor::visit(ir_expression *ir)
       break;
 
    case ir_binop_dot:
-   case ir_binop_cross:
    case ir_unop_any:
       assert(!"not reached: should be handled by brw_fs_channel_expressions");
       break;
index 2a6da4058b8ddaeb6dfa8d5bab617c76001cc358..3b7b03a05b80193557591d8589f8022b15dd2a85 100644 (file)
@@ -288,34 +288,6 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
       break;
    }
 
-   case ir_binop_cross: {
-      for (i = 0; i < vector_elements; i++) {
-        int swiz0 = (i + 1) % 3;
-        int swiz1 = (i + 2) % 3;
-        ir_expression *temp1, *temp2;
-
-        temp1 = new(mem_ctx) ir_expression(ir_binop_mul,
-                                           element_type,
-                                           get_element(op_var[0], swiz0),
-                                           get_element(op_var[1], swiz1));
-
-        temp2 = new(mem_ctx) ir_expression(ir_binop_mul,
-                                           element_type,
-                                           get_element(op_var[1], swiz0),
-                                           get_element(op_var[0], swiz1));
-
-        temp2 = new(mem_ctx) ir_expression(ir_unop_neg,
-                                           element_type,
-                                           temp2,
-                                           NULL);
-
-        assign(ir, i, new(mem_ctx) ir_expression(ir_binop_add,
-                                                 element_type,
-                                                 temp1, temp2));
-      }
-      break;
-   }
-
    case ir_binop_logic_and:
    case ir_binop_logic_xor:
    case ir_binop_logic_or:
index f45bbf55821914a322e6f36edbd3337f14856cbf..0458625ab0c810fdaa6c12f1043b89336d7119bf 100644 (file)
@@ -1058,10 +1058,6 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
                         ir->operands[0]->type->vector_elements);
       break;
 
-   case ir_binop_cross:
-      ir_to_mesa_emit_op2(ir, OPCODE_XPD, result_dst, op[0], op[1]);
-      break;
-
    case ir_unop_sqrt:
       /* sqrt(x) = x * rsq(x). */
       ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]);