vk: Rework multi-heap health checks for performance

This commit is contained in:
kd-11 2025-04-17 17:14:50 +03:00 committed by kd-11
parent e136c2eadf
commit 88e2a3761c
4 changed files with 15 additions and 17 deletions

View file

@ -1141,12 +1141,8 @@ void VKGSRender::end()
m_frame_stats.textures_upload_time += m_profiler.duration();
// Final heap check...
check_heap_status(
{
std::ref(m_attrib_ring_info),
std::ref(m_index_buffer_ring_info),
std::ref(m_draw_indirect_count_ring_info)
});
vk::data_heap* vertex_storage_heaps[] = { &m_attrib_ring_info, &m_index_buffer_ring_info, &m_draw_indirect_count_ring_info };
check_heap_status(vertex_storage_heaps);
u32 sub_index = 0; // RSX subdraw ID
m_current_draw.subdraw_id = 0; // Host subdraw ID. Invalid RSX subdraws do not increment this value

View file

@ -1150,24 +1150,26 @@ void VKGSRender::notify_tile_unbound(u32 tile)
bool VKGSRender::check_heap_status(const vk::data_heap& heap)
{
if (heap.heap && heap.is_critical())
if (!heap.heap || !heap.is_critical()) [[ likely ]]
{
handle_heap_critical();
return true;
return false;
}
return false;
handle_heap_critical();
return true;
}
bool VKGSRender::check_heap_status(std::initializer_list<std::reference_wrapper<vk::data_heap>> heaps)
bool VKGSRender::check_heap_status(const std::span<vk::data_heap*>& heaps)
{
for (const vk::data_heap& heap : heaps)
for (const auto& heap : heaps)
{
if (heap.heap && heap.is_critical())
if (!heap->heap || !heap->is_critical()) [[ likely ]]
{
handle_heap_critical();
return true;
continue;
}
handle_heap_critical();
return true;
}
return false;

View file

@ -221,7 +221,7 @@ private:
void handle_heap_critical();
bool check_heap_status(const vk::data_heap& heap);
bool check_heap_status(std::initializer_list<std::reference_wrapper<vk::data_heap>> heaps);
bool check_heap_status(const std::span<vk::data_heap*>& heaps);
void check_present_status();
VkDescriptorSet allocate_descriptor_set();

View file

@ -8,7 +8,7 @@
namespace vk
{
render_device* get_current_renderer();
const render_device* get_current_renderer();
void init()
{