forked from ShuriZma/suyu
1
0
Fork 0

Shader_Ir: Fix TLD4S from using a component mask.

TLD4S always outputs 4 values, the previous code checked a component 
mask and omitted those values that weren't part of it. This commit 
corrects that and makes sure all 4 values are set.
This commit is contained in:
Fernando Sahmkow 2019-10-22 10:59:07 -04:00
parent 1572fb9bf2
commit 1509d2ffbd
2 changed files with 5 additions and 5 deletions

View File

@ -150,7 +150,7 @@ u32 ShaderIR::DecodeTexture(NodeBlock& bb, u32 pc) {
values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy)); values[element] = Operation(OperationCode::TextureGather, meta, std::move(coords_copy));
} }
WriteTexsInstructionFloat(bb, instr, values); WriteTexsInstructionFloat(bb, instr, values, true);
break; break;
} }
case OpCode::Id::TXQ_B: case OpCode::Id::TXQ_B:
@ -344,14 +344,14 @@ void ShaderIR::WriteTexInstructionFloat(NodeBlock& bb, Instruction instr, const
} }
} }
void ShaderIR::WriteTexsInstructionFloat(NodeBlock& bb, Instruction instr, void ShaderIR::WriteTexsInstructionFloat(NodeBlock& bb, Instruction instr, const Node4& components,
const Node4& components) { bool ignore_mask) {
// TEXS has two destination registers and a swizzle. The first two elements in the swizzle // TEXS has two destination registers and a swizzle. The first two elements in the swizzle
// go into gpr0+0 and gpr0+1, and the rest goes into gpr28+0 and gpr28+1 // go into gpr0+0 and gpr0+1, and the rest goes into gpr28+0 and gpr28+1
u32 dest_elem = 0; u32 dest_elem = 0;
for (u32 component = 0; component < 4; ++component) { for (u32 component = 0; component < 4; ++component) {
if (!instr.texs.IsComponentEnabled(component)) if (!instr.texs.IsComponentEnabled(component) && !ignore_mask)
continue; continue;
SetTemporary(bb, dest_elem++, components[component]); SetTemporary(bb, dest_elem++, components[component]);
} }

View File

@ -322,7 +322,7 @@ private:
const Node4& components); const Node4& components);
void WriteTexsInstructionFloat(NodeBlock& bb, Tegra::Shader::Instruction instr, void WriteTexsInstructionFloat(NodeBlock& bb, Tegra::Shader::Instruction instr,
const Node4& components); const Node4& components, bool ignore_mask = false);
void WriteTexsInstructionHalfFloat(NodeBlock& bb, Tegra::Shader::Instruction instr, void WriteTexsInstructionHalfFloat(NodeBlock& bb, Tegra::Shader::Instruction instr,
const Node4& components); const Node4& components);