diff --git a/README.md b/README.md index 52c46773..461f05b1 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,10 @@ commas or semicolons. - `dxr` - Enables DXR support if supported by device. - `force_static_cbv` - Unsafe speed hack on NVIDIA. May or may not give a significant performance uplift. - `single_queue` - Do not use asynchronous compute or transfer queues. - - `upload_hvv` - Attempt to use host-visible VRAM (large/resizable BAR) for the UPLOAD heap. May improve performance at the cost of using additional video memory over system memory. + - `no_upload_hvv` - Blocks any attempt to use host-visible VRAM (large/resizable BAR) for the UPLOAD heap. + May free up vital VRAM in certain critical situations, at cost of lower GPU performance. + A fraction of VRAM is reserved for resizable BAR allocations either way, + so it should not be a real issue even on lower VRAM cards. - `VKD3D_DEBUG` - controls the debug level for log messages produced by vkd3d-proton. Accepts the following values: none, err, info, fixme, warn, trace. - `VKD3D_SHADER_DEBUG` - controls the debug level for log messages produced by diff --git a/include/vkd3d.h b/include/vkd3d.h index c9fc0a1f..6c94955e 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -70,7 +70,7 @@ enum vkd3d_config_flags VKD3D_CONFIG_FLAG_FORCE_RTV_EXCLUSIVE_QUEUE = 0x00000080, VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE = 0x00000100, VKD3D_CONFIG_FLAG_FORCE_MINIMUM_SUBGROUP_SIZE = 0x00000200, - VKD3D_CONFIG_FLAG_UPLOAD_HVV = 0x00000400, + VKD3D_CONFIG_FLAG_NO_UPLOAD_HVV = 0x00000400, VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET = 0x00000800, }; diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 20d41fc2..fc8fe0be 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -500,7 +500,7 @@ static const struct vkd3d_debug_option vkd3d_config_options[] = {"force_rtv_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_RTV_EXCLUSIVE_QUEUE}, {"force_dsv_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE}, {"force_exclusive_queue", VKD3D_CONFIG_FLAG_FORCE_RTV_EXCLUSIVE_QUEUE | VKD3D_CONFIG_FLAG_FORCE_DSV_EXCLUSIVE_QUEUE}, - {"upload_hvv", VKD3D_CONFIG_FLAG_UPLOAD_HVV}, + {"no_upload_hvv", VKD3D_CONFIG_FLAG_NO_UPLOAD_HVV}, {"log_memory_budget", VKD3D_CONFIG_FLAG_LOG_MEMORY_BUDGET}, }; diff --git a/libs/vkd3d/memory.c b/libs/vkd3d/memory.c index 361b97e1..ae41c1f4 100644 --- a/libs/vkd3d/memory.c +++ b/libs/vkd3d/memory.c @@ -74,7 +74,7 @@ static HRESULT vkd3d_select_memory_flags(struct d3d12_device *device, const D3D1 case D3D12_HEAP_TYPE_UPLOAD: *type_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; - if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_UPLOAD_HVV) + if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_NO_UPLOAD_HVV)) *type_flags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; break; diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 4d781280..461fd225 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -5295,7 +5295,7 @@ static HRESULT d3d12_descriptor_heap_init_data_buffer(struct d3d12_descriptor_he return hr; property_flags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; - if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_UPLOAD_HVV) + if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_NO_UPLOAD_HVV)) property_flags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; if (FAILED(hr = vkd3d_allocate_buffer_memory(device, descriptor_heap->vk_buffer, @@ -5949,7 +5949,7 @@ static uint32_t vkd3d_memory_info_find_global_mask(const struct vkd3d_memory_top uint32_t heap_index; uint32_t i, mask; - if (vkd3d_config_flags & VKD3D_CONFIG_FLAG_UPLOAD_HVV) + if (!(vkd3d_config_flags & VKD3D_CONFIG_FLAG_NO_UPLOAD_HVV)) return UINT32_MAX; /* If we only have one device local heap, or no host-only heaps, there is nothing to do. */