Skip to content

Commit

Permalink
[Vk] Fix validateSampleDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Apr 17, 2024
1 parent b0d9be8 commit 3b39603
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions RenderSystems/Vulkan/src/OgreVulkanRenderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3745,6 +3745,7 @@ namespace Ogre
}
}
//-------------------------------------------------------------------------
inline bool isPowerOf2( uint32 x ) { return ( x & ( x - 1u ) ) == 0u; }
SampleDescription VulkanRenderSystem::validateSampleDescription( const SampleDescription &sampleDesc,
PixelFormatGpu format,
uint32 textureFlags,
Expand Down Expand Up @@ -3856,11 +3857,12 @@ namespace Ogre
}

uint8 samples = sampleDesc.getColourSamples();
OGRE_ASSERT_LOW( isPowerOf2( samples ) );
while( samples > 0u )
{
if( supportedSampleCounts & ( 1u << ( samples - 1u ) ) )
if( supportedSampleCounts & samples )
return SampleDescription( samples, sampleDesc.getMsaaPattern() );
--samples;
samples = samples >> 1u;
}

// Ouch. The format is not supported. Return "something".
Expand Down

0 comments on commit 3b39603

Please sign in to comment.