mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
vk: Use garbage collector to handle buffer views
- Legacy stuff left over from almost a decade ago
This commit is contained in:
parent
a0ce9e52fa
commit
8ce8410a5b
5 changed files with 13 additions and 23 deletions
|
@ -837,7 +837,7 @@ void VKGSRender::emit_geometry(u32 sub_index)
|
|||
if (m_vertex_layout_storage &&
|
||||
m_vertex_layout_storage->info.buffer != m_vertex_layout_ring_info.heap->value)
|
||||
{
|
||||
m_current_frame->buffer_views_to_clean.push_back(std::move(m_vertex_layout_storage));
|
||||
vk::get_gc()->dispose(m_vertex_layout_storage);
|
||||
}
|
||||
|
||||
vk::clear_status_interrupt(vk::heap_changed);
|
||||
|
|
|
@ -834,19 +834,14 @@ VKGSRender::~VKGSRender()
|
|||
{
|
||||
// Return resources back to the owner
|
||||
m_current_frame = &frame_context_storage[m_current_queue_index];
|
||||
m_current_frame->swap_storage(m_aux_frame_context);
|
||||
m_current_frame->grab_resources(m_aux_frame_context);
|
||||
}
|
||||
|
||||
m_aux_frame_context.buffer_views_to_clean.clear();
|
||||
|
||||
// NOTE: aux_context uses descriptor pools borrowed from the main queues and any allocations will be automatically freed when pool is destroyed
|
||||
for (auto &ctx : frame_context_storage)
|
||||
{
|
||||
vkDestroySemaphore((*m_device), ctx.present_wait_semaphore, nullptr);
|
||||
vkDestroySemaphore((*m_device), ctx.acquire_signal_semaphore, nullptr);
|
||||
|
||||
ctx.buffer_views_to_clean.clear();
|
||||
}
|
||||
|
||||
// Textures
|
||||
|
@ -2291,7 +2286,9 @@ void VKGSRender::update_vertex_env(u32 id, const vk::vertex_upload_info& vertex_
|
|||
ensure(m_texbuffer_view_size >= m_vertex_layout_stream_info.range);
|
||||
|
||||
if (m_vertex_layout_storage)
|
||||
m_current_frame->buffer_views_to_clean.push_back(std::move(m_vertex_layout_storage));
|
||||
{
|
||||
vk::get_gc()->dispose(m_vertex_layout_storage);
|
||||
}
|
||||
|
||||
const usz alloc_addr = m_vertex_layout_stream_info.offset;
|
||||
const usz view_size = (alloc_addr + m_texbuffer_view_size) > m_vertex_layout_ring_info.size() ? m_vertex_layout_ring_info.size() - alloc_addr : m_texbuffer_view_size;
|
||||
|
|
|
@ -182,8 +182,6 @@ namespace vk
|
|||
|
||||
rsx::flags32_t flags = 0;
|
||||
|
||||
std::vector<std::unique_ptr<vk::buffer_view>> buffer_views_to_clean;
|
||||
|
||||
u32 present_image = -1;
|
||||
command_buffer_chunk* swap_command_buffer = nullptr;
|
||||
|
||||
|
@ -197,16 +195,9 @@ namespace vk
|
|||
acquire_signal_semaphore = other.acquire_signal_semaphore;
|
||||
descriptor_set.swap(other.descriptor_set);
|
||||
flags = other.flags;
|
||||
|
||||
heap_snapshot = other.heap_snapshot;
|
||||
}
|
||||
|
||||
// Exchange storage (non-copyable)
|
||||
void swap_storage(frame_context_t& other)
|
||||
{
|
||||
std::swap(buffer_views_to_clean, other.buffer_views_to_clean);
|
||||
}
|
||||
|
||||
void tag_frame_end()
|
||||
{
|
||||
heap_snapshot = data_heap_manager::get_heap_snapshot();
|
||||
|
@ -216,6 +207,7 @@ namespace vk
|
|||
void reset_heap_ptrs()
|
||||
{
|
||||
last_frame_sync_time = 0;
|
||||
heap_snapshot.clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -232,8 +232,6 @@ void VKGSRender::frame_context_cleanup(vk::frame_context_t *ctx)
|
|||
|
||||
vk::reset_global_resources();
|
||||
|
||||
ctx->buffer_views_to_clean.clear();
|
||||
|
||||
if (ctx->last_frame_sync_time > m_last_heap_sync_time)
|
||||
{
|
||||
m_last_heap_sync_time = ctx->last_frame_sync_time;
|
||||
|
@ -408,7 +406,6 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
|||
}
|
||||
|
||||
// Swap aux storage and current frame; aux storage should always be ready for use at all times
|
||||
m_current_frame->swap_storage(m_aux_frame_context);
|
||||
m_current_frame->grab_resources(m_aux_frame_context);
|
||||
}
|
||||
else if (m_current_frame->swap_command_buffer)
|
||||
|
|
|
@ -320,13 +320,13 @@ vk::vertex_upload_info VKGSRender::upload_vertex_data()
|
|||
if (m_persistent_attribute_storage &&
|
||||
m_persistent_attribute_storage->info.buffer != m_attrib_ring_info.heap->value)
|
||||
{
|
||||
m_current_frame->buffer_views_to_clean.push_back(std::move(m_persistent_attribute_storage));
|
||||
vk::get_gc()->dispose(m_persistent_attribute_storage);
|
||||
}
|
||||
|
||||
if (m_volatile_attribute_storage &&
|
||||
m_volatile_attribute_storage->info.buffer != m_attrib_ring_info.heap->value)
|
||||
{
|
||||
m_current_frame->buffer_views_to_clean.push_back(std::move(m_volatile_attribute_storage));
|
||||
vk::get_gc()->dispose(m_volatile_attribute_storage);
|
||||
}
|
||||
|
||||
vk::clear_status_interrupt(vk::heap_changed);
|
||||
|
@ -339,7 +339,9 @@ vk::vertex_upload_info VKGSRender::upload_vertex_data()
|
|||
ensure(m_texbuffer_view_size >= required.first); // "Incompatible driver (MacOS?)"
|
||||
|
||||
if (m_persistent_attribute_storage)
|
||||
m_current_frame->buffer_views_to_clean.push_back(std::move(m_persistent_attribute_storage));
|
||||
{
|
||||
vk::get_gc()->dispose(m_persistent_attribute_storage);
|
||||
}
|
||||
|
||||
//View 64M blocks at a time (different drivers will only allow a fixed viewable heap size, 64M should be safe)
|
||||
const usz view_size = (persistent_range_base + m_texbuffer_view_size) > m_attrib_ring_info.size() ? m_attrib_ring_info.size() - persistent_range_base : m_texbuffer_view_size;
|
||||
|
@ -355,7 +357,9 @@ vk::vertex_upload_info VKGSRender::upload_vertex_data()
|
|||
ensure(m_texbuffer_view_size >= required.second); // "Incompatible driver (MacOS?)"
|
||||
|
||||
if (m_volatile_attribute_storage)
|
||||
m_current_frame->buffer_views_to_clean.push_back(std::move(m_volatile_attribute_storage));
|
||||
{
|
||||
vk::get_gc()->dispose(m_persistent_attribute_storage);
|
||||
}
|
||||
|
||||
const usz view_size = (volatile_range_base + m_texbuffer_view_size) > m_attrib_ring_info.size() ? m_attrib_ring_info.size() - volatile_range_base : m_texbuffer_view_size;
|
||||
m_volatile_attribute_storage = std::make_unique<vk::buffer_view>(*m_device, m_attrib_ring_info.heap->value, VK_FORMAT_R8_UINT, volatile_range_base, view_size);
|
||||
|
|
Loading…
Add table
Reference in a new issue