diff --git a/src/d3d11/d3d11_buffer.cpp b/src/d3d11/d3d11_buffer.cpp index 687be0a5..9b1ee35a 100644 --- a/src/d3d11/d3d11_buffer.cpp +++ b/src/d3d11/d3d11_buffer.cpp @@ -74,6 +74,8 @@ namespace dxvk { m_buffer = m_parent->GetDXVKDevice()->createBuffer(info, GetMemoryFlags()); m_mapped = m_buffer->getSliceHandle(); + m_mapMode = DetermineMapMode(); + // For Stream Output buffers we need a counter if (pDesc->BindFlags & D3D11_BIND_STREAM_OUTPUT) m_soCounter = CreateSoCounterBuffer(); @@ -273,6 +275,13 @@ namespace dxvk { | VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT; return device->createBuffer(info, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); } + + + D3D11_COMMON_BUFFER_MAP_MODE D3D11Buffer::DetermineMapMode() { + return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) + ? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT + : D3D11_COMMON_BUFFER_MAP_MODE_NONE; + } D3D11Buffer* GetCommonBuffer(ID3D11Resource* pResource) { diff --git a/src/d3d11/d3d11_buffer.h b/src/d3d11/d3d11_buffer.h index 3ddd61a0..8bb30aef 100644 --- a/src/d3d11/d3d11_buffer.h +++ b/src/d3d11/d3d11_buffer.h @@ -67,9 +67,7 @@ namespace dxvk { } D3D11_COMMON_BUFFER_MAP_MODE GetMapMode() const { - return (m_buffer->memFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) - ? D3D11_COMMON_BUFFER_MAP_MODE_DIRECT - : D3D11_COMMON_BUFFER_MAP_MODE_NONE; + return m_mapMode; } Rc GetBuffer() const { @@ -130,14 +128,15 @@ namespace dxvk { private: - const D3D11_BUFFER_DESC m_desc; + D3D11_BUFFER_DESC m_desc; + D3D11_COMMON_BUFFER_MAP_MODE m_mapMode; - Rc m_buffer; - Rc m_soCounter; - DxvkBufferSliceHandle m_mapped; + Rc m_buffer; + Rc m_soCounter; + DxvkBufferSliceHandle m_mapped; - D3D11DXGIResource m_resource; - D3D10Buffer m_d3d10; + D3D11DXGIResource m_resource; + D3D10Buffer m_d3d10; BOOL CheckFormatFeatureSupport( VkFormat Format, @@ -147,6 +146,8 @@ namespace dxvk { Rc CreateSoCounterBuffer(); + D3D11_COMMON_BUFFER_MAP_MODE DetermineMapMode(); + };