diff --git a/src/d3d9/d3d9_common_buffer.cpp b/src/d3d9/d3d9_common_buffer.cpp index 1a2b25188..8d1423735 100644 --- a/src/d3d9/d3d9_common_buffer.cpp +++ b/src/d3d9/d3d9_common_buffer.cpp @@ -7,8 +7,9 @@ namespace dxvk { D3D9CommonBuffer::D3D9CommonBuffer( D3D9DeviceEx* pDevice, - const D3D9_BUFFER_DESC* pDesc) - : m_parent ( pDevice ), m_desc ( *pDesc ), m_mapMode(DetermineMapMode()) { + const D3D9_BUFFER_DESC* pDesc) + : m_parent ( pDevice ), m_desc ( *pDesc ), + m_mapMode(DetermineMapMode(pDevice->GetOptions())) { m_buffer = CreateBuffer(); if (m_mapMode == D3D9_COMMON_BUFFER_MAP_MODE_BUFFER) m_stagingBuffer = CreateStagingBuffer(); diff --git a/src/d3d9/d3d9_common_buffer.h b/src/d3d9/d3d9_common_buffer.h index 02e1f320e..a474437dd 100644 --- a/src/d3d9/d3d9_common_buffer.h +++ b/src/d3d9/d3d9_common_buffer.h @@ -88,8 +88,8 @@ namespace dxvk { /** * \brief Determine the mapping mode of the buffer, (ie. direct mapping or backed) */ - inline D3D9_COMMON_BUFFER_MAP_MODE DetermineMapMode() const { - return (m_desc.Pool == D3DPOOL_DEFAULT && (m_desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY))) + inline D3D9_COMMON_BUFFER_MAP_MODE DetermineMapMode(const D3D9Options* options) const { + return (m_desc.Pool == D3DPOOL_DEFAULT && (m_desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY)) && options->allowDirectBufferMapping) ? D3D9_COMMON_BUFFER_MAP_MODE_DIRECT : D3D9_COMMON_BUFFER_MAP_MODE_BUFFER; } diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp index 37085b0a6..dbf95a068 100644 --- a/src/d3d9/d3d9_options.cpp +++ b/src/d3d9/d3d9_options.cpp @@ -72,6 +72,7 @@ namespace dxvk { this->alphaTestWiggleRoom = config.getOption ("d3d9.alphaTestWiggleRoom", false); this->apitraceMode = config.getOption ("d3d9.apitraceMode", false); this->deviceLocalConstantBuffers = config.getOption ("d3d9.deviceLocalConstantBuffers", false); + this->allowDirectBufferMapping = config.getOption ("d3d9.allowDirectBufferMapping", true); // If we are not Nvidia, enable general hazards. this->generalHazards = adapter != nullptr diff --git a/src/d3d9/d3d9_options.h b/src/d3d9/d3d9_options.h index 3a0041741..dff9b24f2 100644 --- a/src/d3d9/d3d9_options.h +++ b/src/d3d9/d3d9_options.h @@ -156,6 +156,9 @@ namespace dxvk { /// Use device local memory for constant buffers. bool deviceLocalConstantBuffers; + + /// Disable direct buffer mapping + bool allowDirectBufferMapping; }; } \ No newline at end of file