diff options
author | Eric Anholt <[email protected]> | 2010-08-23 12:21:33 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-08-23 13:05:53 -0700 |
commit | 5e9ac94cc44ef4f97063d7b696411b2a4be16f36 (patch) | |
tree | 0efbbc6d6f05a37a380bc380d6f3139580e7b1b8 /src/glsl/ir_constant_expression.cpp | |
parent | 47003a8f653db881fbafc96fca93aba38ea3ebc2 (diff) |
mesa: Add new ir_unop_any() expression operation.
The previous any() implementation would generate arg0.x || arg0.y ||
arg0.z. Having an expression operation for this makes it easy for the
backend to generate something easier (DPn + SNE for 915 FS, .any
predication on 965 VS)
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 54f14d1a541..942f1983607 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -149,6 +149,15 @@ ir_expression::constant_expression_value() } break; + case ir_unop_any: + assert(op[0]->type->is_boolean()); + data.b[0] = false; + for (unsigned c = 0; c < op[0]->type->components(); c++) { + if (op[0]->value.b[c]) + data.b[0] = true; + } + break; + case ir_unop_trunc: assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); for (unsigned c = 0; c < op[0]->type->components(); c++) { |