[d3d9] Add option to disable direct buffer mapping

This commit is contained in:
Robin Kertels 2022-01-26 17:25:24 +01:00 committed by Joshie
parent 6d71eea516
commit cf4c5c3422
4 changed files with 9 additions and 4 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -72,6 +72,7 @@ namespace dxvk {
this->alphaTestWiggleRoom = config.getOption<bool> ("d3d9.alphaTestWiggleRoom", false);
this->apitraceMode = config.getOption<bool> ("d3d9.apitraceMode", false);
this->deviceLocalConstantBuffers = config.getOption<bool> ("d3d9.deviceLocalConstantBuffers", false);
this->allowDirectBufferMapping = config.getOption<bool> ("d3d9.allowDirectBufferMapping", true);
// If we are not Nvidia, enable general hazards.
this->generalHazards = adapter != nullptr

View File

@ -156,6 +156,9 @@ namespace dxvk {
/// Use device local memory for constant buffers.
bool deviceLocalConstantBuffers;
/// Disable direct buffer mapping
bool allowDirectBufferMapping;
};
}