Hello Tim,
After my changes were merged and widely tested, we found additional issues with the bundled PSO cache:
- On Windows there is a random crash when precompiling PSO in ShaderCodeArchive.cpp#L2381 with “I/O Error (Not Found)”. It happens both with my workaround and with bDoNotChunkPSOCache=False, so I assume it’s another PSO Cache + DLC bug that was previously hidden by the bundled cache not being compiled properly.
- In my task I also enabled PSO Cache masking for Android with OpenGL and it seems that it doesn’t work when r.PSOPrecaching is disabled. There is a crash in OpenGLProgramBinaryFileCache.cpp#L535 that happens right on app startup when SetGameUsageMaskWithComparison is called because it triggers FShaderPipelineCache::OnCachedOpened for the same cache. My guess is that it could be fixed by an early return when CurrentShaderPipelineProperties.CacheVersionGuid == InVersionGuid, but I’m not sure whether such a situation can occur with two different caches, in which case this fix would not help.
For the first point, could you please share any ideas on how such a crash might happen? As I understand it, the problem is that at the moment of compiling a specific PSO from the bundled cache, a required shader is missing, even though there is a check for missing shaders when PSO precompile tasks are scheduled. This suggests that either the checks at the moment of scheduling or at the moment of compilation are giving incorrect results, or that the shader was available initially but was somehow deleted or moved between those two stages.
For the second point, I can either apply the fix I mentioned or simply disable PSO Cache masking for Android OpenGL when r.PSOPrecaching is disabled. So it’s not that critical, but I still wanted to let you know.
The callstacks:
1.
UE::Logging::Private::BasicFatalLog (StructuredLog.cpp:1104)
FIoRequest::GetResultOrDie (IoDispatcher.cpp:1232)
FIoStoreShaderCodeArchive::CreateShader (ShaderCodeArchive.cpp:2381)
FShaderLibraryInstance::GetOrCreateShader (ShaderCodeLibrary.cpp:1188)
FShaderLibrariesCollection::CreateShader (ShaderCodeLibrary.cpp:3234)
FShaderCodeLibrary::CreateVertexShader (ShaderCodeLibrary.cpp:3944)
FShaderPipelineCacheTask::Precompile (ShaderPipelineCache.cpp:1052)
FShaderPipelineCacheTask::PrecompilePipelineBatch (ShaderPipelineCache.cpp:1515)
FShaderPipelineCacheTask::Tick (ShaderPipelineCache.cpp:1913)
FShaderPipelineCache::Tick (ShaderPipelineCache.cpp:1883)
TickRenderingTickables (RenderingThread.cpp:200)
2.
FOpenGLProgramBinaryCache::OnShaderPipelineCacheOpened (OpenGLProgramBinaryFileCache.cpp:535)
Invoke<T> (Invoke.h:66)
UE::Core::Private::Tuple::TTupleBase<T>::ApplyAfter<T> (Tuple.h:317)
TBaseRawMethodDelegateInstance<T>::ExecuteIfSafe (DelegateInstancesImpl.h:533)
TMulticastDelegateBase<T>::Broadcast<T> (MulticastDelegateBase.h:258)
TMulticastDelegate<T>::Broadcast (DelegateSignatureImpl.inl:1079)
FShaderPipelineCacheTask::BeginPrecompilingPipelineCache (ShaderPipelineCache.cpp:2147)
FShaderPipelineCache::BeginNextPrecompileCacheTaskInternal (ShaderPipelineCache.cpp:1778)
FShaderPipelineCache::BeginNextPrecompileCacheTask (ShaderPipelineCache.cpp:1709)
FShaderPipelineCache::ApplyNewUsageMaskToAllTasks (ShaderPipelineCache.cpp:734)
FShaderPipelineCache::SetGameUsageMaskWithComparison (ShaderPipelineCache.cpp:690)
UPSOCacheHelpers::SetPSOCacheUsageMask (PSOCacheHelpers.cpp:152)
UPSOCacheServiceImpl::UpdatePSOCacheState (PSOCacheServiceImpl.cpp:80)
UPSOCacheServiceImpl::InitDependencies (PSOCacheServiceImpl.cpp:33)
Also, regarding the sample project, we can’t provide it at the moment as we’re currently focused on getting the bundled PSO cache working for the upcoming release.
[Attachment Removed]