From b86d26da422b5c731902bb27c514b8eca2f36797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 30 Aug 2020 10:13:16 +0200 Subject: [PATCH] Remove wrong assert. Should fix #13354 --- ext/native/thin3d/VulkanRenderManager.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ext/native/thin3d/VulkanRenderManager.cpp b/ext/native/thin3d/VulkanRenderManager.cpp index 3c6810cc3f..6f439134a3 100644 --- a/ext/native/thin3d/VulkanRenderManager.cpp +++ b/ext/native/thin3d/VulkanRenderManager.cpp @@ -1038,25 +1038,20 @@ VkImageView VulkanRenderManager::BindFramebufferAsTexture(VKRFramebuffer *fb, in _dbg_assert_(curRenderStep_ != nullptr); // Mark the dependency, check for required transitions, and return the image. + // Optimization: If possible, use final*Layout to put the texture into the correct layout "early". for (int i = (int)steps_.size() - 1; i >= 0; i--) { if (steps_[i]->stepType == VKRStepType::RENDER && steps_[i]->render.framebuffer == fb) { if (aspectBit == VK_IMAGE_ASPECT_COLOR_BIT) { // If this framebuffer was rendered to earlier in this frame, make sure to pre-transition it to the correct layout. if (steps_[i]->render.finalColorLayout == VK_IMAGE_LAYOUT_UNDEFINED) { steps_[i]->render.finalColorLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - break; - } else if (steps_[i]->render.finalColorLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { - _assert_msg_(false, "Unexpected color layout %d", (int)steps_[i]->render.finalColorLayout); - // May need to shadow the framebuffer if we re-order passes later. } + // If we find some other layout, a copy after this is likely involved. It's fine though, + // we'll just transition it right as we need it and lose a tiny optimization. } else if (aspectBit == VK_IMAGE_ASPECT_DEPTH_BIT) { // If this framebuffer was rendered to earlier in this frame, make sure to pre-transition it to the correct layout. if (steps_[i]->render.finalDepthStencilLayout == VK_IMAGE_LAYOUT_UNDEFINED) { steps_[i]->render.finalDepthStencilLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - break; - } else if (steps_[i]->render.finalDepthStencilLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) { - _assert_msg_(false, "Unexpected depth layout %d", (int)steps_[i]->render.finalDepthStencilLayout); - // May need to shadow the framebuffer if we re-order passes later. } } // We don't (yet?) support texturing from stencil images. steps_[i]->render.numReads++;