vc4: store tex sampler in proper register
authorJuan A. Suarez Romero <jasuarez@igalia.com>
Thu, 18 Aug 2022 08:03:39 +0000 (10:03 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 22 Aug 2022 10:34:39 +0000 (10:34 +0000)
When unpacking the texture sample result ensure it is moved to the
proper expected dest register.

This fixes incorrect texturing in Chromium using PixiJS framework.

CC: mesa-stable
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18122>

src/broadcom/ci/broadcom-rpi3-fails.txt
src/gallium/drivers/vc4/vc4_program.c

index 0a8edae..651dbbf 100644 (file)
@@ -1139,11 +1139,7 @@ spec@glsl-1.10@execution@built-in-functions@vs-tan-float,Fail
 spec@glsl-1.10@execution@built-in-functions@vs-tan-vec2,Fail
 spec@glsl-1.10@execution@built-in-functions@vs-tan-vec3,Fail
 spec@glsl-1.10@execution@built-in-functions@vs-tan-vec4,Fail
-spec@glsl-1.10@execution@fs-texture-select,Fail
 spec@glsl-1.10@execution@glsl-fs-convolution-2,Fail
-spec@glsl-1.10@execution@samplers@glsl-fs-sampler-numbering-2,Fail
-spec@glsl-1.10@execution@samplers@glsl-fs-sampler-numbering-3,Fail
-spec@glsl-1.10@execution@samplers@in-parameter-array,Fail
 spec@glsl-1.20@built-in constants,Fail
 spec@glsl-1.20@built-in constants@gl_MaxVertexAttribs,Fail
 spec@glsl-1.20@execution@fs-nan-builtin-max,Fail
index 86e7ba1..ac8bd19 100644 (file)
@@ -246,24 +246,6 @@ ntq_store_dest(struct vc4_compile *c, nir_dest *dest, int chan,
         }
 }
 
-static struct qreg *
-ntq_get_dest(struct vc4_compile *c, nir_dest *dest)
-{
-        if (dest->is_ssa) {
-                struct qreg *qregs = ntq_init_ssa_def(c, &dest->ssa);
-                for (int i = 0; i < dest->ssa.num_components; i++)
-                        qregs[i] = c->undef;
-                return qregs;
-        } else {
-                nir_register *reg = dest->reg.reg;
-                assert(dest->reg.base_offset == 0);
-                assert(reg->num_array_elems == 0);
-                struct hash_entry *entry =
-                        _mesa_hash_table_search(c->def_ht, reg);
-                return entry->data;
-        }
-}
-
 static struct qreg
 ntq_get_src(struct vc4_compile *c, nir_src src, int i)
 {
@@ -523,7 +505,6 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
 
         enum pipe_format format = c->key->tex[unit].format;
 
-        struct qreg *dest = ntq_get_dest(c, &instr->dest);
         if (util_format_is_depth_or_stencil(format)) {
                 struct qreg normalized = ntq_scale_depth_texture(c, tex);
                 struct qreg depth_output;
@@ -577,10 +558,12 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
                 }
 
                 for (int i = 0; i < 4; i++)
-                        dest[i] = depth_output;
+                        ntq_store_dest(c, &instr->dest, i,
+                                       qir_MOV(c, depth_output));
         } else {
                 for (int i = 0; i < 4; i++)
-                        dest[i] = qir_UNPACK_8_F(c, tex, i);
+                        ntq_store_dest(c, &instr->dest, i,
+                                       qir_UNPACK_8_F(c, tex, i));
         }
 }