panfrost: Don't double-flip Z/W for 2D arrays
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 7 Jan 2020 02:36:20 +0000 (21:36 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 7 Jan 2020 07:54:52 +0000 (08:54 +0100)
We need to mindful that we don't clobber the shadow comparator.

Fixes dEQP-GLES3.functional.shaders.texture_functions.texture.sampler2darrayshadow_*

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
src/panfrost/midgard/midgard_compile.c

index 568a08da44cd48712054e32ad2308a910308117f..efd9f483de5b34410d57d2fb7ba50d33cf457f1d 100644 (file)
@@ -1837,10 +1837,13 @@ emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
                         }
 
                         if (instr->sampler_dim == GLSL_SAMPLER_DIM_2D) {
-                                /* Array component in w but NIR wants it in z */
+                                /* Array component in w but NIR wants it in z,
+                                 * but if we have a temp coord we already fixed
+                                 * that up */
+
                                 if (nr_components == 3) {
                                         ins.swizzle[1][2] = COMPONENT_Z;
-                                        ins.swizzle[1][3] = COMPONENT_Z;
+                                        ins.swizzle[1][3] = needs_temp_coord ? COMPONENT_W : COMPONENT_Z;
                                 } else if (nr_components == 2) {
                                         ins.swizzle[1][2] =
                                                 instr->is_shadow ? COMPONENT_Z : COMPONENT_X;