aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-01-07 16:01:51 -0800
committerMatt Turner <[email protected]>2016-01-13 10:35:12 -0800
commit84d6130c21a8a570efefe54aa723f549b34c3256 (patch)
treecdbcc4a92e22d368064449a48066d652c20c0270 /src/glsl/ir_constant_expression.cpp
parentb4e198f47f8423dfb101395cd6cb5a11fa12954e (diff)
glsl, nir: Make ir_triop_bitfield_extract a vectorized operation.
We would like to be able to combine result.x = bitfieldExtract(src0.x, src1.x, src2.x); result.y = bitfieldExtract(src0.y, src1.y, src2.y); result.z = bitfieldExtract(src0.z, src1.z, src2.z); result.w = bitfieldExtract(src0.w, src1.w, src2.w); into a single ivec4 bitfieldInsert operation. This should be possible with most drivers. This patch changes the offset and bits parameters from scalar ints to ivecN or uvecN. The type of all three operands will be the same, for simplicity. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/glsl/ir_constant_expression.cpp')
-rw-r--r--src/glsl/ir_constant_expression.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index f5b5bd87b6b..7613139306f 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -1588,10 +1588,10 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
break;
case ir_triop_bitfield_extract: {
- int offset = op[1]->value.i[0];
- int bits = op[2]->value.i[0];
-
for (unsigned c = 0; c < components; c++) {
+ int offset = op[1]->value.i[c];
+ int bits = op[2]->value.i[c];
+
if (bits == 0)
data.u[c] = 0;
else if (offset < 0 || bits < 0)