From b4e198f47f8423dfb101395cd6cb5a11fa12954e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 5 Jan 2016 04:01:11 -0800 Subject: glsl, nir: Make ir_quadop_bitfield_insert a vectorized operation. We would like to be able to combine result.x = bitfieldInsert(src0.x, src1.x, src2.x, src3.x); result.y = bitfieldInsert(src0.y, src1.y, src2.y, src3.y); result.z = bitfieldInsert(src0.z, src1.z, src2.z, src3.z); result.w = bitfieldInsert(src0.w, src1.w, src2.w, src3.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 four operands will be the same, for simplicity. Signed-off-by: Kenneth Graunke Reviewed-by: Matt Turner Reviewed-by: Ilia Mirkin --- src/glsl/ir_constant_expression.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/glsl/ir_constant_expression.cpp') diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 38b6dd59759..f5b5bd87b6b 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1710,10 +1710,10 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) } case ir_quadop_bitfield_insert: { - int offset = op[2]->value.i[0]; - int bits = op[3]->value.i[0]; - for (unsigned c = 0; c < components; c++) { + int offset = op[2]->value.i[c]; + int bits = op[3]->value.i[c]; + if (bits == 0) data.u[c] = op[0]->value.u[c]; else if (offset < 0 || bits < 0) -- cgit v1.2.3