From: Alyssa Rosenzweig Date: Fri, 26 Jul 2019 13:30:16 +0000 (-0700) Subject: pan/midgard: Fix vector->scalar swizzles X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4038f944535c5c2e917ecff178fc27f0fc6d79d;p=mesa.git pan/midgard: Fix vector->scalar swizzles The swizzle should be taken on the masked component, rather than unconditionally X. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c index 3522e77d5b1..ec90d46ba21 100644 --- a/src/panfrost/midgard/midgard_emit.c +++ b/src/panfrost/midgard/midgard_emit.c @@ -41,14 +41,15 @@ component_from_mask(unsigned mask) } static unsigned -vector_to_scalar_source(unsigned u, bool is_int, bool is_full) +vector_to_scalar_source(unsigned u, bool is_int, bool is_full, + unsigned masked_component) { midgard_vector_alu_src v; memcpy(&v, &u, sizeof(v)); /* TODO: Integers */ - unsigned component = v.swizzle & 3; + unsigned component = (v.swizzle >> (2*masked_component)) & 3; bool upper = false; /* TODO */ midgard_scalar_alu_src s = { 0 }; @@ -91,15 +92,17 @@ vector_to_scalar_alu(midgard_vector_alu v, midgard_instruction *ins) bool is_full = v.reg_mode == midgard_reg_mode_32; bool is_inline_constant = ins->ssa_args.inline_constant; + unsigned comp = component_from_mask(ins->mask); + /* The output component is from the mask */ midgard_scalar_alu s = { .op = v.op, - .src1 = vector_to_scalar_source(v.src1, is_int, is_full), - .src2 = !is_inline_constant ? vector_to_scalar_source(v.src2, is_int, is_full) : 0, + .src1 = vector_to_scalar_source(v.src1, is_int, is_full, comp), + .src2 = !is_inline_constant ? vector_to_scalar_source(v.src2, is_int, is_full, comp) : 0, .unknown = 0, .outmod = v.outmod, .output_full = is_full, - .output_component = component_from_mask(ins->mask), + .output_component = comp }; /* Full components are physically spaced out */