diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-03-26 18:40:00 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-03-26 18:40:00 +0000 |
| commit | 09b9f1dc1ec69683c3143f309e6e8a0141361624 (patch) | |
| tree | b6f1a63031e72e09d313f681a311eb3043405441 /Common/interface | |
| parent | Fixed latest MSVC (19.25.28610.4) build issue (diff) | |
| download | DiligentCore-09b9f1dc1ec69683c3143f309e6e8a0141361624.tar.gz DiligentCore-09b9f1dc1ec69683c3143f309e6e8a0141361624.zip | |
Renamed _DEBUG and DEVELOPMENT macros to DILGENT_DEBUG and DILIGENT_DEVELOPMENT
Diffstat (limited to 'Common/interface')
| -rw-r--r-- | Common/interface/FilteringTools.hpp | 4 | ||||
| -rw-r--r-- | Common/interface/FixedBlockMemoryAllocator.hpp | 14 | ||||
| -rw-r--r-- | Common/interface/RefCountedObjectImpl.hpp | 20 | ||||
| -rw-r--r-- | Common/interface/STDAllocator.hpp | 12 | ||||
| -rw-r--r-- | Common/interface/ValidatedCast.hpp | 2 |
5 files changed, 27 insertions, 25 deletions
diff --git a/Common/interface/FilteringTools.hpp b/Common/interface/FilteringTools.hpp index b11983cd..6ee7a97a 100644 --- a/Common/interface/FilteringTools.hpp +++ b/Common/interface/FilteringTools.hpp @@ -157,7 +157,7 @@ LinearTexFilterSampleInfo GetLinearTexFilterSampleInfo(Uint32 Width, float u) return SampleInfo; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG template <TEXTURE_ADDRESS_MODE AddressMode> void _DbgVerifyFilterInfo(const LinearTexFilterSampleInfo& FilterInfo, Uint32 Width, const char* Direction, float u) { @@ -203,7 +203,7 @@ DstType FilterTexture2DBilinear(Uint32 Width, auto UFilterInfo = GetLinearTexFilterSampleInfo<AddressModeU, IsNormalizedCoord>(Width, u); auto VFilterInfo = GetLinearTexFilterSampleInfo<AddressModeV, IsNormalizedCoord>(Height, v); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { _DbgVerifyFilterInfo<AddressModeU>(UFilterInfo, Width, "horizontal", u); _DbgVerifyFilterInfo<AddressModeV>(VFilterInfo, Height, "horizontal", v); diff --git a/Common/interface/FixedBlockMemoryAllocator.hpp b/Common/interface/FixedBlockMemoryAllocator.hpp index 89c9e355..91c7422b 100644 --- a/Common/interface/FixedBlockMemoryAllocator.hpp +++ b/Common/interface/FixedBlockMemoryAllocator.hpp @@ -43,7 +43,7 @@ namespace Diligent { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG inline void FillWithDebugPattern(void* ptr, Uint8 Pattern, size_t NumBytes) { memset(ptr, Pattern, NumBytes); @@ -128,7 +128,7 @@ private: return reinterpret_cast<Uint8*>(m_pPageStart) + BlockIndex * m_pOwnerAllocator->m_BlockSize; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void dbgVerifyAddress(const void* pBlockAddr) const { size_t Delta = reinterpret_cast<const Uint8*>(pBlockAddr) - reinterpret_cast<Uint8*>(m_pPageStart); @@ -241,7 +241,7 @@ class ObjectPool public: static void SetRawAllocator(IMemoryAllocator& Allocator) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (m_bPoolInitialized && m_pRawAllocator != &Allocator) { LOG_WARNING_MESSAGE("Setting pool raw allocator after the pool has been initialized has no effect"); @@ -251,7 +251,7 @@ public: } static void SetPageSize(Uint32 NumAllocationsInPage) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (m_bPoolInitialized && m_NumAllocationsInPage != NumAllocationsInPage) { LOG_WARNING_MESSAGE("Setting pool page size after the pool has been initialized has no effect"); @@ -262,7 +262,7 @@ public: static ObjectPool& GetPool() { static ObjectPool ThePool; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_bPoolInitialized = true; #endif return ThePool; @@ -299,7 +299,7 @@ private: ObjectPool() : m_FixedBlockAlloctor(m_pRawAllocator ? *m_pRawAllocator : GetRawAllocator(), sizeof(ObjectType), m_NumAllocationsInPage) {} -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG static bool m_bPoolInitialized; #endif FixedBlockMemoryAllocator m_FixedBlockAlloctor; @@ -310,7 +310,7 @@ Uint32 ObjectPool<ObjectType>::m_NumAllocationsInPage = 64; template <typename ObjectType> IMemoryAllocator* ObjectPool<ObjectType>::m_pRawAllocator = nullptr; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG template <typename ObjectType> bool ObjectPool<ObjectType>::m_bPoolInitialized = false; #endif diff --git a/Common/interface/RefCountedObjectImpl.hpp b/Common/interface/RefCountedObjectImpl.hpp index c437f170..2294c668 100644 --- a/Common/interface/RefCountedObjectImpl.hpp +++ b/Common/interface/RefCountedObjectImpl.hpp @@ -220,7 +220,7 @@ private: { m_lNumStrongReferences = 0; m_lNumWeakReferences = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG memset(m_ObjectWrapperBuffer, 0, sizeof(m_ObjectWrapperBuffer)); #endif } @@ -356,9 +356,11 @@ private: // | - Increment m_lNumStrongReferences // | 5. Decrement m_lNumStrongReferences -#ifdef _DEBUG - Atomics::Long NumStrongRefs = m_lNumStrongReferences; - VERIFY(NumStrongRefs == 0 || NumStrongRefs == 1, "Num strong references (", NumStrongRefs, ") is expected to be 0 or 1"); +#ifdef DILIGENT_DEBUG + { + Atomics::Long NumStrongRefs = m_lNumStrongReferences; + VERIFY(NumStrongRefs == 0 || NumStrongRefs == 1, "Num strong references (", NumStrongRefs, ") is expected to be 0 or 1"); + } #endif // Acquire the lock. @@ -392,7 +394,7 @@ private: size_t ObjectWrapperBufferCopy[ObjectWrapperBufferSize]; for (size_t i = 0; i < ObjectWrapperBufferSize; ++i) ObjectWrapperBufferCopy[i] = m_ObjectWrapperBuffer[i]; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG memset(m_ObjectWrapperBuffer, 0, sizeof(m_ObjectWrapperBuffer)); #endif auto* pWrapper = reinterpret_cast<ObjectWrapperBase*>(ObjectWrapperBufferCopy); @@ -614,7 +616,7 @@ public: // clang-format off m_pAllocator{&Allocator}, m_pOwner{pOwner} -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , m_dvpDescription{Description} , m_dvpFileName {FileName } , m_dvpLineNumber {LineNumber } @@ -627,7 +629,7 @@ public: // clang-format off m_pAllocator {nullptr}, m_pOwner {pOwner } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , m_dvpDescription{nullptr} , m_dvpFileName {nullptr} , m_dvpLineNumber {0 } @@ -659,7 +661,7 @@ public: ObjectType* pObj = nullptr; try { -#ifndef DEVELOPMENT +#ifndef DILIGENT_DEVELOPMENT static constexpr const char* m_dvpDescription = "<Unavailable in release build>"; static constexpr const char* m_dvpFileName = "<Unavailable in release build>"; static constexpr Int32 m_dvpLineNumber = -1; @@ -686,7 +688,7 @@ private: AllocatorType* const m_pAllocator; IObject* const m_pOwner; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT const Char* const m_dvpDescription; const char* const m_dvpFileName; Int32 const m_dvpLineNumber; diff --git a/Common/interface/STDAllocator.hpp b/Common/interface/STDAllocator.hpp index 5428b249..4c4ea5e6 100644 --- a/Common/interface/STDAllocator.hpp +++ b/Common/interface/STDAllocator.hpp @@ -63,7 +63,7 @@ struct STDAllocator STDAllocator(AllocatorType& Allocator, const Char* Description, const Char* FileName, const Int32 LineNumber) noexcept : // clang-format off m_Allocator {Allocator} -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , m_dvpDescription{Description} , m_dvpFileName {FileName } , m_dvpLineNumber {LineNumber } @@ -76,7 +76,7 @@ struct STDAllocator STDAllocator(const STDAllocator<U, AllocatorType>& other) noexcept : // clang-format off m_Allocator {other.m_Allocator} -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , m_dvpDescription{other.m_dvpDescription} , m_dvpFileName {other.m_dvpFileName } , m_dvpLineNumber {other.m_dvpLineNumber } @@ -89,7 +89,7 @@ struct STDAllocator STDAllocator(STDAllocator<U, AllocatorType>&& other) noexcept : // clang-format off m_Allocator {other.m_Allocator} -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , m_dvpDescription{other.m_dvpDescription} , m_dvpFileName {other.m_dvpFileName } , m_dvpLineNumber {other.m_dvpLineNumber } @@ -105,7 +105,7 @@ struct STDAllocator // There is no default constructor to create null allocator, so all fields must be // initialized. DEV_CHECK_ERR(&m_Allocator == &other.m_Allocator, "Inconsistent allocators"); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DEV_CHECK_ERR(m_dvpDescription == other.m_dvpDescription, "Incosistent allocator descriptions"); DEV_CHECK_ERR(m_dvpFileName == other.m_dvpFileName, "Incosistent allocator file names"); DEV_CHECK_ERR(m_dvpLineNumber == other.m_dvpLineNumber, "Incosistent allocator line numbers"); @@ -120,7 +120,7 @@ struct STDAllocator T* allocate(std::size_t count) { -#ifndef DEVELOPMENT +#ifndef DILIGENT_DEVELOPMENT static constexpr const char* m_dvpDescription = "<Unavailable in release build>"; static constexpr const char* m_dvpFileName = "<Unavailable in release build>"; static constexpr Int32 m_dvpLineNumber = -1; @@ -154,7 +154,7 @@ struct STDAllocator } AllocatorType& m_Allocator; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT const Char* const m_dvpDescription; const Char* const m_dvpFileName; Int32 const m_dvpLineNumber; diff --git a/Common/interface/ValidatedCast.hpp b/Common/interface/ValidatedCast.hpp index eb528274..fdb2b253 100644 --- a/Common/interface/ValidatedCast.hpp +++ b/Common/interface/ValidatedCast.hpp @@ -32,7 +32,7 @@ template <typename DstType, typename SrcType> DstType* ValidatedCast(SrcType* Ptr) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (Ptr != nullptr) { CHECK_DYNAMIC_TYPE(DstType, Ptr); |
