[Vulkan] Destroy all RTs before VulkanRenderTargetCache is destroyed

This commit is contained in:
Triang3l
2022-07-04 11:27:51 +03:00
parent 2621dabf0f
commit feaad639fb
3 changed files with 19 additions and 1 deletions

View File

@@ -374,8 +374,14 @@ void RenderTargetCache::InitializeCommon() {
RenderTargetKey(), RenderTargetKey()));
}
void RenderTargetCache::ShutdownCommon() {
void RenderTargetCache::DestroyAllRenderTargets(bool shutting_down) {
ownership_ranges_.clear();
if (!shutting_down) {
ownership_ranges_.emplace(
std::piecewise_construct, std::forward_as_tuple(uint32_t(0)),
std::forward_as_tuple(xenos::kEdramTileCount, RenderTargetKey(),
RenderTargetKey(), RenderTargetKey()));
}
for (const auto& render_target_pair : render_targets_) {
if (render_target_pair.second) {
@@ -385,6 +391,8 @@ void RenderTargetCache::ShutdownCommon() {
render_targets_.clear();
}
void RenderTargetCache::ShutdownCommon() { DestroyAllRenderTargets(true); }
void RenderTargetCache::ClearCache() {
// Keep only render targets currently owning any EDRAM data.
if (!render_targets_.empty()) {