Skip to content

Commit

Permalink
Replace use of assert() for OGRE_ASSERT_MEDIUM
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Sep 21, 2024
1 parent 1270639 commit 8474986
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
13 changes: 7 additions & 6 deletions OgreMain/include/OgreDescriptorSetSampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,18 @@ namespace Ogre

void checkValidity() const
{
#if OGRE_DEBUG_MODE && !defined( NDEBUG )
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
size_t totalSamplersUsed = 0u;

for( size_t i = 0; i < NumShaderTypes; ++i )
totalSamplersUsed += mShaderTypeSamplerCount[i];

assert( totalSamplersUsed > 0 &&
"This DescriptorSetSampler doesn't use any sampler! Perhaps incorrectly setup?" );
assert( totalSamplersUsed == mSamplers.size() &&
"This DescriptorSetSampler doesn't use as many samplers as it "
"claims to have, or uses more than it has provided" );
OGRE_ASSERT_MEDIUM(
totalSamplersUsed > 0 &&
"This DescriptorSetSampler doesn't use any sampler! Perhaps incorrectly setup?" );
OGRE_ASSERT_MEDIUM( totalSamplersUsed == mSamplers.size() &&
"This DescriptorSetSampler doesn't use as many samplers as it "
"claims to have, or uses more than it has provided" );
#endif
}
};
Expand Down
4 changes: 2 additions & 2 deletions OgreMain/src/Animation/OgreSkeletonAnimManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace Ogre

skeletonsArray.insert( it, newInstance );

#if OGRE_DEBUG_MODE && !defined( NDEBUG )
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_HIGH
{
// Check all depth levels respect the same ordering
FastArray<SkeletonInstance *>::const_iterator itSkel = skeletonsArray.begin();
Expand All @@ -128,7 +128,7 @@ namespace Ogre
{
Bone **owner1 = transf1[i].mOwner + transf1[i].mIndex;
Bone **owner2 = transf2[i].mOwner + transf2[i].mIndex;
assert( owner1 < owner2 );
OGRE_ASSERT_HIGH( owner1 < owner2 );
}

++itSkel2;
Expand Down
26 changes: 14 additions & 12 deletions OgreMain/src/OgreDescriptorSetTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ namespace Ogre
{
void DescriptorSetTexture::checkValidity() const
{
#if OGRE_DEBUG_MODE && !defined( NDEBUG )
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
size_t totalTexturesUsed = 0u;

for( size_t i = 0; i < NumShaderTypes; ++i )
totalTexturesUsed += mShaderTypeTexCount[i];

assert( totalTexturesUsed > 0 &&
"This DescriptorSetTexture doesn't use any texture! Perhaps incorrectly setup?" );
assert( totalTexturesUsed == mTextures.size() &&
"This DescriptorSetTexture doesn't use as many textures as it "
"claims to have, or uses more than it has provided" );
OGRE_ASSERT_MEDIUM(
totalTexturesUsed > 0 &&
"This DescriptorSetTexture doesn't use any texture! Perhaps incorrectly setup?" );
OGRE_ASSERT_MEDIUM( totalTexturesUsed == mTextures.size() &&
"This DescriptorSetTexture doesn't use as many textures as it "
"claims to have, or uses more than it has provided" );
#endif
}
//-----------------------------------------------------------------------------------
Expand All @@ -72,17 +73,18 @@ namespace Ogre
"This DescriptorSetTexture2 doesn't use any texture/buffer! "
"Perhaps incorrectly setup?" );

#if OGRE_DEBUG_MODE && !defined( NDEBUG )
#if OGRE_DEBUG_MODE >= OGRE_DEBUG_MEDIUM
size_t totalTexturesUsed = 0u;

for( size_t i = 0; i < NumShaderTypes; ++i )
totalTexturesUsed += mShaderTypeTexCount[i];

assert( totalTexturesUsed > 0 &&
"This DescriptorSetTexture doesn't use any texture! Perhaps incorrectly setup?" );
assert( totalTexturesUsed == mTextures.size() &&
"This DescriptorSetTexture doesn't use as many textures as it "
"claims to have, or uses more than it has provided" );
OGRE_ASSERT_MEDIUM(
totalTexturesUsed > 0 &&
"This DescriptorSetTexture doesn't use any texture! Perhaps incorrectly setup?" );
OGRE_ASSERT_MEDIUM( totalTexturesUsed == mTextures.size() &&
"This DescriptorSetTexture doesn't use as many textures as it "
"claims to have, or uses more than it has provided" );
#endif

FastArray<Slot>::const_iterator itor = mTextures.begin();
Expand Down

0 comments on commit 8474986

Please sign in to comment.