mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
Shaders/TEXS: Fixed the component mask in the TEXS instruction.
Previously we could end up with a TEXS that didn't write any outputs, this was wrong.
This commit is contained in:
parent
51ddb130c5
commit
6cf719a4ab
@ -839,29 +839,29 @@ private:
|
|||||||
++shader.scope;
|
++shader.scope;
|
||||||
shader.AddLine(coord);
|
shader.AddLine(coord);
|
||||||
|
|
||||||
// TEXS has two destination registers. RG goes into gpr0+0 and gpr0+1, and BA
|
// TEXS has two destination registers and a swizzle. The first two elements in the swizzle
|
||||||
// goes into gpr28+0 and gpr28+1
|
// go into gpr0+0 and gpr0+1, and the rest goes into gpr28+0 and gpr28+1
|
||||||
size_t texs_offset{};
|
|
||||||
|
|
||||||
size_t src_elem{};
|
size_t written_components = 0;
|
||||||
for (const auto& dest : {instr.gpr0.Value(), instr.gpr28.Value()}) {
|
for (u32 component = 0; component < 4; ++component) {
|
||||||
size_t dest_elem{};
|
if (!instr.texs.IsComponentEnabled(component)) {
|
||||||
for (unsigned elem = 0; elem < 2; ++elem) {
|
continue;
|
||||||
if (!instr.texs.IsComponentEnabled(src_elem++)) {
|
|
||||||
// Skip disabled components
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
regs.SetRegisterToFloat(dest, elem + texs_offset, texture, 1, 4, false,
|
|
||||||
dest_elem++);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!instr.texs.HasTwoDestinations()) {
|
if (written_components < 2) {
|
||||||
// Skip the second destination
|
// Write the first two swizzle components to gpr0 and gpr0+1
|
||||||
break;
|
regs.SetRegisterToFloat(instr.gpr0, component, texture, 1, 4, false,
|
||||||
|
written_components % 2);
|
||||||
|
} else {
|
||||||
|
ASSERT(instr.texs.HasTwoDestinations());
|
||||||
|
// Write the rest of the swizzle components to gpr28 and gpr28+1
|
||||||
|
regs.SetRegisterToFloat(instr.gpr28, component, texture, 1, 4, false,
|
||||||
|
written_components % 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
texs_offset += 2;
|
++written_components;
|
||||||
}
|
}
|
||||||
|
|
||||||
--shader.scope;
|
--shader.scope;
|
||||||
shader.AddLine('}');
|
shader.AddLine('}');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user