[Mesa-dev] [PATCH] st/mesa: swizzle argument when there's a vector size mismatch
Ilia Mirkin
imirkin at alum.mit.edu
Mon Dec 4 20:00:48 UTC 2017
Yeah, the typo was a last second edit, as always. Thanks for making a
sample failing case, will investigate. I hate all these interpolateat tests
:( so many edge cases...
On Dec 4, 2017 2:51 PM, "Marek Olšák" <maraeo at gmail.com> wrote:
> There is a typo, so it doesn't build.
>
> It breaks these CTS tests:
> gl45-cts at shader_multisample_interpolation@render at interpolate_at_offset*
>
> Error:
> state_tracker/st_glsl_to_tgsi.cpp:1347: void
> glsl_to_tgsi_visitor::visit_expression(ir_expression*, st_src_reg*):
> Assertion `ir->operands[1]->type->vector_elements == 1' failed.
>
> The CTS shader is attached. (to be run with shader-db)
>
> Marek
>
>
> On Sat, Dec 2, 2017 at 5:35 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> > GLSL IR operation arguments can sometimes have an implicit swizzle as a
> > result of a vector arg and a scalar arg, where the scalar argument is
> > implicitly expanded to the size of the vector argument.
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103955
> > Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> > ---
> >
> > I'm *pretty* sure I looked at all of ir_validate to make sure that this
> will
> > be fine, but I wouldn't exclude the possibility that I missed some
> extremely
> > odd case. Could use a piglit run.
> >
> > src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> > index 0772b736275..8ca337d16ec 100644
> > --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> > +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> > @@ -1342,9 +1342,30 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression*
> ir, st_src_reg *op)
> >
> > int vector_elements = ir->operands[0]->type->vector_elements;
> > if (ir->operands[1]) {
> > + st_src_reg *swz_op = NULL;
> > + if (vector_elements > ir->operands[1]->type->vector_elements) {
> > + assert(ir->operands[1]->type->vector_elements == 1);
> > + swz_op = &op[1];
> > + } else if (vector_elements < ir->operands[1]->type->vector_elements)
> {
> > + assert(ir->operands[0]->type->vector_elements == 1);
> > + swz_op = &op[0];
> > + }
> > + if (swz_op) {
> > + uint16_t swizzle_x = GET_SWZ(swz_op->swizzle, 0);
> > + swz_op->swizzle = MAKE_SWIZZLE4(swizzle_x, swizzle_x,
> > + swizzle_x, swizzle_x);
> > + }
> > vector_elements = MAX2(vector_elements,
> > ir->operands[1]->type->vector_elements);
> > }
> > + if (ir->operands[2] &&
> > + ir->operands[2]->type->vector_elements != vector_elements) {
> > + /* This can happen with ir_triop_lrp, i.e. glsl mix */
> > + assert(ir->operands[2]->type->vector_elements == 1);
> > + uint16_t swizzle_x = GET_SWZ(op[2]->swizzle, 0);
> > + op[2].swizzle = MAKE_SWIZZLE4(swizzle_x, swizzle_x,
> > + swizzle_x, swizzle_x);
> > + }
> >
> > this->result.file = PROGRAM_UNDEFINED;
> >
> > --
> > 2.13.6
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171204/f6315288/attachment.html>
More information about the mesa-dev
mailing list