Skip to content

Commit

Permalink
[VK]Fix crash when RenderWindow is exclusively in the resolve texture
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
darksylinc committed Oct 19, 2023
1 parent e53f570 commit 651759e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions RenderSystems/Vulkan/src/OgreVulkanRenderPassDescriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,17 +690,23 @@ 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 );
}
}
//-----------------------------------------------------------------------------------
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();
}
Expand Down

0 comments on commit 651759e

Please sign in to comment.