diff --git a/src/d3d9/d3d9_common_buffer.cpp b/src/d3d9/d3d9_common_buffer.cpp index 509f0cbf..1a2b2518 100644 --- a/src/d3d9/d3d9_common_buffer.cpp +++ b/src/d3d9/d3d9_common_buffer.cpp @@ -8,9 +8,9 @@ namespace dxvk { D3D9CommonBuffer::D3D9CommonBuffer( D3D9DeviceEx* pDevice, const D3D9_BUFFER_DESC* pDesc) - : m_parent ( pDevice ), m_desc ( *pDesc ) { + : m_parent ( pDevice ), m_desc ( *pDesc ), m_mapMode(DetermineMapMode()) { m_buffer = CreateBuffer(); - if (GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER) + if (m_mapMode == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER) m_stagingBuffer = CreateStagingBuffer(); m_sliceHandle = GetMapBuffer()->getSliceHandle(); @@ -83,7 +83,7 @@ namespace dxvk { info.access |= VK_ACCESS_INDEX_READ_BIT; } - if (GetMapMode() == D3D9_COMMON_BUFFER_MAP_MODE_DIRECT) { + if (m_mapMode == D3D9_COMMON_BUFFER_MAP_MODE_DIRECT) { info.stages |= VK_PIPELINE_STAGE_HOST_BIT; info.access |= VK_ACCESS_HOST_WRITE_BIT; diff --git a/src/d3d9/d3d9_common_buffer.h b/src/d3d9/d3d9_common_buffer.h index 043731e3..02e1f320 100644 --- a/src/d3d9/d3d9_common_buffer.h +++ b/src/d3d9/d3d9_common_buffer.h @@ -88,12 +88,19 @@ namespace dxvk { /** * \brief Determine the mapping mode of the buffer, (ie. direct mapping or backed) */ - inline D3D9_COMMON_BUFFER_MAP_MODE GetMapMode() const { + inline D3D9_COMMON_BUFFER_MAP_MODE DetermineMapMode() const { return (m_desc.Pool == D3DPOOL_DEFAULT && (m_desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY))) ? D3D9_COMMON_BUFFER_MAP_MODE_DIRECT : D3D9_COMMON_BUFFER_MAP_MODE_BUFFER; } + /** + * \brief Get the mapping mode of the buffer, (ie. direct mapping or backed) + */ + inline D3D9_COMMON_BUFFER_MAP_MODE GetMapMode() const { + return m_mapMode; + } + /** * \brief Abstraction for getting a type of buffer (mapping/staging/the real buffer) across mapping modes. */ @@ -231,6 +238,7 @@ namespace dxvk { DWORD m_mapFlags; bool m_wasWrittenByGPU = false; bool m_uploadUsingStaging = false; + D3D9_COMMON_BUFFER_MAP_MODE m_mapMode; Rc m_buffer; Rc m_stagingBuffer;