From 651759e389fd55f8d0f1e4602aa3c776e67237ea Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Thu, 19 Oct 2023 12:09:21 -0300 Subject: [PATCH] [VK]Fix crash when RenderWindow is exclusively in the resolve texture Advanced users can use explicit MSAA and resolve directly into the RenderWindow. This is allowed, but would cause a crash on Vulkan if the swapchain is recreated. --- .../Vulkan/src/OgreVulkanRenderPassDescriptor.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/RenderSystems/Vulkan/src/OgreVulkanRenderPassDescriptor.cpp b/RenderSystems/Vulkan/src/OgreVulkanRenderPassDescriptor.cpp index 680edf32318..8f2222a9764 100644 --- a/RenderSystems/Vulkan/src/OgreVulkanRenderPassDescriptor.cpp +++ b/RenderSystems/Vulkan/src/OgreVulkanRenderPassDescriptor.cpp @@ -690,8 +690,11 @@ namespace Ogre //----------------------------------------------------------------------------------- void VulkanRenderPassDescriptor::notifySwapchainCreated( VulkanWindow *window ) { - if( mNumColourEntries > 0 && mColour[0].texture->isRenderWindowSpecific() && - mColour[0].texture == window->getTexture() ) + if( mNumColourEntries > 0 && + ( ( mColour[0].texture && mColour[0].texture->isRenderWindowSpecific() && + mColour[0].texture == window->getTexture() ) || + ( mColour[0].resolveTexture && mColour[0].resolveTexture->isRenderWindowSpecific() && + mColour[0].resolveTexture == window->getTexture() ) ) ) { entriesModified( RenderPassDescriptor::All ); } @@ -699,8 +702,11 @@ namespace Ogre //----------------------------------------------------------------------------------- void VulkanRenderPassDescriptor::notifySwapchainDestroyed( VulkanWindow *window ) { - if( mNumColourEntries > 0 && mColour[0].texture->isRenderWindowSpecific() && - mColour[0].texture == window->getTexture() ) + if( mNumColourEntries > 0 && + ( ( mColour[0].texture && mColour[0].texture->isRenderWindowSpecific() && + mColour[0].texture == window->getTexture() ) || + ( mColour[0].resolveTexture && mColour[0].resolveTexture->isRenderWindowSpecific() && + mColour[0].resolveTexture == window->getTexture() ) ) ) { releaseFbo(); }