In order to speed up startup times in release builds, I'd like to implement a shader cache system not too dissimilar to the one used in Dolphin pre-uber shader.
This system would minimally need to detect changes made to the shader via checksum of the HLSL source code and invalidate if checksums differ.
My initial idea for implementation is:
Store HLSL source code checksum (calculated at runtime for rapid prototyping) in a file--say version.bin--in a shader cache subfolder.
If no such version.bin exists, compile shaders as usual. Otherwise, compare the checksums. If they differ, invalidate the cache by deleting the entire folder.
Assuming the cache has not already been invalidated, the shader cache loading process would be something along the lines of:
Check if a file exists for the desired uber shader flags.
If it does, load it. Otherwise, compile that shader and write the binary blob to that currently non-existent file path.
In order to speed up startup times in release builds, I'd like to implement a shader cache system not too dissimilar to the one used in Dolphin pre-uber shader.
This system would minimally need to detect changes made to the shader via checksum of the HLSL source code and invalidate if checksums differ.
My initial idea for implementation is:
version.bin
--in a shader cache subfolder.version.bin
exists, compile shaders as usual. Otherwise, compare the checksums. If they differ, invalidate the cache by deleting the entire folder.Assuming the cache has not already been invalidated, the shader cache loading process would be something along the lines of: