From 5a1ebfa4ee014ca896adebeb0244ad357ed449c0 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Tue, 20 Jun 2023 22:26:42 +0200 Subject: [PATCH] Revert "[d3d9] Only use direct buffer mapping for DYNAMIC buffers" This reverts commit 1850819483a1a5e061da18c8bfd615988af3b316. --- src/d3d9/d3d9_common_buffer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/d3d9/d3d9_common_buffer.cpp b/src/d3d9/d3d9_common_buffer.cpp index ba5d1988..e40a799b 100644 --- a/src/d3d9/d3d9_common_buffer.cpp +++ b/src/d3d9/d3d9_common_buffer.cpp @@ -67,7 +67,11 @@ namespace dxvk { if (m_desc.Pool != D3DPOOL_DEFAULT) return D3D9_COMMON_BUFFER_MAP_MODE_BUFFER; - if (!(m_desc.Usage & D3DUSAGE_DYNAMIC)) + // CSGO keeps vertex buffers locked across multiple frames and writes to it. It uses them for drawing without unlocking first. + // Tests show that D3D9 DEFAULT + USAGE_DYNAMIC behaves like a directly mapped buffer even when unlocked. + // DEFAULT + WRITEONLY does not behave like a directly mapped buffer EXCEPT if its locked at the moment. + // That's annoying to implement so we just always directly map DEFAULT + WRITEONLY. + if (!(m_desc.Usage & (D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY))) return D3D9_COMMON_BUFFER_MAP_MODE_BUFFER; // Tests show that DISCARD does not work for pure SWVP devices.