Latte: Add support for LOOP_START_NO_AL shader instruction

This instruction is used by Injustice: Gods Among Us and Project Zero

Also improved robustness of rendering to be less prone to crashing when a game tries to draw with broken shaders
This commit is contained in:
Exzap 2024-03-27 16:01:44 +01:00
parent 60adc38205
commit fa8bab2f39
6 changed files with 16 additions and 10 deletions

View file

@ -441,7 +441,8 @@ void LatteDecompiler_analyzeSubroutine(LatteDecompilerShaderContext* shaderConte
{
shaderContext->analyzer.modifiesPixelActiveState = true;
}
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END)
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{
shaderContext->analyzer.modifiesPixelActiveState = true;
}
@ -685,7 +686,8 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD
{
shaderContext->analyzer.modifiesPixelActiveState = true;
}
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END)
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{
shaderContext->analyzer.modifiesPixelActiveState = true;
shaderContext->analyzer.hasLoops = true;
@ -929,7 +931,8 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD
if (cfCurrentStackDepth < 0)
debugBreakpoint();
}
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END)
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{
// no effect on stack depth
cfInstruction.activeStackDepth = cfCurrentStackDepth;