mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-10 21:40:43 +00:00
rsx: Track uncached cache resources
- Uncacheable resources can be reused as soon as they're made visible to the draw call. - Since they're likely to be reused every draw call until the shader changes, it is important to reuse as much as possible
This commit is contained in:
parent
decf9cfcf6
commit
eee2237e19
@ -269,6 +269,7 @@ namespace rsx
|
|||||||
shared_mutex m_cache_mutex;
|
shared_mutex m_cache_mutex;
|
||||||
ranged_storage m_storage;
|
ranged_storage m_storage;
|
||||||
std::unordered_multimap<u32, std::pair<deferred_subresource, image_view_type>> m_temporary_subresource_cache;
|
std::unordered_multimap<u32, std::pair<deferred_subresource, image_view_type>> m_temporary_subresource_cache;
|
||||||
|
std::vector<image_view_type> m_uncached_subresources;
|
||||||
predictor_type m_predictor;
|
predictor_type m_predictor;
|
||||||
|
|
||||||
std::atomic<u64> m_cache_update_tag = {0};
|
std::atomic<u64> m_cache_update_tag = {0};
|
||||||
@ -1322,7 +1323,7 @@ namespace rsx
|
|||||||
|
|
||||||
image_view_type create_temporary_subresource(commandbuffer_type &cmd, deferred_subresource& desc)
|
image_view_type create_temporary_subresource(commandbuffer_type &cmd, deferred_subresource& desc)
|
||||||
{
|
{
|
||||||
if (!desc.do_not_cache)
|
if (LIKELY(!desc.do_not_cache))
|
||||||
{
|
{
|
||||||
const auto found = m_temporary_subresource_cache.equal_range(desc.address);
|
const auto found = m_temporary_subresource_cache.equal_range(desc.address);
|
||||||
for (auto It = found.first; It != found.second; ++It)
|
for (auto It = found.first; It != found.second; ++It)
|
||||||
@ -1418,14 +1419,31 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result && !desc.do_not_cache)
|
if (LIKELY(result))
|
||||||
{
|
{
|
||||||
m_temporary_subresource_cache.insert({ desc.address,{ desc, result } });
|
if (LIKELY(!desc.do_not_cache))
|
||||||
|
{
|
||||||
|
m_temporary_subresource_cache.insert({ desc.address,{ desc, result } });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_uncached_subresources.push_back(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void release_uncached_temporary_subresources()
|
||||||
|
{
|
||||||
|
for (auto& view : m_uncached_subresources)
|
||||||
|
{
|
||||||
|
release_temporary_subresource(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_uncached_subresources.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void notify_surface_changed(const utils::address_range& range)
|
void notify_surface_changed(const utils::address_range& range)
|
||||||
{
|
{
|
||||||
for (auto It = m_temporary_subresource_cache.begin(); It != m_temporary_subresource_cache.end();)
|
for (auto It = m_temporary_subresource_cache.begin(); It != m_temporary_subresource_cache.end();)
|
||||||
|
@ -387,6 +387,8 @@ void GLGSRender::end()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_gl_texture_cache.release_uncached_temporary_subresources();
|
||||||
|
|
||||||
m_frame_stats.textures_upload_time += m_profiler.duration();
|
m_frame_stats.textures_upload_time += m_profiler.duration();
|
||||||
|
|
||||||
// Optionally do memory synchronization if the texture stage has not yet triggered this
|
// Optionally do memory synchronization if the texture stage has not yet triggered this
|
||||||
|
@ -1691,6 +1691,8 @@ void VKGSRender::end()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_texture_cache.release_uncached_temporary_subresources();
|
||||||
|
|
||||||
m_frame_stats.textures_upload_time += m_profiler.duration();
|
m_frame_stats.textures_upload_time += m_profiler.duration();
|
||||||
|
|
||||||
if (m_current_command_buffer->flags & vk::command_buffer::cb_load_occluson_task)
|
if (m_current_command_buffer->flags & vk::command_buffer::cb_load_occluson_task)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user