rsx: invalidate cache every frame: invalidate unbound rtt's in surface store

This commit is contained in:
Jake
2017-08-03 19:03:01 -05:00
committed by Zangetsu38
parent ff55752445
commit d47183e89e
+20
View File
@@ -3,6 +3,7 @@
#include "Utilities/GSL.h" #include "Utilities/GSL.h"
#include "../GCM.h" #include "../GCM.h"
#include <list> #include <list>
#include <unordered_set>
namespace rsx namespace rsx
{ {
@@ -115,6 +116,8 @@ namespace rsx
std::list<surface_storage_type> invalidated_resources; std::list<surface_storage_type> invalidated_resources;
std::unordered_set<u32> m_prev_bound_targets = {};
surface_store() = default; surface_store() = default;
~surface_store() = default; ~surface_store() = default;
surface_store(const surface_store&) = delete; surface_store(const surface_store&) = delete;
@@ -283,6 +286,7 @@ namespace rsx
// Create/Reuse requested rtts // Create/Reuse requested rtts
for (u8 surface_index : utility::get_rtt_indexes(set_surface_target)) for (u8 surface_index : utility::get_rtt_indexes(set_surface_target))
{ {
m_prev_bound_targets.insert(surface_addresses[surface_index]);
if (surface_addresses[surface_index] == 0) if (surface_addresses[surface_index] == 0)
continue; continue;
@@ -477,6 +481,22 @@ namespace rsx
for (auto &ds : m_depth_stencil_storage) for (auto &ds : m_depth_stencil_storage)
Traits::invalidate_depth_surface_contents(command_list, Traits::get(std::get<1>(ds)), nullptr, true); Traits::invalidate_depth_surface_contents(command_list, Traits::get(std::get<1>(ds)), nullptr, true);
for (auto it = m_render_targets_storage.begin(); it != m_render_targets_storage.end();)
{
auto check = std::find(m_prev_bound_targets.cbegin(), m_prev_bound_targets.cend(), it->first);
if (check == m_prev_bound_targets.end())
{
surface_storage_type &rtt = it->second;
invalidated_resources.push_back(std::move(rtt));
it = m_render_targets_storage.erase(it);
}
else
{
++it;
}
}
m_prev_bound_targets.clear();
} }
/** /**