Skip to content

RFC: Shader cache for vkd3d

Stefan Dösinger requested to merge stefan/vkd3d:cache into master

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.

Merge request reports

Loading