1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d11] Improve per-context staging buffer handling

In D3D11, the staging buffer is only used for UpdateSubresource, which
isn't always used much. Reducing the size and freeing the buffer after
every submission avoids situations where system memory chunks are kept
alive by a single unused 4MB allocation.
This commit is contained in:
Philip Rebohle 2024-10-05 01:17:29 +02:00 committed by Philip Rebohle
parent c614e537a9
commit c27cae2f10
2 changed files with 7 additions and 1 deletions

View File

@ -72,7 +72,9 @@ namespace dxvk {
template<typename T> friend class D3D11DeviceContextExt;
template<typename T> friend class D3D11UserDefinedAnnotation;
constexpr static VkDeviceSize StagingBufferSize = 4ull << 20;
// Use a local staging buffer to handle tiny uploads, most
// of the time we're fine with hitting the global allocator
constexpr static VkDeviceSize StagingBufferSize = 256ull << 10;
public:
D3D11CommonContext(

View File

@ -992,6 +992,10 @@ namespace dxvk {
// Vulkan queue submission is performed.
if (synchronizeSubmission)
m_device->waitForSubmission(&m_submitStatus);
// Free local staging buffer so that we don't
// end up with a persistent allocation
ResetStagingBuffer();
}
}