mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-10-20 17:58:59 +00:00
[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 <crueter@eden-emu.dev> Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
This commit is contained in:
@@ -28,7 +28,7 @@ using namespace Common::Literals;
|
|||||||
// Maximum potential alignment of a Vulkan buffer
|
// Maximum potential alignment of a Vulkan buffer
|
||||||
constexpr VkDeviceSize MAX_ALIGNMENT = 256;
|
constexpr VkDeviceSize MAX_ALIGNMENT = 256;
|
||||||
// Stream buffer size in bytes
|
// 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) {
|
size_t GetStreamBufferSize(const Device& device) {
|
||||||
if (!device.HasDebuggingToolAttached()) {
|
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
|
// 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
|
// loaded at the same time in RenderDoc. If rebar is supported, this shouldn't be an issue
|
||||||
// as the heap will be much larger.
|
// as the heap will be much larger.
|
||||||
if (size <= 256_MiB) {
|
if (size <= MAX_STREAM_BUFFER_SIZE) {
|
||||||
size = size * 40 / 100;
|
size = size * 40 / 100;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
size = MAX_STREAM_BUFFER_SIZE;
|
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
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user