Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement pipeline data cache for OpenGL and D3D12 #7999
Based on bug reports, it seems that some drivers (Intel and AMD) may not have their own disk cache for D3D12 pipelines. This was resulting in shader compilation occurring every time the emulator was booted.
This PR implements a pipeline data cache. "Cache data" can be used to assist a driver with creating pipelines by using previously-compiled shader ISA. Note that the pipeline data cache does not replace the UID cache, there is no guarantee that the cache data will be accepted by the driver.
I also extended this to OpenGL, using program binaries as the payload. This means for Android devices which don't have a disk cache, it will speed up game booting. Synchronous ubershader stuttering in D3D12 could also be improved, as the ubershader variants will be cached.
If any pipelines fail to create from the cache data, the entire cache is thrown out, and rebuilt from the UID cache. This means that driver updates won't cause duplicate entries in the cache :)
With "Compile shaders before starting" enabled and after initial shader compilation:
D3D12 takes longer to start up than D3D11 on Windows 10.
OGL takes significantly longer to start up than Vulkan on Android.
Is there anything that can be done about the slowness vs. other backends?
That is expected. DX11 has no pipeline compilation and this work can be deferred to the driver thread.
GL being slow on Android is probably just qcom's driver. It's the same on NV on desktop, the Vulkan compiler is faster, it's just not as noticeable. You shouldn't see shader compilation on every boot anymore, however.