Skip to content

Commit

Permalink
[d3d11] Allocate DYNAMIC buffers on device-local host-visible memory
Browse files Browse the repository at this point in the history
Improves performance on AMD cards when GPU-bound.
~5% FPS increase in The Witcher 3.
  • Loading branch information
doitsujin committed May 29, 2018
1 parent a9eff13 commit c600b43
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/d3d11/d3d11_buffer.cpp
Expand Up @@ -130,7 +130,7 @@ namespace dxvk {
// Default constant buffers may get updated frequently, in which
// case mapping the buffer is faster than using update commands.
VkMemoryPropertyFlags memoryFlags = GetMemoryFlagsForUsage(pDesc->Usage);

if ((pDesc->Usage == D3D11_USAGE_DEFAULT) && (pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER)) {
info.stages |= VK_PIPELINE_STAGE_HOST_BIT;
info.access |= VK_ACCESS_HOST_WRITE_BIT;
Expand All @@ -139,6 +139,14 @@ namespace dxvk {
| VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
}

// AMD cards have a device-local, host-visible memory type where
// we can put dynamic resources that need fast access by the GPU
if ((pDesc->Usage == D3D11_USAGE_DYNAMIC) && (pDesc->BindFlags & (
D3D11_BIND_VERTEX_BUFFER | D3D11_BIND_INDEX_BUFFER |
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS |
D3D11_BIND_CONSTANT_BUFFER)))
memoryFlags |= VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;

return m_device->GetDXVKDevice()->createBuffer(info, memoryFlags);
}

Expand Down

0 comments on commit c600b43

Please sign in to comment.