mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 07:05:40 +12:00
HW shaders: Fix loops
This commit is contained in:
parent
e3252ec4ef
commit
872a6bacca
1 changed files with 7 additions and 3 deletions
|
@ -694,10 +694,10 @@ void ShaderDecompiler::compileInstruction(u32& pc, bool& finished) {
|
||||||
const u32 uniformIndex = getBits<22, 2>(instruction);
|
const u32 uniformIndex = getBits<22, 2>(instruction);
|
||||||
|
|
||||||
// loop counter = uniform.y
|
// loop counter = uniform.y
|
||||||
decompiledShader += fmt::format("addr_reg.z = int((uniform_int[{}] >> 16u) & 0xFFu);\n", uniformIndex);
|
decompiledShader += fmt::format("addr_reg.z = int((uniform_int[{}] >> 8u) & 0xFFu);\n", uniformIndex);
|
||||||
decompiledShader += fmt::format(
|
decompiledShader += fmt::format(
|
||||||
"for (uint loopCtr{} = 0u; loopCtr{} <= ((uniform_int[{}] >> 24) & 0xFFu); loopCtr{}++, addr_reg.z += int((uniform_int[{}] >> "
|
"for (uint loopCtr{} = 0u; loopCtr{} <= ((uniform_int[{}] >> 0) & 0xFFu); loopCtr{}++, addr_reg.z += int((uniform_int[{}] >> "
|
||||||
"8u) & 0xFFu)) {{\n",
|
"16u) & 0xFFu)) {{\n",
|
||||||
pc, pc, uniformIndex, pc, uniformIndex
|
pc, pc, uniformIndex, pc, uniformIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -706,6 +706,10 @@ void ShaderDecompiler::compileInstruction(u32& pc, bool& finished) {
|
||||||
callFunction(*func);
|
callFunction(*func);
|
||||||
decompiledShader += "}\n";
|
decompiledShader += "}\n";
|
||||||
|
|
||||||
|
// Jump to the end of the loop. We don't want to compile the code inside the loop again.
|
||||||
|
// This will be incremented by 1 due to the pc++ at the end of this loop.
|
||||||
|
pc = dest;
|
||||||
|
|
||||||
if (func->exitMode == ExitMode::AlwaysEnd) {
|
if (func->exitMode == ExitMode::AlwaysEnd) {
|
||||||
finished = true;
|
finished = true;
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue