summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorJuan A. Suarez Romero <[email protected]>2018-05-09 15:17:59 +0000
committerJuan A. Suarez Romero <[email protected]>2018-06-01 18:09:22 +0200
commitcbe4baed1f63db697500db069756750afc9e7609 (patch)
tree0f8280883a02344faf7799ff0d98801a346dbb02 /src/compiler/glsl
parent4ad8e2ac82d6dbc78dd39947d6b2914be169d0d9 (diff)
glsl: Add ir_binop_vector_extract in NIR
Implement ir_binop_vector_extract using NIR operations. Based on SPIR-V to NIR approach. This fixes: dEQP-GLES3.functional.shaders.indexing.moredynamic.with_value_from_indexing_expression_fragment Piglit's glsl-fs-vec4-indexing-8.shader_test CC: [email protected] Signed-off-by: Juan A. Suarez Romero <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Iago Toral <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/glsl_to_nir.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
index dc3e822308b..baaa3affed9 100644
--- a/src/compiler/glsl/glsl_to_nir.cpp
+++ b/src/compiler/glsl/glsl_to_nir.cpp
@@ -1940,6 +1940,15 @@ nir_visitor::visit(ir_expression *ir)
unreachable("not reached");
}
break;
+ case ir_binop_vector_extract: {
+ result = nir_channel(&b, srcs[0], 0);
+ for (unsigned i = 1; i < ir->operands[0]->type->vector_elements; i++) {
+ nir_ssa_def *swizzled = nir_channel(&b, srcs[0], i);
+ result = nir_bcsel(&b, nir_ieq(&b, srcs[1], nir_imm_int(&b, i)),
+ swizzled, result);
+ }
+ break;
+ }
case ir_binop_ldexp: result = nir_ldexp(&b, srcs[0], srcs[1]); break;
case ir_triop_fma: