From c5bef60dbb3d7867bfb8340a307f01f9c6c9d2a8 Mon Sep 17 00:00:00 2001 From: Samuliak Date: Tue, 19 Nov 2024 18:27:02 +0100 Subject: [PATCH] save pipeline even if compilation failed --- .../Renderer/Metal/MetalPipelineCache.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCache.cpp b/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCache.cpp index dcd957c8..1c69b531 100644 --- a/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCache.cpp +++ b/src/Cafe/HW/Latte/Renderer/Metal/MetalPipelineCache.cpp @@ -416,7 +416,7 @@ void MetalPipelineCache::LoadPipelineFromCache(std::span fileData) vertexShader = LatteSHRC_FindVertexShader(cachedPipeline->vsHash.baseHash, cachedPipeline->vsHash.auxHash); if (!vertexShader) { - cemuLog_logDebug(LogType::Force, "Vertex shader not found in cache"); + cemuLog_log(LogType::Force, "Vertex shader not found in cache"); return; } } @@ -426,7 +426,7 @@ void MetalPipelineCache::LoadPipelineFromCache(std::span fileData) geometryShader = LatteSHRC_FindGeometryShader(cachedPipeline->gsHash.baseHash, cachedPipeline->gsHash.auxHash); if (!geometryShader) { - cemuLog_logDebug(LogType::Force, "Geometry shader not found in cache"); + cemuLog_log(LogType::Force, "Geometry shader not found in cache"); return; } } @@ -436,7 +436,7 @@ void MetalPipelineCache::LoadPipelineFromCache(std::span fileData) pixelShader = LatteSHRC_FindPixelShader(cachedPipeline->psHash.baseHash, cachedPipeline->psHash.auxHash); if (!pixelShader) { - cemuLog_logDebug(LogType::Force, "Pixel shader not found in cache"); + cemuLog_log(LogType::Force, "Pixel shader not found in cache"); return; } } @@ -459,14 +459,11 @@ void MetalPipelineCache::LoadPipelineFromCache(std::span fileData) // destroy pp early } - // on success, cache the pipeline - if (pipelineObject->m_pipeline) - { - uint64 pipelineStateHash = CalculatePipelineHash(vertexShader->compatibleFetchShader, vertexShader, geometryShader, pixelShader, cachedPipeline->lastUsedAttachmentsInfo, attachmentsInfo, *lcr); - m_pipelineCacheLock.lock(); - m_pipelineCache[pipelineStateHash] = pipelineObject; - m_pipelineCacheLock.unlock(); - } + // Cache the pipeline + uint64 pipelineStateHash = CalculatePipelineHash(vertexShader->compatibleFetchShader, vertexShader, geometryShader, pixelShader, cachedPipeline->lastUsedAttachmentsInfo, attachmentsInfo, *lcr); + m_pipelineCacheLock.lock(); + m_pipelineCache[pipelineStateHash] = pipelineObject; + m_pipelineCacheLock.unlock(); // clean up s_spinlockSharedInternal.lock();