Skip to content

Commit

Permalink
Latte: Fix shader compilation error when subroutines are used
Browse files Browse the repository at this point in the history
Fixes character colors in Tekken Tag Tournament 2
  • Loading branch information
Exzap committed Sep 14, 2023
1 parent b902aa2 commit 92ab87b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4037,8 +4037,8 @@ void LatteDecompiler_emitGLSLShader(LatteDecompilerShaderContext* shaderContext,
for (auto& subroutineInfo : shaderContext->list_subroutines)
{
sint32 subroutineMaxStackDepth = 0;
src->addFmt("bool activeMaskStackSub%04x[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 1);
src->addFmt("bool activeMaskStackCSub%04x[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 2);
src->addFmt("bool activeMaskStackSub{:04x}[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 1);
src->addFmt("bool activeMaskStackCSub{:04x}[{}];" _CRLF, subroutineInfo.cfAddr, subroutineMaxStackDepth + 2);
}
}
// helper variables for cube maps (todo: Only emit when used)
Expand Down
1 change: 1 addition & 0 deletions src/Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ void RendererShaderVk::CompileInternal(bool isRenderThread)
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_logDebug(LogType::Force, "GLSL source:\n{}", m_glslCode);
cemu_assert_debug(false);
FinishCompilation();
return;
Expand Down

0 comments on commit 92ab87b

Please sign in to comment.