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: mesa-stable@lists.freedesktop.org
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral <itoral@igalia.com>
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: