mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[Vulkan] Destroy all RTs before VulkanRenderTargetCache is destroyed
This commit is contained in:
parent
2621dabf0f
commit
feaad639fb
|
|
@ -374,8 +374,14 @@ void RenderTargetCache::InitializeCommon() {
|
||||||
RenderTargetKey(), RenderTargetKey()));
|
RenderTargetKey(), RenderTargetKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTargetCache::ShutdownCommon() {
|
void RenderTargetCache::DestroyAllRenderTargets(bool shutting_down) {
|
||||||
ownership_ranges_.clear();
|
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_) {
|
for (const auto& render_target_pair : render_targets_) {
|
||||||
if (render_target_pair.second) {
|
if (render_target_pair.second) {
|
||||||
|
|
@ -385,6 +391,8 @@ void RenderTargetCache::ShutdownCommon() {
|
||||||
render_targets_.clear();
|
render_targets_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderTargetCache::ShutdownCommon() { DestroyAllRenderTargets(true); }
|
||||||
|
|
||||||
void RenderTargetCache::ClearCache() {
|
void RenderTargetCache::ClearCache() {
|
||||||
// Keep only render targets currently owning any EDRAM data.
|
// Keep only render targets currently owning any EDRAM data.
|
||||||
if (!render_targets_.empty()) {
|
if (!render_targets_.empty()) {
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,10 @@ class RenderTargetCache {
|
||||||
// Call last in implementation-specific initialization (when things like path
|
// Call last in implementation-specific initialization (when things like path
|
||||||
// are initialized by the implementation).
|
// are initialized by the implementation).
|
||||||
void InitializeCommon();
|
void InitializeCommon();
|
||||||
|
// May be called from the destructor, or from the implementation shutdown to
|
||||||
|
// destroy all render targets before destroying what they depend on in the
|
||||||
|
// implementation.
|
||||||
|
void DestroyAllRenderTargets(bool shutting_down);
|
||||||
// Call last in implementation-specific shutdown, also callable from the
|
// Call last in implementation-specific shutdown, also callable from the
|
||||||
// destructor.
|
// destructor.
|
||||||
void ShutdownCommon();
|
void ShutdownCommon();
|
||||||
|
|
|
||||||
|
|
@ -661,6 +661,12 @@ void VulkanRenderTargetCache::Shutdown(bool from_destructor) {
|
||||||
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
|
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
|
||||||
VkDevice device = provider.device();
|
VkDevice device = provider.device();
|
||||||
|
|
||||||
|
// Destroy all render targets before the descriptor set pool is destroyed -
|
||||||
|
// may happen if shutting down the VulkanRenderTargetCache by destroying it,
|
||||||
|
// so ShutdownCommon is called by the RenderTargetCache destructor, when it's
|
||||||
|
// already too late.
|
||||||
|
DestroyAllRenderTargets(true);
|
||||||
|
|
||||||
for (const auto& dump_pipeline_pair : dump_pipelines_) {
|
for (const auto& dump_pipeline_pair : dump_pipelines_) {
|
||||||
// May be null to prevent recreation attempts.
|
// May be null to prevent recreation attempts.
|
||||||
if (dump_pipeline_pair.second != VK_NULL_HANDLE) {
|
if (dump_pipeline_pair.second != VK_NULL_HANDLE) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue