mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d11] Fix stage and access mask for default constant buffers
This commit is contained in:
parent
ac1d505d14
commit
9cec1ecca3
@ -127,24 +127,19 @@ namespace dxvk {
|
||||
info.access |= VK_ACCESS_INDIRECT_COMMAND_READ_BIT;
|
||||
}
|
||||
|
||||
return m_device->GetDXVKDevice()->createBuffer(
|
||||
info, GetMemoryFlags(pDesc));
|
||||
}
|
||||
// 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;
|
||||
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -83,9 +83,6 @@ namespace dxvk {
|
||||
Rc<DxvkBuffer> CreateBuffer(
|
||||
const D3D11_BUFFER_DESC* pDesc) const;
|
||||
|
||||
VkMemoryPropertyFlags GetMemoryFlags(
|
||||
const D3D11_BUFFER_DESC* pDesc) const;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user