[Mesa-dev] [PATCH 2/4] panfrost/midgard: Apply component to load_input

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Thu Jun 6 16:34:56 UTC 2019


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

diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 032f4a91196..4d28e151bda 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -1125,6 +1125,9 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
                         offset += nir_src_as_uint(instr->src[0]);
                 }
 
+                /* We may need to apply a fractional offset */
+                int component = instr->intrinsic == nir_intrinsic_load_input ?
+                        nir_intrinsic_component(instr) : 0;
                 reg = nir_dest_index(ctx, &instr->dest);
 
                 if (instr->intrinsic == nir_intrinsic_load_uniform && !ctx->is_blend) {
@@ -1135,6 +1138,7 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr)
 
                         midgard_instruction ins = m_ld_vary_32(reg, offset);
                         ins.load_store.mask = (1 << nr_comp) - 1;
+                        ins.load_store.swizzle = SWIZZLE_XYZW >> (2 * component);
 
                         midgard_varying_parameter p = {
                                 .is_varying = 1,
-- 
2.20.1



More information about the mesa-dev mailing list