[Mesa-dev] [PATCH 16/20] pan/midgard: Clamp st_vary swizzle by number of components

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Fri Aug 16 15:35:56 UTC 2019


Same issue with liveness analysis. If we store out a vec3, we should not
reference the .w component.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/panfrost/midgard/midgard_compile.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 0be9cc32dc2..73ba3173eb3 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1577,11 +1577,12 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
                         emit_explicit_constant(ctx, reg, reg);
 
                         unsigned component = nir_intrinsic_component(instr);
+                        unsigned nr_comp = nir_src_num_components(instr->src[0]);
 
                         midgard_instruction st = m_st_vary_32(reg, offset);
                         st.load_store.arg_1 = 0x9E;
                         st.load_store.arg_2 = 0x1E;
-                        st.load_store.swizzle = SWIZZLE_XYZW << (2*component);
+                        st.load_store.swizzle = swizzle_of(nr_comp) << (2*component);
                         emit_mir_instruction(ctx, st);
                 } else {
                         DBG("Unknown store\n");
-- 
2.23.0.rc1



More information about the mesa-dev mailing list