Latte: Fix shader compilation error when subroutines are used

Fixes character colors in Tekken Tag Tournament 2
This commit is contained in:
Exzap 2023-09-11 18:20:37 +02:00
parent b902aa2048
commit 92ab87b049
2 changed files with 3 additions and 2 deletions

View File

@ -4037,8 +4037,8 @@ void LatteDecompiler_emitGLSLShader(LatteDecompilerShaderContext* shaderContext,
for (auto& subroutineInfo : shaderContext->list_subroutines) for (auto& subroutineInfo : shaderContext->list_subroutines)
{ {
sint32 subroutineMaxStackDepth = 0; sint32 subroutineMaxStackDepth = 0;
src->addFmt("bool activeMaskStackSub%04x[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 1); src->addFmt("bool activeMaskStackSub{:04x}[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 1);
src->addFmt("bool activeMaskStackCSub%04x[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 2); src->addFmt("bool activeMaskStackCSub{:04x}[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 2);
} }
} }
// helper variables for cube maps (todo: Only emit when used) // helper variables for cube maps (todo: Only emit when used)

View File

@ -335,6 +335,7 @@ void RendererShaderVk::CompileInternal(bool isRenderThread)
if (!Shader.parse(&Resources, 100, false, messagesParseLink)) if (!Shader.parse(&Resources, 100, false, messagesParseLink))
{ {
cemuLog_log(LogType::Force, fmt::format("GLSL parsing failed for {:016x}_{:016x}: \"{}\"", m_baseHash, m_auxHash, Shader.getInfoLog())); cemuLog_log(LogType::Force, fmt::format("GLSL parsing failed for {:016x}_{:016x}: \"{}\"", m_baseHash, m_auxHash, Shader.getInfoLog()));
cemuLog_logDebug(LogType::Force, "GLSL source:\n{}", m_glslCode);
cemu_assert_debug(false); cemu_assert_debug(false);
FinishCompilation(); FinishCompilation();
return; return;