From 7e1b0ef8e6523e956c0a3622ea7561d5556b6388 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 1 May 2019 00:35:04 +0200 Subject: [PATCH] [dxvk] Bump state cache format to version 4 Accomodates for the alpha test changes in D3D11. --- src/dxvk/dxvk_state_cache.cpp | 20 ++++++++++++++++---- src/dxvk/dxvk_state_cache.h | 5 ++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/dxvk/dxvk_state_cache.cpp b/src/dxvk/dxvk_state_cache.cpp index 4f1ac4c45..3a8d70730 100644 --- a/src/dxvk/dxvk_state_cache.cpp +++ b/src/dxvk/dxvk_state_cache.cpp @@ -289,8 +289,8 @@ namespace dxvk { } // Discard caches of unsupported versions - if (curHeader.version != 2 && curHeader.version != 3) { - Logger::warn("DXVK: State cache out of date"); + if (curHeader.version < 2 || curHeader.version > newHeader.version) { + Logger::warn("DXVK: State cache version not supported"); return false; } @@ -307,8 +307,10 @@ namespace dxvk { DxvkStateCacheEntry entry; if (readCacheEntry(ifile, entry)) { - if (curHeader.version == 2) - convertEntryV2(entry); + switch (curHeader.version) { + case 2: convertEntryV2(entry); /* fall through */ + case 3: convertEntryV3(entry); /* fall through */ + } size_t entryId = m_entries.size(); m_entries.push_back(entry); @@ -404,6 +406,16 @@ namespace dxvk { } + bool DxvkStateCache::convertEntryV3( + DxvkStateCacheEntry& entry) const { + // Semantics changed: + // v3: Unused, always set to 0 + // v4: Alpha test compare op + entry.gpState.xsAlphaCompareOp = VK_COMPARE_OP_ALWAYS; + return true; + } + + void DxvkStateCache::workerFunc() { env::setThreadName("dxvk-shader"); diff --git a/src/dxvk/dxvk_state_cache.h b/src/dxvk/dxvk_state_cache.h index 3ae54b3ed..c0fee1661 100644 --- a/src/dxvk/dxvk_state_cache.h +++ b/src/dxvk/dxvk_state_cache.h @@ -62,7 +62,7 @@ namespace dxvk { */ struct DxvkStateCacheHeader { char magic[4] = { 'D', 'X', 'V', 'K' }; - uint32_t version = 3; + uint32_t version = 4; uint32_t entrySize = sizeof(DxvkStateCacheEntry); }; @@ -213,6 +213,9 @@ namespace dxvk { bool convertEntryV2( DxvkStateCacheEntry& entry) const; + bool convertEntryV3( + DxvkStateCacheEntry& entry) const; + void workerFunc(); void writerFunc();