diff options
author | Matt Turner <[email protected]> | 2013-08-19 10:45:46 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2013-09-09 15:01:08 -0700 |
commit | 7aaa38728f93bfb69573e0d866f24e8cb41836f0 (patch) | |
tree | f4de2a2d80ac24087c37dea60b37fe41d9745644 /src/glsl/ir_constant_expression.cpp | |
parent | 60850b7b9fbb9827d6841dbd4a4cd9b1e3554d45 (diff) |
glsl: Add conditional-select IR.
It's a ?: that operates per-component on vectors. Will be used in
upcoming lowering pass for ldexp and the implementation of frexp.
csel(selector, a, b):
per-component result = selector ? a : b
Reviewed-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index ec338a8348d..a67470bf366 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -395,6 +395,7 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) case ir_binop_lshift: case ir_binop_rshift: case ir_binop_vector_extract: + case ir_triop_csel: case ir_triop_bitfield_extract: break; @@ -1399,6 +1400,13 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) break; } + case ir_triop_csel: + for (unsigned c = 0; c < components; c++) { + data.u[c] = op[0]->value.b[c] ? op[1]->value.u[c] + : op[2]->value.u[c]; + } + break; + case ir_triop_vector_insert: { const unsigned idx = op[2]->value.u[0]; |