vkd3d: Narrow workaround for global pipeline cache.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-09-08 18:22:13 +02:00
parent 11086a94e0
commit 0e216b2b10
1 changed files with 12 additions and 5 deletions

View File

@ -2475,13 +2475,20 @@ static HRESULT d3d12_device_global_pipeline_cache_init(struct d3d12_device *devi
* This means that using a VkPipelineCache per PSO will explode system memory usage, leading to OOM. * This means that using a VkPipelineCache per PSO will explode system memory usage, leading to OOM.
* To counteract this, we use one global pipeline cache instead, but this means we lose the ability to * To counteract this, we use one global pipeline cache instead, but this means we lose the ability to
* serialize and unserialize PSO state. Instead, we can just serialize garbage and ignore unserialization. * serialize and unserialize PSO state. Instead, we can just serialize garbage and ignore unserialization.
* From a correctness PoV, this is perfectly fine, and cached PSOs should be present in disk cache either way. */ * From a correctness PoV, this is perfectly fine, and cached PSOs should be present in disk cache either way.
bool use_global; * The bug was introduced in 470 series, but was fixed as of 470.62.02 driver.
uint32_t major; * 470.63.01 mainline one was released before 62.02, so it is also included in workaround list. */
bool use_global = false;
VkResult vr; VkResult vr;
major = VK_VERSION_MAJOR(device->device_info.properties2.properties.driverVersion); if (device->device_info.properties2.properties.vendorID == VKD3D_VENDOR_ID_NVIDIA)
use_global = device->device_info.properties2.properties.vendorID == VKD3D_VENDOR_ID_NVIDIA && major >= 470; {
uint32_t driver_version = device->device_info.properties2.properties.driverVersion;
use_global = (driver_version >= VKD3D_DRIVER_VERSION_MAKE_NV(470, 0, 0) &&
driver_version < VKD3D_DRIVER_VERSION_MAKE_NV(470, 62, 2)) ||
driver_version == VKD3D_DRIVER_VERSION_MAKE_NV(470, 63, 1);
}
if (!use_global) if (!use_global)
return S_OK; return S_OK;