diff --git a/filament/backend/src/vulkan/VulkanDriver.cpp b/filament/backend/src/vulkan/VulkanDriver.cpp index 3d3ad700381..56c4a7a2964 100644 --- a/filament/backend/src/vulkan/VulkanDriver.cpp +++ b/filament/backend/src/vulkan/VulkanDriver.cpp @@ -700,6 +700,11 @@ void VulkanDriver::createFenceR(Handle fh, int) { } void VulkanDriver::createSwapChainR(Handle sch, void* nativeWindow, uint64_t flags) { + // Running gc() to guard against an edge case where the old swapchains need to have been + // destroyed before the new swapchain can be created. Otherwise, we would fail + // vkCreateSwapchainKHR with VK_ERROR_NATIVE_WINDOW_IN_USE_KHR. + mResourceManager.gc(); + if ((flags & backend::SWAP_CHAIN_CONFIG_SRGB_COLORSPACE) != 0 && !isSRGBSwapChainSupported()) { FVK_LOGW << "sRGB swapchain requested, but Platform does not support it" << utils::io::endl; diff --git a/filament/backend/src/vulkan/VulkanTexture.cpp b/filament/backend/src/vulkan/VulkanTexture.cpp index 2180c04fbda..2f30ee20c9a 100644 --- a/filament/backend/src/vulkan/VulkanTexture.cpp +++ b/filament/backend/src/vulkan/VulkanTexture.cpp @@ -296,7 +296,7 @@ VulkanTexture::VulkanTexture(VkDevice device, VkPhysicalDevice physicalDevice, imageInfo.samples = (VkSampleCountFlagBits) samples; VkResult result = vkCreateImage(mState->mDevice, &imageInfo, VKALLOC, &mState->mTextureImage); - if (result == VK_SUCCESS || FVK_ENABLED(FVK_DEBUG_TEXTURE)) { + if (result != VK_SUCCESS || FVK_ENABLED(FVK_DEBUG_TEXTURE)) { FVK_LOGD << "vkCreateImage: " << "image = " << mState->mTextureImage << ", " << "result = " << result << ", "