From bce8320f063d7d67d7d3d04374e6a87bf3926ad4 Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Fri, 12 Sep 2025 15:52:21 -0700 Subject: [PATCH] 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. --- filament/backend/src/vulkan/VulkanDriver.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 58d2f40e67..1517a1a8cd 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -818,10 +818,8 @@ void VulkanDriver::destroyRenderTarget(Handle rth) { } auto rt = resource_ptr::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(); } }