Here is a preview of my shader cache work for early comments. It isn't complete, but does successfully cache things.
What's there:
* A new vkd3d API that is used internally for caching, can be used to implement the ID3D12ShaderCacheSession interface and hopefully be used by wined3d as well
* Simple saving and loading of the cached objects
* It is used to cache render passes, root signatures and pipeline states
What is not yet there
* Partial cache loading and eviction
* ID3D12ShaderCacheSession - largely because it needs bumping ID3D12Device up to version 9, which may bring unrelated regressions. For this and tests see my "cache-rework" branch (which
* Cache file compression
* Incremental updates of cache files - right now they are rewritten from scratch on exit
* Loading the cache in an extra thread. The pipeline state creation code will need some refactor for that
I am not quite happy yet with the two patches that write and reload actual graphics pipelines. The way I am storing the d3d settings aren't quite consistent yet either - in some cases I use the d3d input data as key directly, in others I store them as values attached to a hash value. The latter is usually the case if I need to cross-reference something, e.g. have a link from the pipeline state to the root signature. This kind of setup shows how wined3d can build a chain of linked state though.
There are also known issues with locking, explained in comments in the patches.
--
v3: DEBUG: Make cache profiling more visible
Revert "simple benchmark"
simple benchmark
tests: Add tests for ID3D12ShaderCacheSession.
vkd3d: Implement ID3D12ShaderCacheSession::SetDeleteOnDestroy.
vkd3d: Implement ID3D12ShaderCacheSession on top of vkd3d_shader_cache.
vkd3d: Add a stub ID3D12ShaderCacheSession implementation.
vkd3d: Stub device methods up to D3D12Device9.
vkd3d: Load cached pipelines in a separate thread.
vkd3d: Try to find a read-only cache in C:\windows\scache
vkd3d: Remove the custom render pass lock.
vkd3d: Cache and preload compute pipelines.
vkd3d: Add some cache efficiency debug code.
vkd3d: Add EXT_pipeline_creation_feedback.
vkd3d: Catch and release graphics pipelines.
vkd3d: Store graphics pipelines in the cache.
vkd3d: Precreate root signatures from cache
vkd3d: Keep root signatures around.
vkd3d: Store render passes in the on-disk cache and recreate them on startup.
vkd3d: Store the VK pipeline cache in an on-disk vkd3d cache.
vkd3d: Keep the application name around.
vkd3d: Add a win32 version of vkd3d_get_program_name.
vkd3d: Basic shader cache writing and reading.
vkd3d: Replace the custom render pass cache with vkd3d_shader_cache.
vkd3d: Implement vkd3d_shader_cache_enumerate.
vkd3d: Add cache locking.
vkd3d: Implement vkd3d_shader_cache_get.
vkd3d: Implement vkd3d_shader_cache_put.
vkd3d: Create and destroy the shader cache tree.
vkd3d: Implement shader_cache_open/close.
vkd3d: Define and stub the shader cache API.
This merge request has too many patches to be relayed via email.
Please visit the URL below to see the contents of the merge request.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/541
~~This applies on top of !711, the last three commits belong here.~~
This MR and the following ones will introduce a number of optimization passes on the structured representation of the shader, with the goal of fixing the idiosyncrasies of the code generated by the new structurizer. The general pattern is that we want to recognize when the combination of loops and jumps can be rather written with selection constructs. Ideally that should bring to removing all the synthesized loop intervals, but that cannot be guaranteed in general. We still want to do remove all the loops we can, first to make the generated code easier to read and to recompile, and second because having fewer loops also means that more multilevel jumps become ordinary single level jumps, which do not require overhead to be represented in SPIR-V.
--
v4: vkd3d-shader/ir: Synthesize selection constructs from conditional jumps.
vkd3d-shader/ir: Remove trailing `continue's.
vkd3d-shader/ir: Move `continue's to the false branch when possible.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/722