From a688156591bfb8fec6637ef236f41163440f8044 Mon Sep 17 00:00:00 2001 From: WinterSnowfall Date: Wed, 3 Jan 2024 01:19:40 +0200 Subject: [PATCH] [d3d8] Remove managedBufferPlacement workaround --- src/d3d8/d3d8_d3d9_util.h | 22 ---------------------- src/d3d8/d3d8_device.cpp | 8 +++----- src/d3d8/d3d8_options.h | 9 --------- 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/src/d3d8/d3d8_d3d9_util.h b/src/d3d8/d3d8_d3d9_util.h index 4f800a18804..fdb43a3fb2d 100644 --- a/src/d3d8/d3d8_d3d9_util.h +++ b/src/d3d8/d3d8_d3d9_util.h @@ -13,28 +13,6 @@ namespace dxvk { - - // Remap certain vertex and index buffers to different pools. - inline std::pair ChooseBufferPool(DWORD Usage, D3DPOOL Pool8, UINT Length, const D3D8Options& options) { - - d3d9::D3DPOOL Pool = d3d9::D3DPOOL(Pool8); - - // TODO: Optimize carefully which buffers go in which pools. - // - WRITEONLY DYNAMIC buffers might get performance gains in DEFAULT if not misused - - // Remap DEFAULT pool vertex buffers to MANAGED. - // - This avoids direct buffer mapping which can cause apps to misbehave - // due to differences in the behavior of NOOVERWRITE that will - // make apps write over in-use buffers that they expect to wait for. - // - D3D9DeviceEx::LockBuffer will ignored DISCARD and NOOVERWRITE for us - if (Pool8 == D3DPOOL_DEFAULT && Length >= options.managedBufferPlacement) { - Pool = d3d9::D3DPOOL_MANAGED; - Usage &= ~D3DUSAGE_DYNAMIC; - } - - return {Usage, Pool}; - } - // (8<-9) D3DCAPSX: Writes to D3DCAPS8 from D3DCAPS9 inline void ConvertCaps8(const d3d9::D3DCAPS9& caps9, D3DCAPS8* pCaps8) { diff --git a/src/d3d8/d3d8_device.cpp b/src/d3d8/d3d8_device.cpp index c3ad1396558..39762544c77 100644 --- a/src/d3d8/d3d8_device.cpp +++ b/src/d3d8/d3d8_device.cpp @@ -363,8 +363,7 @@ namespace dxvk { Com pVertexBuffer9 = nullptr; - auto [usage, realPool] = ChooseBufferPool(Usage, Pool, Length, m_d3d8Options); - HRESULT res = GetD3D9()->CreateVertexBuffer(Length, usage, FVF, realPool, &pVertexBuffer9, NULL); + HRESULT res = GetD3D9()->CreateVertexBuffer(Length, Usage, FVF, d3d9::D3DPOOL(Pool), &pVertexBuffer9, NULL); if (!FAILED(res)) *ppVertexBuffer = ref(new D3D8VertexBuffer(this, std::move(pVertexBuffer9), Pool, Usage)); @@ -381,13 +380,12 @@ namespace dxvk { InitReturnPtr(ppIndexBuffer); Com pIndexBuffer9 = nullptr; - auto [usage, realPool] = ChooseBufferPool(Usage, Pool, Length, m_d3d8Options); - HRESULT res = GetD3D9()->CreateIndexBuffer(Length, usage, d3d9::D3DFORMAT(Format), realPool, &pIndexBuffer9, NULL); + HRESULT res = GetD3D9()->CreateIndexBuffer(Length, Usage, d3d9::D3DFORMAT(Format), d3d9::D3DPOOL(Pool), &pIndexBuffer9, NULL); if (!FAILED(res)) *ppIndexBuffer = ref(new D3D8IndexBuffer(this, std::move(pIndexBuffer9), Pool, Usage)); + return res; - } HRESULT STDMETHODCALLTYPE D3D8Device::CreateRenderTarget( diff --git a/src/d3d8/d3d8_options.h b/src/d3d8/d3d8_options.h index c2c454348f9..8193e2ae54e 100644 --- a/src/d3d8/d3d8_options.h +++ b/src/d3d8/d3d8_options.h @@ -7,13 +7,6 @@ namespace dxvk { struct D3D8Options { - /// Remap DEFAULT pool vertex and index buffers above this size to the MANAGED pool - /// to improve performance by avoiding waiting for games that frequently lock (large) buffers. - /// - /// This implicitly disables direct buffer mapping. Some applications may need this option - /// disabled for certain (smaller) buffers to keep from overwriting in-use buffer regions. - uint32_t managedBufferPlacement = 0; - /// Some games rely on undefined behavior by using undeclared vertex shader inputs. /// The simplest way to fix them is to simply modify their vertex shader decl. /// @@ -30,8 +23,6 @@ namespace dxvk { D3D8Options() {} D3D8Options(const Config& config) { - int32_t minManagedSize = config.getOption ("d3d8.managedBufferPlacement", managedBufferPlacement); - managedBufferPlacement = config.getOption ("d3d8.managedBufferPlacement", true) ? minManagedSize : UINT32_MAX; auto forceVsDeclStr = config.getOption("d3d8.forceVsDecl", ""); batching = config.getOption ("d3d8.batching", batching);