diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 02:41:57 -0500 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-11-01 12:23:13 -0500 |
| commit | 1f0e3b88c4f82e61a6296eea9ee371eaf45676d4 (patch) | |
| tree | 902c306540f2cc2824e9bd35a258500d711ded46 /src/video_core/vulkan_common/vulkan_device.cpp | |
| parent | 50fb1556cb005aa4dfaed57b4f8c07f2bb56e23c (diff) | |
vulkan: keep sparse pages and device-local buffers out of the image blocks
About half of the holes in the default blocks sat next to buffers (~1,100,
churned by the buffer cache's collector) or sparse pages (~2,400 64 KiB-4
MiB allocations), which the texture cache's collector can't move. Each gets
a VMA pool of its own per memory type (32 MiB blocks); allocations over half
a block, or ones the pool fails, take the default blocks.
(cherry picked from commit 6c5ad324bd79ec50601ae14a63ca745da612f61f)
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_device.cpp')
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 728005cacf..bcf1743e11 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -807,9 +807,37 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR Device::~Device() { SaveStaticPipelineCache(); ShutdownGPULogging(); + for (auto& pools : separate_pools) { + for (VmaPool pool : pools) { + if (pool != VK_NULL_HANDLE) { + vmaDestroyPool(allocator, pool); + } + } + } vmaDestroyAllocator(allocator); } +VmaPool Device::GetSeparatePool(SeparatePool kind, u32 memory_type) const { + std::scoped_lock lk{separate_pools_mutex}; + VmaPool& pool = separate_pools[static_cast<u32>(kind)][memory_type]; + if (pool == VK_NULL_HANDLE) { + const VmaPoolCreateInfo ci{ + .memoryTypeIndex = memory_type, + .flags = 0, + .blockSize = SeparatePoolBlockSize, + .minBlockCount = 0, + .maxBlockCount = 0, + .priority = 0.f, + .minAllocationAlignment = 0, + .pMemoryAllocateNext = nullptr, + }; + if (vmaCreatePool(allocator, &ci, &pool) != VK_SUCCESS) { + pool = VK_NULL_HANDLE; + } + } + return pool; +} + void Device::LoadStaticPipelineCache() { const auto create = [this](size_t size, const void* data) { static_pipeline_cache = logical.CreatePipelineCache({ |
