From 9935fe705df44bb633039ca74332cc0c126ccc30 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 17 Nov 2010 13:59:17 -0800 Subject: glsl: Remove the ir_binop_cross opcode. --- src/glsl/ir.cpp | 2 -- src/glsl/ir.h | 1 - src/glsl/ir_constant_expression.cpp | 20 +++++++--------- src/glsl/ir_validate.cpp | 6 ----- src/mesa/drivers/dri/i965/brw_fs.cpp | 1 - .../dri/i965/brw_fs_channel_expressions.cpp | 28 ---------------------- src/mesa/program/ir_to_mesa.cpp | 4 ---- 7 files changed, 8 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 4b886018dc..a7ebc0c2b6 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -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", diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 6a70dede9b..38ed2b23ef 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -771,7 +771,6 @@ enum ir_expression_operation { ir_binop_logic_or, ir_binop_dot, - ir_binop_cross, ir_binop_min, ir_binop_max, diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 740246897a..8a54fc78cc 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -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++) diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index d22789f990..77f48968b8 100644 --- a/src/glsl/ir_validate.cpp +++ b/src/glsl/ir_validate.cpp @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 4648298c1f..9c03b61c82 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -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; diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp index 2a6da4058b..3b7b03a05b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp @@ -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: diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index f45bbf5582..0458625ab0 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -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]); -- cgit v1.2.3