[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()));
|
||||
}
|
||||
|
||||
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()) {
|
||||
|
|
|
@ -193,6 +193,10 @@ class RenderTargetCache {
|
|||
// Call last in implementation-specific initialization (when things like path
|
||||
// are initialized by the implementation).
|
||||
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
|
||||
// destructor.
|
||||
void ShutdownCommon();
|
||||
|
|
|
@ -661,6 +661,12 @@ void VulkanRenderTargetCache::Shutdown(bool from_destructor) {
|
|||
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
|
||||
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_) {
|
||||
// May be null to prevent recreation attempts.
|
||||
if (dump_pipeline_pair.second != VK_NULL_HANDLE) {
|
||||
|
|
Loading…
Reference in New Issue