mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-02 13:01:18 +12:00
latte: isolate Metal-specific hashes
This commit is contained in:
parent
4ec2638395
commit
feba1aa7ba
3 changed files with 15 additions and 12 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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<uint64>(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<uint64>(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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue