diff --git a/src/Cafe/HW/Latte/Core/FetchShader.cpp b/src/Cafe/HW/Latte/Core/FetchShader.cpp index d50447b3..f7c627d5 100644 --- a/src/Cafe/HW/Latte/Core/FetchShader.cpp +++ b/src/Cafe/HW/Latte/Core/FetchShader.cpp @@ -75,7 +75,7 @@ uint32 LatteShaderRecompiler_getAttributeAlignment(LatteParsedFetchShaderAttribu return 4; } -void LatteShader_calculateFSKey(LatteFetchShader* fetchShader, uint32* contextRegister) +void LatteShader_calculateFSKey(LatteFetchShader* fetchShader) { uint64 key = 0; for (sint32 g = 0; g < fetchShader->bufferGroups.size(); g++) @@ -367,7 +367,7 @@ LatteFetchShader* LatteShaderRecompiler_createFetchShader(LatteFetchShader::Cach { // empty fetch shader, seen in Minecraft // these only make sense when vertex shader does not call FS? - LatteShader_calculateFSKey(newFetchShader, contextRegister); + LatteShader_calculateFSKey(newFetchShader); newFetchShader->CalculateFetchShaderVkHash(); newFetchShader->CheckIfVerticesNeedManualFetchMtl(contextRegister); return newFetchShader; @@ -427,7 +427,7 @@ LatteFetchShader* LatteShaderRecompiler_createFetchShader(LatteFetchShader::Cach } bufferGroup.vboStride = vboOffset; } - LatteShader_calculateFSKey(newFetchShader, contextRegister); + LatteShader_calculateFSKey(newFetchShader); newFetchShader->CalculateFetchShaderVkHash(); newFetchShader->CheckIfVerticesNeedManualFetchMtl(contextRegister); diff --git a/src/Cafe/HW/Latte/Core/LatteShader.cpp b/src/Cafe/HW/Latte/Core/LatteShader.cpp index d490c492..087643e4 100644 --- a/src/Cafe/HW/Latte/Core/LatteShader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShader.cpp @@ -650,17 +650,18 @@ uint64 LatteSHRC_CalcPSAuxHash(LatteDecompilerShader* pixelShader, uint32* conte auxHash += (uint64)dim; } - // Textures as render targets - for (uint32 i = 0; i < pixelShader->textureUnitListCount; i++) - { - uint8 t = pixelShader->textureUnitList[i]; - auxHash = std::rotl(auxHash, 11); - auxHash += (uint64)pixelShader->textureRenderTargetIndex[t]; - } - #if ENABLE_METAL if (g_renderer->GetType() == RendererAPI::Metal) { + // Textures as render targets + for (uint32 i = 0; i < pixelShader->textureUnitListCount; i++) + { + uint8 t = pixelShader->textureUnitList[i]; + auxHash = std::rotl(auxHash, 11); + auxHash += (uint64)pixelShader->textureRenderTargetIndex[t]; + } + + // Color buffers for (uint8 i = 0; i < LATTE_NUM_COLOR_TARGET; i++) { auto format = LatteMRT::GetColorBufferFormat(i, LatteGPUState.contextNew); @@ -669,6 +670,7 @@ uint64 LatteSHRC_CalcPSAuxHash(LatteDecompilerShader* pixelShader, uint32* conte auxHash += (uint64)dataType; } + // Depth buffer bool hasDepthBuffer = LatteMRT::GetActiveDepthBufferMask(LatteGPUState.contextNew); if (hasDepthBuffer) { diff --git a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp index fe0caed8..86db7ee7 100644 --- a/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp +++ b/src/Cafe/HW/Latte/LegacyShaderDecompiler/LatteDecompilerAnalyzer.cpp @@ -403,7 +403,8 @@ void LatteDecompiler_analyzeExport(LatteDecompilerShaderContext* shaderContext, } else if (cfInstruction->exportType == 0 && cfInstruction->exportArrayBase == 61) { - if (LatteMRT::GetActiveDepthBufferMask(*shaderContext->contextRegistersNew)) + // Only check for depth buffer mask on Metal, as its not in the PS hash on other backends + if (g_renderer->GetType() != RendererAPI::Metal || LatteMRT::GetActiveDepthBufferMask(*shaderContext->contextRegistersNew)) shader->depthMask = true; } else