diff options
author | Kenneth Graunke <[email protected]> | 2010-07-21 21:46:16 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2010-07-28 15:46:29 -0700 |
commit | 3d5c2f0adbd72a68d4fe3900b0d3e267510950ef (patch) | |
tree | 5a65d8056dda9dc76564b5d48857028eaedb93ef /src/glsl/ir_constant_expression.cpp | |
parent | 04b3643dbf2e0d25e67c86845b2506ad1d26939d (diff) |
ir_constant_expression: Add support for the "faceforward" builtin.
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 580ef1d4fae..c939690129a 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -881,7 +881,10 @@ ir_call::constant_expression_value() } else if (strcmp(callee, "exp2") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_exp2, type, op[0], NULL); } else if (strcmp(callee, "faceforward") == 0) { - return NULL; /* FINISHME: implement this */ + if (dot(op[2], op[1]) < 0) + return op[0]; + for (unsigned c = 0; c < op[0]->type->components(); c++) + data.f[c] = -op[0]->value.f[c]; } else if (strcmp(callee, "floor") == 0) { expr = new(mem_ctx) ir_expression(ir_unop_floor, type, op[0], NULL); } else if (strcmp(callee, "fract") == 0) { |