[Mesa-dev] [PATCH] glsl: Add ir_binop_vector_extract in NIR
Juan A. Suarez Romero
jasuarez at igalia.com
Fri Jun 1 09:25:05 UTC 2018
On Wed, 2018-05-30 at 15:10 -0700, Eric Anholt wrote:
> "Juan A. Suarez Romero" <jasuarez at igalia.com> writes:
>
> > 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
> >
> > Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
> > ---
> >
> > Pending to verify that this also fixes https://bugs.freedesktop.org/show_bug.cgi?id=105438
> >
> > src/compiler/glsl/glsl_to_nir.cpp | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp
> > index 8e5e9c34912..5fc420d856f 100644
> > --- a/src/compiler/glsl/glsl_to_nir.cpp
> > +++ b/src/compiler/glsl/glsl_to_nir.cpp
> > @@ -1928,6 +1928,17 @@ nir_visitor::visit(ir_expression *ir)
> > unreachable("not reached");
> > }
> > break;
> > + case ir_binop_vector_extract: {
> > + unsigned swiz[4] = { 0 };
> > + result = nir_swizzle(&b, srcs[0], swiz, 1, true);
> > + for (unsigned i = 1; i < ir->operands[0]->type->vector_elements; i++) {
> > + swiz[0] = i;
> > + nir_ssa_def *swizzled = nir_swizzle(&b, srcs[0], swiz, 1, true);
>
> You could use nir_channel(&b, srcs[0], i) here and above to simplify
> (which I think gets the use_fmov argument right, as well). Other than
> that,
>
I'm checking nir_channel(), and it sets use_fmov to false, rather than true.
J.A.
> Reviewed-by: Eric Anholt <eric at anholt.net>
More information about the mesa-dev
mailing list