mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 15:01:18 +12:00
fix: pipeline cache with mesh shaders
This commit is contained in:
parent
8f2385a690
commit
15eb6bb37f
3 changed files with 35 additions and 27 deletions
|
@ -43,19 +43,21 @@ MetalPipelineCache::~MetalPipelineCache()
|
|||
MTL::RenderPipelineState* MetalPipelineCache::GetRenderPipelineState(const LatteFetchShader* fetchShader, const LatteDecompilerShader* vertexShader, const LatteDecompilerShader* geometryShader, const LatteDecompilerShader* pixelShader, const MetalAttachmentsInfo& lastUsedAttachmentsInfo, const MetalAttachmentsInfo& activeAttachmentsInfo, const LatteContextRegister& lcr)
|
||||
{
|
||||
uint64 hash = CalculatePipelineHash(fetchShader, vertexShader, geometryShader, pixelShader, lastUsedAttachmentsInfo, activeAttachmentsInfo, lcr);
|
||||
auto& pipeline = m_pipelineCache[hash];
|
||||
if (pipeline)
|
||||
return pipeline;
|
||||
auto it = m_pipelineCache.find(hash);
|
||||
if (it != m_pipelineCache.end())
|
||||
return it->second;
|
||||
|
||||
MetalPipelineCompiler compiler(m_mtlr);
|
||||
bool fbosMatch;
|
||||
compiler.InitFromState(fetchShader, vertexShader, geometryShader, pixelShader, lastUsedAttachmentsInfo, activeAttachmentsInfo, lcr, fbosMatch);
|
||||
pipeline = compiler.Compile(false, true, true);
|
||||
MTL::RenderPipelineState* pipeline = compiler.Compile(false, true, true);
|
||||
|
||||
// If FBOs don't match, it wouldn't be possible to reconstruct the pipeline from the cache
|
||||
if (fbosMatch)
|
||||
AddCurrentStateToCache(hash);
|
||||
|
||||
m_pipelineCache.insert({hash, pipeline});
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
|
@ -355,6 +357,9 @@ void MetalPipelineCache::LoadPipelineFromCache(std::span<uint8> fileData)
|
|||
|
||||
MetalAttachmentsInfo attachmentsInfo(*lcr, pixelShader);
|
||||
|
||||
// TODO: this shouldn't probably be called directly
|
||||
LatteShader_UpdatePSInputs(lcr->GetRawView());
|
||||
|
||||
MTL::RenderPipelineState* pipeline = nullptr;
|
||||
// compile
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue