1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[d3d9] Cleanup buffer memory flag selection

This commit is contained in:
Robin Kertels 2024-09-19 00:01:30 +02:00 committed by Philip Rebohle
parent 5bb8d09a96
commit 033104f335

View File

@ -111,12 +111,20 @@ namespace dxvk {
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
info.access |= VK_ACCESS_HOST_WRITE_BIT;
if (!(m_desc.Usage & D3DUSAGE_WRITEONLY))
info.access |= VK_ACCESS_HOST_READ_BIT;
memoryFlags |= VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
| VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if ((m_desc.Usage & (D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC)) == 0
|| DoPerDrawUpload()
|| m_parent->CanOnlySWVP()
|| m_parent->GetOptions()->cachedDynamicBuffers) {
// Never use uncached memory on devices that support SWVP because we might end up reading from it.
info.access |= VK_ACCESS_HOST_READ_BIT;
memoryFlags |= VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
} else {
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
}
else {
info.stages |= VK_PIPELINE_STAGE_TRANSFER_BIT;
@ -126,13 +134,6 @@ namespace dxvk {
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
}
if ((memoryFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && (m_parent->GetOptions()->cachedDynamicBuffers || m_parent->CanOnlySWVP())) {
// Never use uncached memory on devices that support SWVP because we might end up reading from it.
memoryFlags &= ~VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
memoryFlags |= VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT;
}
return m_parent->GetDXVKDevice()->createBuffer(info, memoryFlags);
}