" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
- " ((declare () vec3 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t))\n"
- " (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1)))\n"
- " (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0)))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t))\n"
- " (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1)))\n"
- " (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0)))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref t))\n"
- " (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1)))\n"
- " (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0)))))\n"
- " (return (var_ref t))))\n"
+ " ((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
};
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
- ((declare () vec3 t)
- (assign (constant bool (1)) (swiz x (var_ref t))
- (expression float - (expression float * (swiz y (var_ref arg0)) (swiz z (var_ref arg1)))
- (expression float * (swiz y (var_ref arg1)) (swiz z (var_ref arg0)))))
- (assign (constant bool (1)) (swiz y (var_ref t))
- (expression float - (expression float * (swiz z (var_ref arg0)) (swiz x (var_ref arg1)))
- (expression float * (swiz z (var_ref arg1)) (swiz x (var_ref arg0)))))
- (assign (constant bool (1)) (swiz z (var_ref t))
- (expression float - (expression float * (swiz x (var_ref arg0)) (swiz y (var_ref arg1)))
- (expression float * (swiz x (var_ref arg1)) (swiz y (var_ref arg0)))))
- (return (var_ref t))))
+ ((return (expression vec3 cross (var_ref arg0) (var_ref arg1)))))
))
2, /* ir_binop_logic_or */
2, /* ir_binop_dot */
+ 2, /* ir_binop_cross */
2, /* ir_binop_min */
2, /* ir_binop_max */
"^^",
"||",
"dot",
+ "cross",
"min",
"max",
"pow",
ir_binop_logic_or,
ir_binop_dot,
+ ir_binop_cross,
ir_binop_min,
ir_binop_max,
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;
op[0], op[1]);
}
break;
+
+ case ir_binop_cross:
+ ir_to_mesa_emit_op2(ir, OPCODE_XPD, result_dst, op[0], op[1]);
+ break;
+
case ir_unop_sqrt:
ir_to_mesa_emit_scalar_op1(ir, OPCODE_RSQ, result_dst, op[0]);
ir_to_mesa_emit_scalar_op1(ir, OPCODE_RCP, result_dst, result_src);