[d3d9] Add option to use device local memory for constant buffers

Useful for testing performance.
This commit is contained in:
Joshua Ashton 2021-02-27 19:29:52 +00:00
parent eec4481ca0
commit 50d223e614
No known key found for this signature in database
GPG Key ID: C85A08669126BE8D
4 changed files with 20 additions and 0 deletions

View File

@ -342,3 +342,15 @@
# - True/False
# d3d9.alphaTestWiggleRoom = False
# Device Local Constant Buffers
#
# Enables using device local, host accessible memory for constant buffers in D3D9.
# This tends to actually be slower for some reason on AMD,
# and the exact same performance on NVIDIA.
#
# Supported values:
# - True/False
# d3d9.deviceLocalConstantBuffers = False

View File

@ -4627,6 +4627,9 @@ namespace dxvk {
VkMemoryPropertyFlags memoryFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (m_d3d9Options.deviceLocalConstantBuffers)
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
Rc<DxvkBuffer> buffer = m_dxvkDevice->createBuffer(info, memoryFlags);
const uint32_t slotId = computeResourceSlotId(

View File

@ -75,6 +75,8 @@ namespace dxvk {
this->apitraceMode = config.getOption<bool>("d3d9.apitraceMode", false);
this->deviceLocalConstantBuffers = config.getOption<bool>("d3d9.deviceLocalConstantBuffers", false);
// If we are not Nvidia, enable general hazards.
this->generalHazards = adapter == nullptr || !adapter->matchesDriver(DxvkGpuVendor::Nvidia, VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR, 0, 0);
applyTristate(this->generalHazards, config.getOption<Tristate>("d3d9.generalHazards", Tristate::Auto));

View File

@ -154,6 +154,9 @@ namespace dxvk {
/// Apitrace mode: Maps all buffers in cached memory.
bool apitraceMode;
/// Use device local memory for constant buffers.
bool deviceLocalConstantBuffers;
};
}