diff options
| author | kraibse <33869366+kraibse@users.noreply.github.com> | 2026-11-01 15:38:05 +0100 |
|---|---|---|
| committer | kraibse <33869366+kraibse@users.noreply.github.com> | 2026-11-02 00:11:26 +0100 |
| commit | 51d798ff0373a40098aa77ef13d54307f39e44ac (patch) | |
| tree | c8e4d3a76786ef7958a0cd35061f1b8b0d7148d3 /src/video_core/renderer_vulkan | |
| parent | 518712cc5d2c81503ff5ccaf90ed6e43a512577d (diff) | |
texture_cache: keep the allocator's block slack out of the usable VRAM
The collector's usage leaves out the unused part of VMA's blocks, but
the driver counts it and a heap at its budget cannot give it to a new
image. On an RX 7800 XT that slack was 1.06 GiB, the whole 1 GiB margin:
the heap sat at its budget for a minute while the collector saw room,
then images stopped fitting and the process died. Reserve the slack
(capped at 1.5 GiB) on top of the margin: at once when it grows, slowly
when it shrinks, so eviction leaving partly used blocks doesn't chase
the threshold down.
Assisted-by: Claude Sonnet 5.5 (diagnosis and code)
(cherry picked from commit 73fd5a489ea28226fa16a55f5008e622d631b54c)
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 09e7961ff9..cb0453c178 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -2082,6 +2082,10 @@ u64 TextureCacheRuntime::GetDeviceMemoryBudget() const { return device.GetDeviceMemoryBudget(); } +u64 TextureCacheRuntime::GetDeviceMemorySlack() const { + return device.GetDeviceMemorySlack(); +} + bool TextureCacheRuntime::CanDownloadMsaa(const VideoCommon::ImageInfo& info) const { const VkImageAspectFlags aspect_mask = ImageAspectMask(info.format); if ((aspect_mask & VK_IMAGE_ASPECT_COLOR_BIT) != 0) { diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 5ac833e787..d5f8756486 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -74,6 +74,8 @@ public: u64 GetDeviceMemoryBudget() const; + u64 GetDeviceMemorySlack() const; + bool CanReportMemoryUsage() const; /// Images that did not fit the device memory budget so far (see MemoryAllocator). |
