Skip to content

Commit

Permalink
[dxvk] Allow resetting the state cache using the DXVK_STATE_CACHE env…
Browse files Browse the repository at this point in the history
… var
  • Loading branch information
doitsujin committed Jul 20, 2022
1 parent 75d0b1a commit 16eae7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ Some applications do not provide a method to select a different GPU. In that cas
DXVK caches pipeline state by default, so that shaders can be recompiled ahead of time on subsequent runs of an application, even if the driver's own shader cache got invalidated in the meantime. This cache is enabled by default, and generally reduces stuttering.

The following environment variables can be used to control the cache:
- `DXVK_STATE_CACHE=0` Disables the state cache.
- `DXVK_STATE_CACHE`: Controls the state cache. The following values are supported:
- `disable`: Disables the cache entirely.
- `reset`: Clears the cache file.
- `DXVK_STATE_CACHE_PATH=/some/directory` Specifies a directory where to put the cache files. Defaults to the current working directory of the application.

### Debugging
Expand Down
5 changes: 3 additions & 2 deletions src/dxvk/dxvk_state_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,13 @@ namespace dxvk {
m_pipeManager (pipeManager),
m_pipeWorkers (pipeWorkers) {
std::string useStateCache = env::getEnvVar("DXVK_STATE_CACHE");
m_enable = useStateCache != "0" && device->config().enableStateCache;
m_enable = useStateCache != "0" && useStateCache != "disable" &&
device->config().enableStateCache;

if (!m_enable)
return;

bool newFile = !readCacheFile();
bool newFile = (useStateCache == "reset") || (!readCacheFile());

if (newFile) {
Logger::warn("DXVK: Creating new state cache file");
Expand Down

0 comments on commit 16eae7a

Please sign in to comment.