" (signature float\n"
" (parameters\n"
" (declare (in) float x))\n"
- " ((return (expression float - (var_ref x) (expression float floor (var_ref x))))))\n"
+ " ((return (expression float fract (var_ref x)))))\n"
"\n"
" (signature vec2\n"
" (parameters\n"
" (declare (in) vec2 x))\n"
- " ((return (expression vec2 - (var_ref x) (expression vec2 floor (var_ref x))))))\n"
+ " ((return (expression vec2 fract (var_ref x)))))\n"
"\n"
" (signature vec3\n"
" (parameters\n"
" (declare (in) vec3 x))\n"
- " ((return (expression vec3 - (var_ref x) (expression vec3 floor (var_ref x))))))\n"
+ " ((return (expression vec3 fract (var_ref x)))))\n"
"\n"
" (signature vec4\n"
" (parameters\n"
" (declare (in) vec4 x))\n"
- " ((return (expression vec4 - (var_ref x) (expression vec4 floor (var_ref x))))))\n"
+ " ((return (expression vec4 fract (var_ref x)))))\n"
"))\n"
"\n"
};
(signature float
(parameters
(declare (in) float x))
- ((return (expression float - (var_ref x) (expression float floor (var_ref x))))))
+ ((return (expression float fract (var_ref x)))))
(signature vec2
(parameters
(declare (in) vec2 x))
- ((return (expression vec2 - (var_ref x) (expression vec2 floor (var_ref x))))))
+ ((return (expression vec2 fract (var_ref x)))))
(signature vec3
(parameters
(declare (in) vec3 x))
- ((return (expression vec3 - (var_ref x) (expression vec3 floor (var_ref x))))))
+ ((return (expression vec3 fract (var_ref x)))))
(signature vec4
(parameters
(declare (in) vec4 x))
- ((return (expression vec4 - (var_ref x) (expression vec4 floor (var_ref x))))))
+ ((return (expression vec4 fract (var_ref x)))))
))
1, /* ir_unop_trunc */
1, /* ir_unop_ceil */
1, /* ir_unop_floor */
+ 1, /* ir_unop_fract */
1, /* ir_unop_sin */
1, /* ir_unop_cos */
"trunc",
"ceil",
"floor",
+ "fract",
"sin",
"cos",
"dFdx",
ir_unop_trunc,
ir_unop_ceil,
ir_unop_floor,
+ ir_unop_fract,
/*@}*/
/**
}
break;
+ case ir_unop_fract:
+ for (c = 0; c < ir->operands[0]->type->components(); c++) {
+ switch (ir->type->base_type) {
+ case GLSL_TYPE_UINT:
+ data.u[c] = 0;
+ break;
+ case GLSL_TYPE_INT:
+ data.i[c] = 0;
+ break;
+ case GLSL_TYPE_FLOAT:
+ data.f[c] = op[0]->value.f[c] - floor(op[0]->value.f[c]);
+ break;
+ default:
+ assert(0);
+ }
+ }
+ break;
+
case ir_unop_neg:
for (c = 0; c < ir->operands[0]->type->components(); c++) {
switch (ir->type->base_type) {
case ir_unop_floor:
ir_to_mesa_emit_op1(ir, OPCODE_FLR, result_dst, op[0]);
break;
+ case ir_unop_fract:
+ ir_to_mesa_emit_op1(ir, OPCODE_FRC, result_dst, op[0]);
+ break;
+
case ir_binop_min:
ir_to_mesa_emit_op2(ir, OPCODE_MIN, result_dst, op[0], op[1]);
break;