mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 19:40:10 +01:00
pan/midgard: Fix vector->scalar swizzles
The swizzle should be taken on the masked component, rather than unconditionally X. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
10324095d2
commit
e4038f9445
1 changed files with 8 additions and 5 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue