Skip to content

Commit

Permalink
[Vk] Recreate VulkanWindowSwapChainBased MSAA surface after setOrient…
Browse files Browse the repository at this point in the history
…ationMode(). Fixed validation error "pCreateInfo->pAttachments[0] mip level 0 has height (814) smaller than the corresponding framebuffer height (2340)."
  • Loading branch information
eugenegff committed Sep 27, 2024
1 parent 2727b62 commit 1287dbb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions RenderSystems/Vulkan/src/OgreVulkanWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,6 @@ namespace Ogre
Math::Clamp( getHeight(), surfaceCaps.minImageExtent.height,
surfaceCaps.maxImageExtent.height ) );

// We need to retransition the main texture now to create MSAA surfaces (if any).
// We need to do it now, because doing it later will overwrite the VkImage handles with NULL.
//
// mTexture is supposed to always be at Resident once it transitions there,
// so maintain that guarantee.
if( mTexture->getResidencyStatus() != GpuResidency::OnStorage )
mTexture->_transitionTo( GpuResidency::OnStorage, (uint8 *)0 );
mTexture->_transitionTo( GpuResidency::Resident, (uint8 *)0 );

VkBool32 supported;
result = vkGetPhysicalDeviceSurfaceSupportKHR(
mDevice->mPhysicalDevice, mDevice->mGraphicsQueue.mFamilyIdx, mSurfaceKHR, &supported );
Expand Down Expand Up @@ -496,6 +487,12 @@ namespace Ogre
mSwapchainImages.begin() );
checkVkResult( result, "vkGetSwapchainImagesKHR" );

// We need to retransition the main texture now to re-create MSAA surfaces (if any).
// We need to do it now, because doing it later will overwrite the VkImage handles with NULL.
if( mTexture->getResidencyStatus() != GpuResidency::OnStorage )
mTexture->_transitionTo( GpuResidency::OnStorage, (uint8 *)0 );
mTexture->_transitionTo( GpuResidency::Resident, (uint8 *)0 );

acquireNextSwapchain();

if( mDepthBuffer )
Expand Down

0 comments on commit 1287dbb

Please sign in to comment.