There are several articles where Epic discusses new PSO precaching that will finally eliminate first time shader compilation when a new object is rendered the first time. From the 5.2 patch notes:
DX12 PSO Precaching
A new PSO precaching mechanism was introduced as experimental in 5.1 to improve PSO hitching in DX12 titles. Improvements to this system in 5.2 include:
- We improved the performance and stability of the system. There were various corner cases which we needed to address.
- We now skip drawing objects if their PSOs aren’t ready yet. The system aims to have the PSO ready in time for drawing, but it will never be able to guarantee this. When it’s late, it is now possible to skip drawing the object instead of waiting for compilation to finish (and hitching).
- We reduced the number of PSOs to precache due to improved logic that omits ones which will never be used.
- We improved the old (manual) PSO cache system so that it can be used alongside precaching.
There appears to be absolutely zero documentation about this. It looks to be disabled by default. From looking around at console commands, I’m guessing it is enabled with r.PSOPrecaching 1, and the skipping of not ready PSOs with r.SkipDrawOnPSOPrecaching 1.
When enabling those in the editor, it instantly crashes:
Assertion failed: (*Found)->AddRef() >= 2 [File:D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12Pipelinestate.cpp] [Line: 511]
---Callstack---
UnrealEditor_D3D12RHI!FD3D12PipelineStateCacheBase::FindInLowLevelCache() [D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12Pipelinestate.cpp:511]
UnrealEditor_D3D12RHI!FD3D12PipelineStateCacheBase::FindInLoadedCache() [D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12Pipelinestate.cpp:720]
UnrealEditor_D3D12RHI!FD3D12DynamicRHI::RHICreateGraphicsPipelineState() [D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12State.cpp:586]
U
When enabling those in a packaged build, it runs a few seconds before crashing with a
<ErrorMessage>Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x000000000000e718</ErrorMessage>
---Callstack---
[0x8] nvwgf2umx!NVDEV_Thunk+0xb1942 0x3d3869f440 0x7ffa759a2b96
[0x9] nvwgf2umx!NVENCODEAPI_Thunk+0xdc256 0x3d3869f4c0 0x7ffa7599962e
[0xa] nvwgf2umx!NVENCODEAPI_Thunk+0xd2cee 0x3d3869f510 0x7ffa76e0898a
[0xb] nvwgf2umx!OpenAdapter10+0xe784a 0x3d3869f870 0x7ffa76de0a96
[0xc] nvwgf2umx!OpenAdapter10+0xbf956 0x3d3869f8a0 0x7ffa76e94426
[0xd] nvwgf2umx!OpenAdapter12+0x5276 0x3d3869f8f0 0x7ff95aeb4072
[0xe] D3D12Core!D3D12GetInterface+0x3215d2 0x3d3869f950 0x7ff7141acd0d
[0xf] TheBlackPool_Win64_Shipping!FD3D12StateCache::SetGraphicsPipelineState+0x39d 0x3d3869f990 0x7ff71415de38
Anyone using this functionality? Is there more than the 2 console commands I found that need to be used?