pan/mdg: Set the z/s store intrinsic base correctly
authorIcecream95 <ixn@keemail.me>
Wed, 8 Jul 2020 04:00:51 +0000 (16:00 +1200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jul 2020 13:35:11 +0000 (13:35 +0000)
When EXT_shader_framebuffer_fetch is used and only depth and/or
stencil are written, we can't rely on the first output being to
depth/stencil.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5755>

src/panfrost/midgard/midgard_compile.c

index dc878c65f4406de691aa81e26566b2322bca7399..dec1f38e094b73c0f6b9806ba06cde527ef4e0b2 100644 (file)
@@ -401,7 +401,12 @@ midgard_nir_lower_zs_store(nir_shader *nir)
 
                         combined_store->num_components = 4;
 
-                        nir_intrinsic_set_base(combined_store, 0);
+                        unsigned base;
+                        if (z_store)
+                                base = nir_intrinsic_base(z_store);
+                        else
+                                base = nir_intrinsic_base(s_store);
+                        nir_intrinsic_set_base(combined_store, base);
 
                         unsigned writeout = 0;
                         if (z_store)