diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-26 06:30:16 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-26 08:37:08 -0700 |
commit | e4038f944535c5c2e917ecff178fc27f0fc6d79d (patch) | |
tree | 4d1129468c867007c12f0704dab7f47b1667aada /src/panfrost/midgard/midgard_emit.c | |
parent | 10324095d2ee0e897a1bc41762d8fd8614ecd634 (diff) |
pan/midgard: Fix vector->scalar swizzles
The swizzle should be taken on the masked component, rather than
unconditionally X.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/panfrost/midgard/midgard_emit.c')
-rw-r--r-- | src/panfrost/midgard/midgard_emit.c | 13 |
1 files changed, 8 insertions, 5 deletions
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 */ |