vk: make sure default render target is not removed (#9213)

We need to have an reference to the default render target for
the duration of the backend lifetime.  So even if the client
tries to destroy the default render target, we don't actually
destroy it.

Note that it will be destroyed on driver shutdown.
This commit is contained in:
Powei Feng
2025-09-12 15:52:21 -07:00
committed by GitHub
parent f3a4e21fe5
commit bce8320f06

View File

@@ -818,10 +818,8 @@ void VulkanDriver::destroyRenderTarget(Handle<HwRenderTarget> rth) {
}
auto rt = resource_ptr<VulkanRenderTarget>::cast(&mResourceManager, rth);
if (UTILS_UNLIKELY(rt == mDefaultRenderTarget)) {
// Note that this should only happen on driver shutdown.
mDefaultRenderTarget = {};
} else {
// Note that the default render target will be destroyed on shutdown
if (UTILS_LIKELY(rt != mDefaultRenderTarget)) {
rt.dec();
}
}