From c22f57bc4ec4ab4d7d0d22d12831c34ff95cd485 Mon Sep 17 00:00:00 2001 From: MaranBr Date: Mon, 22 Jun 2026 17:04:52 +0200 Subject: [PATCH] [video_core] Improve StagingBufferPool stream allocation (#4101) This fixes (I really hope so) the random graphical corruption issue that can occur in Mario Kart 8 Deluxe and possibly other games as well. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4101 Reviewed-by: crueter Reviewed-by: Shinmegumi --- src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 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 633b202290..9637bace49 100644 --- a/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp +++ b/src/video_core/renderer_vulkan/vk_staging_buffer_pool.cpp @@ -28,7 +28,7 @@ using namespace Common::Literals; // Maximum potential alignment of a Vulkan buffer constexpr VkDeviceSize MAX_ALIGNMENT = 256; // Stream buffer size in bytes -constexpr VkDeviceSize MAX_STREAM_BUFFER_SIZE = 128_MiB; +constexpr VkDeviceSize MAX_STREAM_BUFFER_SIZE = 256_MiB; size_t GetStreamBufferSize(const Device& device) { if (!device.HasDebuggingToolAttached()) { @@ -46,13 +46,13 @@ size_t GetStreamBufferSize(const Device& device) { // If rebar is not supported, cut the max heap size to 40%. This will allow 2 captures to be // loaded at the same time in RenderDoc. If rebar is supported, this shouldn't be an issue // as the heap will be much larger. - if (size <= 256_MiB) { + if (size <= MAX_STREAM_BUFFER_SIZE) { size = size * 40 / 100; } } else { size = MAX_STREAM_BUFFER_SIZE; } - return (std::min)(Common::AlignUp(size, MAX_ALIGNMENT), MAX_STREAM_BUFFER_SIZE); + return Common::AlignUp(size, MAX_ALIGNMENT); } } // Anonymous namespace