pan/mdg: Ensure ld_vary_16 is aligned
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 4 Jun 2020 15:32:59 +0000 (11:32 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 4 Jun 2020 17:46:45 +0000 (17:46 +0000)
Otherwise packing may fail.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 5f8dd413bcc ("pan/mdg: Handle 16-bit ld_vary")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5339>

src/panfrost/midgard/midgard_compile.c

index 98f948a9b88c62fec53e5b184aec5a9606f6762b..4cce9102c68c99c05e19bf3836c0e7bf270c1438 100644 (file)
@@ -1273,6 +1273,12 @@ emit_varying_read(
 
         midgard_instruction ins = m_ld_vary_32(dest, offset);
         ins.mask = mask_of(nr_comp);
+        ins.dest_type = type;
+
+        if (type == nir_type_float16) {
+                /* Ensure we are aligned so we can pack it later */
+                ins.mask = mask_of(ALIGN_POT(nr_comp, 2));
+        }
 
         for (unsigned i = 0; i < ARRAY_SIZE(ins.swizzle[0]); ++i)
                 ins.swizzle[0][i] = MIN2(i + component, COMPONENT_W);