mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-01 21:44:17 +01:00
only add pipeline to cache if compilation was attempted
This commit is contained in:
parent
15eb6bb37f
commit
295a6ed9fd
@ -50,13 +50,16 @@ MTL::RenderPipelineState* MetalPipelineCache::GetRenderPipelineState(const Latte
|
|||||||
MetalPipelineCompiler compiler(m_mtlr);
|
MetalPipelineCompiler compiler(m_mtlr);
|
||||||
bool fbosMatch;
|
bool fbosMatch;
|
||||||
compiler.InitFromState(fetchShader, vertexShader, geometryShader, pixelShader, lastUsedAttachmentsInfo, activeAttachmentsInfo, lcr, fbosMatch);
|
compiler.InitFromState(fetchShader, vertexShader, geometryShader, pixelShader, lastUsedAttachmentsInfo, activeAttachmentsInfo, lcr, fbosMatch);
|
||||||
MTL::RenderPipelineState* pipeline = compiler.Compile(false, true, true);
|
bool attemptedCompilation = false;
|
||||||
|
MTL::RenderPipelineState* pipeline = compiler.Compile(false, true, true, attemptedCompilation);
|
||||||
|
|
||||||
// If FBOs don't match, it wouldn't be possible to reconstruct the pipeline from the cache
|
// If FBOs don't match, it wouldn't be possible to reconstruct the pipeline from the cache
|
||||||
if (fbosMatch)
|
if (fbosMatch)
|
||||||
AddCurrentStateToCache(hash);
|
AddCurrentStateToCache(hash);
|
||||||
|
|
||||||
m_pipelineCache.insert({hash, pipeline});
|
// Place the pipeline to the cache if the compilation was at least attempted
|
||||||
|
if (attemptedCompilation)
|
||||||
|
m_pipelineCache.insert({hash, pipeline});
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
@ -374,7 +377,9 @@ void MetalPipelineCache::LoadPipelineFromCache(std::span<uint8> fileData)
|
|||||||
// s_spinlockSharedInternal.unlock();
|
// s_spinlockSharedInternal.unlock();
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
pipeline = pp.Compile(true, true, false);
|
bool attemptedCompilation = false;
|
||||||
|
pipeline = pp.Compile(true, true, false, attemptedCompilation);
|
||||||
|
cemu_assert_debug(attemptedCompilation);
|
||||||
// destroy pp early
|
// destroy pp early
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ void MetalPipelineCompiler::InitFromState(const LatteFetchShader* fetchShader, c
|
|||||||
InitFromStateRender(fetchShader, vertexShader, lastUsedAttachmentsInfo, activeAttachmentsInfo, lcr, fbosMatch);
|
InitFromStateRender(fetchShader, vertexShader, lastUsedAttachmentsInfo, activeAttachmentsInfo, lcr, fbosMatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
MTL::RenderPipelineState* MetalPipelineCompiler::Compile(bool forceCompile, bool isRenderThread, bool showInOverlay)
|
MTL::RenderPipelineState* MetalPipelineCompiler::Compile(bool forceCompile, bool isRenderThread, bool showInOverlay, bool& attemptedCompilation)
|
||||||
{
|
{
|
||||||
if (forceCompile)
|
if (forceCompile)
|
||||||
{
|
{
|
||||||
@ -408,6 +408,9 @@ MTL::RenderPipelineState* MetalPipelineCompiler::Compile(bool forceCompile, bool
|
|||||||
g_compiling_pipelines++;
|
g_compiling_pipelines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inform the pipeline cache that compilation was at least attempted
|
||||||
|
attemptedCompilation = true;
|
||||||
|
|
||||||
return pipeline;
|
return pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public:
|
|||||||
|
|
||||||
void InitFromState(const LatteFetchShader* fetchShader, const LatteDecompilerShader* vertexShader, const LatteDecompilerShader* geometryShader, const LatteDecompilerShader* pixelShader, const class MetalAttachmentsInfo& lastUsedAttachmentsInfo, const class MetalAttachmentsInfo& activeAttachmentsInfo, const LatteContextRegister& lcr, bool& fbosMatch);
|
void InitFromState(const LatteFetchShader* fetchShader, const LatteDecompilerShader* vertexShader, const LatteDecompilerShader* geometryShader, const LatteDecompilerShader* pixelShader, const class MetalAttachmentsInfo& lastUsedAttachmentsInfo, const class MetalAttachmentsInfo& activeAttachmentsInfo, const LatteContextRegister& lcr, bool& fbosMatch);
|
||||||
|
|
||||||
MTL::RenderPipelineState* Compile(bool forceCompile, bool isRenderThread, bool showInOverlay);
|
MTL::RenderPipelineState* Compile(bool forceCompile, bool isRenderThread, bool showInOverlay, bool& attemptedCompilation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MetalRenderer* m_mtlr;
|
class MetalRenderer* m_mtlr;
|
||||||
|
Loading…
Reference in New Issue
Block a user