aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-11-01 01:53:54 -0500
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-11-01 01:53:54 -0500
commit9c8af5b2128884d0ef9644286d3ab08ee8e5df20 (patch)
tree381f3b8c0cd25b0017a40ca58b9c6e92d85c6dee /src/video_core/renderer_vulkan
parent37908985af9d080bc4795c16c8e49c7ef1d2a98b (diff)
vulkan: keep the stream buffer within a small iGPU heap
The stream buffer prefers device-local host-visible memory. On a Radeon 780M that is a 256 MiB heap with a 243 MiB budget, and the 256 MiB buffer alone kept it over budget for the whole session ("VMA heap 2: usage 256 MiB of budget 243 MiB"). On integrated GPUs whose device-local host-visible heap is no bigger than the stream buffer, use three quarters of the heap instead (192 MiB there). Radeon 780M, Mario Kart World title screen: heap 2 at 192 of 243 MiB, picture and frame rate unchanged.
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
index 7b6571d33d..95fa67c92a 100644
--- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
+++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp
@@ -41,6 +41,19 @@ constexpr VkDeviceSize MAX_STREAM_BUFFER_SIZE = 256_MiB;
size_t GetStreamBufferSize(const Device& device) {
if (!device.HasDebuggingToolAttached()) {
+ if (device.IsIntegrated()) {
+ // An integrated GPU's device-local host-visible heap can be no bigger than the stream
+ // buffer (Radeon 780M: 256 MiB, 243 MiB budget), which then sat over that budget.
+ // Leave a quarter of it free.
+ VkDeviceSize heap_size = 0;
+ ForEachDeviceLocalHostVisibleHeap(
+ device, [&heap_size](size_t, VkMemoryHeap& heap) {
+ heap_size = (std::max)(heap_size, heap.size);
+ });
+ if (heap_size != 0 && heap_size <= MAX_STREAM_BUFFER_SIZE) {
+ return Common::AlignUp(heap_size * 3 / 4, MAX_ALIGNMENT);
+ }
+ }
return MAX_STREAM_BUFFER_SIZE;
}