glsl2: Make cross() be an expression operation.
ARB_fp, ARB_vp, Mesa IR, and the 965 vertex shader all have instructions for cross. Shaves 12 Mesa instructions off of a 66-instruction shader I have.
This commit is contained in:
@@ -459,8 +459,19 @@ ir_constant_visitor::visit(ir_expression *ir)
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user