From 8474986bb61b7e42df5e310c323d172784582d7a Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sat, 21 Sep 2024 19:12:35 -0300 Subject: [PATCH] Replace use of assert() for OGRE_ASSERT_MEDIUM --- OgreMain/include/OgreDescriptorSetSampler.h | 13 +++++----- .../src/Animation/OgreSkeletonAnimManager.cpp | 4 +-- OgreMain/src/OgreDescriptorSetTexture.cpp | 26 ++++++++++--------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/OgreMain/include/OgreDescriptorSetSampler.h b/OgreMain/include/OgreDescriptorSetSampler.h index e2037ee661..5d6edff03f 100644 --- a/OgreMain/include/OgreDescriptorSetSampler.h +++ b/OgreMain/include/OgreDescriptorSetSampler.h @@ -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 } }; diff --git a/OgreMain/src/Animation/OgreSkeletonAnimManager.cpp b/OgreMain/src/Animation/OgreSkeletonAnimManager.cpp index 127e261b4e..41045ca11d 100644 --- a/OgreMain/src/Animation/OgreSkeletonAnimManager.cpp +++ b/OgreMain/src/Animation/OgreSkeletonAnimManager.cpp @@ -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::const_iterator itSkel = skeletonsArray.begin(); @@ -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; diff --git a/OgreMain/src/OgreDescriptorSetTexture.cpp b/OgreMain/src/OgreDescriptorSetTexture.cpp index c83750cb94..8c8f503785 100644 --- a/OgreMain/src/OgreDescriptorSetTexture.cpp +++ b/OgreMain/src/OgreDescriptorSetTexture.cpp @@ -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 } //----------------------------------------------------------------------------------- @@ -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::const_iterator itor = mTextures.begin();