diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 176fe1f7f..87d066077 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -127,24 +127,19 @@ namespace dxvk { info.access |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT; } - return m_device->GetDXVKDevice()->createBuffer( - info, GetMemoryFlags(pDesc)); - } - - - VkMemoryPropertyFlags D3D11Buffer::GetMemoryFlags( - const D3D11_BUFFER_DESC* pDesc) const { - // Default constant buffers may get updated frequently with calls - // to D3D11DeviceContext::UpdateSubresource, so we'll map them to - // host memory in order to allow direct access to the buffer - if ((pDesc->Usage == D3D11_USAGE_DEFAULT) - && (pDesc->BindFlags & D3D11_BIND_CONSTANT_BUFFER)) { - return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT - | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; + // 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; + + memoryFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT + | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; } - // Use default memory flags for the intended use - return GetMemoryFlagsForUsage(pDesc->Usage); + return m_device->GetDXVKDevice()->createBuffer(info, memoryFlags); } } diff --git a/src/d3d11/d3d11_buffer.h b/src/d3d11/d3d11_buffer.h index c13067ca5..90bad1ca2 100644 --- a/src/d3d11/d3d11_buffer.h +++ b/src/d3d11/d3d11_buffer.h @@ -83,9 +83,6 @@ namespace dxvk { Rc CreateBuffer( const D3D11_BUFFER_DESC* pDesc) const; - VkMemoryPropertyFlags GetMemoryFlags( - const D3D11_BUFFER_DESC* pDesc) const; - }; }