diff --git a/rpcs3/Emu/RSX/Common/ring_buffer_helper.h b/rpcs3/Emu/RSX/Common/ring_buffer_helper.h index 9da7abca70..cd72277d0f 100644 --- a/rpcs3/Emu/RSX/Common/ring_buffer_helper.h +++ b/rpcs3/Emu/RSX/Common/ring_buffer_helper.h @@ -116,7 +116,7 @@ public: return (m_put_pos > 0) ? m_put_pos - 1 : m_size - 1; } - bool is_critical() const + virtual bool is_critical() const { const size_t guard_length = std::max(m_min_guard_size, m_largest_allocated_pool); return (m_current_allocated_size + guard_length) >= m_size; diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.h b/rpcs3/Emu/RSX/VK/VKHelpers.h index 341e806c13..c479b4e115 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.h +++ b/rpcs3/Emu/RSX/VK/VKHelpers.h @@ -3394,6 +3394,7 @@ public: class data_heap : public ::data_heap { private: + size_t initial_size = 0; bool mapped = false; void *_ptr = nullptr; @@ -3431,6 +3432,7 @@ public: } heap = std::make_unique(*device, size, memory_index, memory_flags, usage, 0); + initial_size = size; } void destroy() @@ -3497,6 +3499,20 @@ public: VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT); } } + + bool is_critical() const override + { + if (!::data_heap::is_critical()) + return false; + + // By default, allow the size to grow upto 8x larger + // This value is arbitrary, theoretically it is possible to allow infinite stretching to improve performance + const size_t soft_limit = initial_size * 8; + if ((m_size + m_min_guard_size) < soft_limit) + return false; + + return true; + } }; struct blitter