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 /Graphics | |
| 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 'Graphics')
96 files changed, 438 insertions, 414 deletions
diff --git a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp index 6d9dbb5e..6e2ab0a6 100644 --- a/Graphics/GLSLTools/src/SPIRVShaderResources.cpp +++ b/Graphics/GLSLTools/src/SPIRVShaderResources.cpp @@ -450,7 +450,7 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator, SamplerInd); if (ResType == SPIRVShaderResourceAttribs::ResourceType::SeparateImage && pNewSepImg->IsValidSepSamplerAssigned()) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT const auto& SepSmplr = GetSepSmplr(pNewSepImg->GetAssignedSepSamplerInd()); DEV_CHECK_ERR(SepSmplr.ArraySize == 1 || SepSmplr.ArraySize == pNewSepImg->ArraySize, "Array size (", SepSmplr.ArraySize, ") of separate sampler variable '", @@ -488,7 +488,7 @@ SPIRVShaderResources::SPIRVShaderResources(IMemoryAllocator& Allocator, //LOG_INFO_MESSAGE(DumpResources()); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (CombinedSamplerSuffix != nullptr) { for (Uint32 n = 0; n < GetNumSepSmplrs(); ++n) diff --git a/Graphics/GraphicsAccessories/interface/RingBuffer.hpp b/Graphics/GraphicsAccessories/interface/RingBuffer.hpp index e258cd92..168689db 100644 --- a/Graphics/GraphicsAccessories/interface/RingBuffer.hpp +++ b/Graphics/GraphicsAccessories/interface/RingBuffer.hpp @@ -180,7 +180,7 @@ public: // See http://diligentgraphics.com/diligent-engine/architecture/d3d12/managing-resource-lifetimes/ void FinishCurrentFrame(Uint64 FenceValue) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (!m_CompletedFrameHeads.empty()) VERIFY(FenceValue >= m_CompletedFrameHeads.back().FenceValue, "Current frame fence value (", FenceValue, ") is lower than the fence value of the previous frame (", m_CompletedFrameHeads.back().FenceValue, ")"); #endif @@ -208,7 +208,7 @@ public: if (IsEmpty()) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG VERIFY(m_CompletedFrameHeads.empty(), "Zero-size heads are not added to the list, and since the buffer is empty, there must be no heads in the list"); for (const auto& head : m_CompletedFrameHeads) VERIFY(head.Size == 0, "Non zero-size head found"); diff --git a/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.hpp b/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.hpp index 410e8568..c1fc083f 100644 --- a/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.hpp +++ b/Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.hpp @@ -108,14 +108,14 @@ public: AddNewBlock(0, m_MaxSize); ResetCurrAlignment(); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG DbgVerifyList(); #endif } ~VariableSizeAllocationsManager() { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (!m_FreeBlocksByOffset.empty() || !m_FreeBlocksBySize.empty()) { VERIFY(m_FreeBlocksByOffset.size() == 1, "Single free block is expected"); @@ -236,7 +236,7 @@ public: } } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG DbgVerifyList(); #endif return Allocation{Offset, AdjustedSize}; @@ -256,7 +256,7 @@ public: // upper_bound() returns an iterator pointing to the first element in the // container whose key is considered to go after k. auto NextBlockIt = m_FreeBlocksByOffset.upper_bound(Offset); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { auto LowBnd = m_FreeBlocksByOffset.lower_bound(Offset); // First element whose offset is >= // Since zero-size allocations are not allowed, lower bound must always be equal to the upper bound @@ -339,7 +339,7 @@ public: ResetCurrAlignment(); } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG DbgVerifyList(); #endif } @@ -372,7 +372,7 @@ private: {} } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void DbgVerifyList() { OffsetType TotalFreeSize = 0; diff --git a/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp b/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp index 609970b1..da247e31 100644 --- a/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp +++ b/Graphics/GraphicsAccessories/src/GraphicsAccessories.cpp @@ -382,7 +382,7 @@ const TextureFormatAttribs& GetTextureFormatAttribs(TEXTURE_FORMAT Format) // clang-format on static_assert(TEX_FORMAT_NUM_FORMATS == TEX_FORMAT_BC7_UNORM_SRGB + 1, "Not all texture formats initialized."); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (Uint32 Fmt = TEX_FORMAT_UNKNOWN; Fmt < TEX_FORMAT_NUM_FORMATS; ++Fmt) VERIFY(FmtAttribs[Fmt].Format == static_cast<TEXTURE_FORMAT>(Fmt), "Uninitialized format"); #endif diff --git a/Graphics/GraphicsEngine/include/BufferBase.hpp b/Graphics/GraphicsEngine/include/BufferBase.hpp index 17d09c91..aeee4114 100644 --- a/Graphics/GraphicsEngine/include/BufferBase.hpp +++ b/Graphics/GraphicsEngine/include/BufferBase.hpp @@ -71,7 +71,7 @@ public: const BufferDesc& BuffDesc, bool bIsDeviceInternal) : TDeviceObjectBase{pRefCounters, pDevice, BuffDesc, bIsDeviceInternal}, -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_dbgBuffViewAllocator{BuffViewObjAllocator}, #endif m_pDefaultUAV{nullptr, STDDeleter<BufferViewImplType, TBuffViewObjAllocator>(BuffViewObjAllocator)}, @@ -164,7 +164,7 @@ protected: /// Corrects buffer view description and validates view parameters. void CorrectBufferViewDesc(struct BufferViewDesc& ViewDesc); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG TBuffViewObjAllocator& m_dbgBuffViewAllocator; #endif diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp index 87b209b8..b4c271fa 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp @@ -225,7 +225,7 @@ protected: bool EndQuery(IQuery* pQuery, int); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT // clang-format off bool DvpVerifyDrawArguments (const DrawAttribs& Attribs)const; bool DvpVerifyDrawIndexedArguments (const DrawIndexedAttribs& Attribs)const; @@ -311,7 +311,7 @@ protected: const bool m_bIsDeferred = false; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // std::unordered_map is unbelievably slow. Keeping track of mapped buffers // in release builds is not feasible struct DbgMappedBufferInfo @@ -332,7 +332,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, SET_VERTEX_BUFFERS_FLAGS Flags) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (StartSlot >= MAX_BUFFER_SLOTS) { LOG_ERROR_MESSAGE("Start vertex buffer slot ", StartSlot, " is out of allowed range [0, ", MAX_BUFFER_SLOTS - 1, "]."); @@ -364,7 +364,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: auto& CurrStream = m_VertexStreams[StartSlot + Buff]; CurrStream.pBuffer = ppBuffers ? ValidatedCast<BufferImplType>(ppBuffers[Buff]) : nullptr; CurrStream.Offset = pOffsets ? pOffsets[Buff] : 0; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (CurrStream.pBuffer) { const auto& BuffDesc = CurrStream.pBuffer->GetDesc(); @@ -391,7 +391,7 @@ template <typename BaseInterface, typename ImplementationTraits> inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, int) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!m_pPipelineState) { LOG_ERROR_MESSAGE("No pipeline state is bound to the pipeline"); @@ -422,7 +422,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: { m_pIndexBuffer = ValidatedCast<BufferImplType>(pIndexBuffer); m_IndexDataStartOffset = ByteOffset; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (m_pIndexBuffer) { const auto& BuffDesc = m_pIndexBuffer->GetDesc(); @@ -569,7 +569,7 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: if (pRTView) { const auto& RTVDesc = pRTView->GetDesc(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (RTVDesc.ViewType != TEXTURE_VIEW_RENDER_TARGET) LOG_ERROR("Texture view object named '", RTVDesc.Name ? RTVDesc.Name : "", "' has incorrect view type (", GetTexViewTypeLiteralName(RTVDesc.ViewType), "). Render target view is expected"); #endif @@ -584,7 +584,7 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: } else { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT const auto& TexDesc = pRTView->GetTexture()->GetDesc(); if (m_FramebufferWidth != std::max(TexDesc.Width >> RTVDesc.MostDetailedMip, 1U)) LOG_ERROR("Render target width (", std::max(TexDesc.Width >> RTVDesc.MostDetailedMip, 1U), ") specified by RTV '", RTVDesc.Name, "' is inconsistent with the width of previously bound render targets (", m_FramebufferWidth, ")"); @@ -609,7 +609,7 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: if (pDepthStencil != nullptr) { const auto& DSVDesc = pDepthStencil->GetDesc(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (DSVDesc.ViewType != TEXTURE_VIEW_DEPTH_STENCIL) LOG_ERROR("Texture view object named '", DSVDesc.Name ? DSVDesc.Name : "", "' has incorrect view type (", GetTexViewTypeLiteralName(DSVDesc.ViewType), "). Depth stencil view is expected"); #endif @@ -625,7 +625,7 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: } else { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT const auto& TexDesc = pDepthStencil->GetTexture()->GetDesc(); if (m_FramebufferWidth != std::max(TexDesc.Width >> DSVDesc.MostDetailedMip, 1U)) LOG_ERROR("Depth-stencil target width (", std::max(TexDesc.Width >> DSVDesc.MostDetailedMip, 1U), ") specified by DSV '", DSVDesc.Name, "' is inconsistent with the width of previously bound render targets (", m_FramebufferWidth, ")"); @@ -688,7 +688,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::ClearStateCa { for (Uint32 stream = 0; stream < m_NumVertexStreams; ++stream) m_VertexStreams[stream] = VertexStreamInfo<BufferImplType>{}; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (Uint32 stream = m_NumVertexStreams; stream < _countof(m_VertexStreams); ++stream) { VERIFY(m_VertexStreams[stream].pBuffer == nullptr, "Unexpected non-null buffer"); @@ -801,7 +801,7 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>::ResetRenderTargets( { for (Uint32 rt = 0; rt < m_NumBoundRenderTargets; ++rt) m_pBoundRenderTargets[rt].Release(); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (Uint32 rt = m_NumBoundRenderTargets; rt < _countof(m_pBoundRenderTargets); ++rt) { VERIFY(m_pBoundRenderTargets[rt] == nullptr, "Non-null render target found"); @@ -825,7 +825,7 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>::ClearDepthSt return false; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { const auto& ViewDesc = pView->GetDesc(); if (ViewDesc.ViewType != TEXTURE_VIEW_DEPTH_STENCIL) @@ -867,7 +867,7 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>::ClearRenderT return false; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { const auto& ViewDesc = pView->GetDesc(); if (ViewDesc.ViewType != TEXTURE_VIEW_RENDER_TARGET) @@ -957,11 +957,13 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, const void* pData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode) { VERIFY(pBuffer != nullptr, "Buffer must not be null"); -#ifdef DEVELOPMENT - const auto& BuffDesc = ValidatedCast<BufferImplType>(pBuffer)->GetDesc(); - DEV_CHECK_ERR(BuffDesc.Usage == USAGE_DEFAULT, "Unable to update buffer '", BuffDesc.Name, "': only USAGE_DEFAULT buffers can be updated with UpdateData()"); - DEV_CHECK_ERR(Offset < BuffDesc.uiSizeInBytes, "Unable to update buffer '", BuffDesc.Name, "': offset (", Offset, ") exceeds the buffer size (", BuffDesc.uiSizeInBytes, ")"); - DEV_CHECK_ERR(Size + Offset <= BuffDesc.uiSizeInBytes, "Unable to update buffer '", BuffDesc.Name, "': Update region [", Offset, ",", Size + Offset, ") is out of buffer bounds [0,", BuffDesc.uiSizeInBytes, ")"); +#ifdef DILIGENT_DEVELOPMENT + { + const auto& BuffDesc = ValidatedCast<BufferImplType>(pBuffer)->GetDesc(); + DEV_CHECK_ERR(BuffDesc.Usage == USAGE_DEFAULT, "Unable to update buffer '", BuffDesc.Name, "': only USAGE_DEFAULT buffers can be updated with UpdateData()"); + DEV_CHECK_ERR(Offset < BuffDesc.uiSizeInBytes, "Unable to update buffer '", BuffDesc.Name, "': offset (", Offset, ") exceeds the buffer size (", BuffDesc.uiSizeInBytes, ")"); + DEV_CHECK_ERR(Size + Offset <= BuffDesc.uiSizeInBytes, "Unable to update buffer '", BuffDesc.Name, "': Update region [", Offset, ",", Size + Offset, ") is out of buffer bounds [0,", BuffDesc.uiSizeInBytes, ")"); + } #endif } @@ -977,11 +979,13 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: { VERIFY(pSrcBuffer != nullptr, "Source buffer must not be null"); VERIFY(pDstBuffer != nullptr, "Destination buffer must not be null"); -#ifdef DEVELOPMENT - const auto& SrcBufferDesc = ValidatedCast<BufferImplType>(pSrcBuffer)->GetDesc(); - const auto& DstBufferDesc = ValidatedCast<BufferImplType>(pDstBuffer)->GetDesc(); - DEV_CHECK_ERR(DstOffset + Size <= DstBufferDesc.uiSizeInBytes, "Failed to copy buffer '", SrcBufferDesc.Name, "' to '", DstBufferDesc.Name, "': Destination range [", DstOffset, ",", DstOffset + Size, ") is out of buffer bounds [0,", DstBufferDesc.uiSizeInBytes, ")"); - DEV_CHECK_ERR(SrcOffset + Size <= SrcBufferDesc.uiSizeInBytes, "Failed to copy buffer '", SrcBufferDesc.Name, "' to '", DstBufferDesc.Name, "': Source range [", SrcOffset, ",", SrcOffset + Size, ") is out of buffer bounds [0,", SrcBufferDesc.uiSizeInBytes, ")"); +#ifdef DILIGENT_DEVELOPMENT + { + const auto& SrcBufferDesc = ValidatedCast<BufferImplType>(pSrcBuffer)->GetDesc(); + const auto& DstBufferDesc = ValidatedCast<BufferImplType>(pDstBuffer)->GetDesc(); + DEV_CHECK_ERR(DstOffset + Size <= DstBufferDesc.uiSizeInBytes, "Failed to copy buffer '", SrcBufferDesc.Name, "' to '", DstBufferDesc.Name, "': Destination range [", DstOffset, ",", DstOffset + Size, ") is out of buffer bounds [0,", DstBufferDesc.uiSizeInBytes, ")"); + DEV_CHECK_ERR(SrcOffset + Size <= SrcBufferDesc.uiSizeInBytes, "Failed to copy buffer '", SrcBufferDesc.Name, "' to '", DstBufferDesc.Name, "': Source range [", SrcOffset, ",", SrcOffset + Size, ") is out of buffer bounds [0,", SrcBufferDesc.uiSizeInBytes, ")"); + } #endif } @@ -993,9 +997,11 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: const auto& BuffDesc = pBuffer->GetDesc(); -#ifdef _DEBUG - VERIFY(m_DbgMappedBuffers.find(pBuffer) == m_DbgMappedBuffers.end(), "Buffer '", BuffDesc.Name, "' has already been mapped"); - m_DbgMappedBuffers[pBuffer] = DbgMappedBufferInfo{MapType}; +#ifdef DILIGENT_DEBUG + { + VERIFY(m_DbgMappedBuffers.find(pBuffer) == m_DbgMappedBuffers.end(), "Buffer '", BuffDesc.Name, "' has already been mapped"); + m_DbgMappedBuffers[pBuffer] = DbgMappedBufferInfo{MapType}; + } #endif pMappedData = nullptr; @@ -1040,11 +1046,13 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType) { VERIFY(pBuffer, "pBuffer must not be null"); -#ifdef _DEBUG - auto MappedBufferIt = m_DbgMappedBuffers.find(pBuffer); - VERIFY(MappedBufferIt != m_DbgMappedBuffers.end(), "Buffer '", pBuffer->GetDesc().Name, "' has not been mapped."); - VERIFY(MappedBufferIt->second.MapType == MapType, "MapType (", MapType, ") does not match the map type that was used to map the buffer ", MappedBufferIt->second.MapType); - m_DbgMappedBuffers.erase(MappedBufferIt); +#ifdef DILIGENT_DEBUG + { + auto MappedBufferIt = m_DbgMappedBuffers.find(pBuffer); + VERIFY(MappedBufferIt != m_DbgMappedBuffers.end(), "Buffer '", pBuffer->GetDesc().Name, "' has not been mapped."); + VERIFY(MappedBufferIt->second.MapType == MapType, "MapType (", MapType, ") does not match the map type that was used to map the buffer ", MappedBufferIt->second.MapType); + m_DbgMappedBuffers.erase(MappedBufferIt); + } #endif } @@ -1094,12 +1102,14 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>:: GenerateMips(ITextureView* pTexView) { VERIFY(pTexView != nullptr, "pTexView must not be null"); -#ifdef DEVELOPMENT - const auto& ViewDesc = pTexView->GetDesc(); - DEV_CHECK_ERR(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Shader resource view '", ViewDesc.Name, - "' can't be used to generate mipmaps because its type is ", GetTexViewTypeLiteralName(ViewDesc.ViewType), ". Required view type: TEXTURE_VIEW_SHADER_RESOURCE."); - DEV_CHECK_ERR((ViewDesc.Flags & TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION) != 0, "Shader resource view '", ViewDesc.Name, - "' was not created with TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION flag and can't be used to generate mipmaps."); +#ifdef DILIGENT_DEVELOPMENT + { + const auto& ViewDesc = pTexView->GetDesc(); + DEV_CHECK_ERR(ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE, "Shader resource view '", ViewDesc.Name, + "' can't be used to generate mipmaps because its type is ", GetTexViewTypeLiteralName(ViewDesc.ViewType), ". Required view type: TEXTURE_VIEW_SHADER_RESOURCE."); + DEV_CHECK_ERR((ViewDesc.Flags & TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION) != 0, "Shader resource view '", ViewDesc.Name, + "' was not created with TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION flag and can't be used to generate mipmaps."); + } #endif } @@ -1110,7 +1120,7 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>:: ITexture* pDstTexture, const ResolveTextureSubresourceAttribs& ResolveAttribs) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT VERIFY_EXPR(pSrcTexture != nullptr && pDstTexture != nullptr); const auto& SrcTexDesc = pSrcTexture->GetDesc(); const auto& DstTexDesc = pDstTexture->GetDesc(); @@ -1151,7 +1161,7 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>:: #endif } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT template <typename BaseInterface, typename ImplementationTraits> inline bool DeviceContextBase<BaseInterface, ImplementationTraits>:: DvpVerifyDrawArguments(const DrawAttribs& Attribs) const @@ -1522,6 +1532,6 @@ bool DeviceContextBase<BaseInterface, ImplementationTraits>:: return true; } -#endif // DEVELOPMENT +#endif // DILIGENT_DEVELOPMENT } // namespace Diligent diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp index ea00cc90..6d70f4da 100644 --- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp @@ -122,15 +122,17 @@ public: for (Uint32 i = 0; i < SrcLayout.NumStaticSamplers; ++i) { VERIFY(SrcLayout.StaticSamplers[i].SamplerOrTextureName != nullptr, "Static sampler or texture name can't be null"); -#ifdef DEVELOPMENT - const auto& BorderColor = SrcLayout.StaticSamplers[i].Desc.BorderColor; - if (!((BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 0) || - (BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 1) || - (BorderColor[0] == 1 && BorderColor[1] == 1 && BorderColor[2] == 1 && BorderColor[3] == 1))) +#ifdef DILIGENT_DEVELOPMENT { - LOG_WARNING_MESSAGE("Static sampler for variable \"", SrcLayout.StaticSamplers[i].SamplerOrTextureName, "\" specifies border color (", - BorderColor[0], ", ", BorderColor[1], ", ", BorderColor[2], ", ", BorderColor[3], - "). D3D12 static samplers only allow transparent black (0,0,0,0), opaque black (0,0,0,1) or opaque white (1,1,1,1) as border colors"); + const auto& BorderColor = SrcLayout.StaticSamplers[i].Desc.BorderColor; + if (!((BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 0) || + (BorderColor[0] == 0 && BorderColor[1] == 0 && BorderColor[2] == 0 && BorderColor[3] == 1) || + (BorderColor[0] == 1 && BorderColor[1] == 1 && BorderColor[2] == 1 && BorderColor[3] == 1))) + { + LOG_WARNING_MESSAGE("Static sampler for variable \"", SrcLayout.StaticSamplers[i].SamplerOrTextureName, "\" specifies border color (", + BorderColor[0], ", ", BorderColor[1], ", ", BorderColor[2], ", ", BorderColor[3], + "). D3D12 static samplers only allow transparent black (0,0,0,0), opaque black (0,0,0,1) or opaque white (1,1,1,1) as border colors"); + } } #endif diff --git a/Graphics/GraphicsEngine/include/ShaderBase.hpp b/Graphics/GraphicsEngine/include/ShaderBase.hpp index 3aac5a2d..9874206a 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderBase.hpp @@ -53,7 +53,7 @@ inline Int32 GetShaderTypeIndex(SHADER_TYPE Type) Int32 ShaderIndex = PlatformMisc::GetLSB(Type); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG switch (Type) { // clang-format off diff --git a/Graphics/GraphicsEngine/include/TextureBase.hpp b/Graphics/GraphicsEngine/include/TextureBase.hpp index 1cd9fd18..38414be2 100644 --- a/Graphics/GraphicsEngine/include/TextureBase.hpp +++ b/Graphics/GraphicsEngine/include/TextureBase.hpp @@ -84,7 +84,7 @@ public: const TextureDesc& Desc, bool bIsDeviceInternal = false) : TDeviceObjectBase(pRefCounters, pDevice, Desc, bIsDeviceInternal), -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_dbgTexViewObjAllocator(TexViewObjAllocator), #endif m_pDefaultSRV(nullptr, STDDeleter<TTextureViewImpl, TTexViewObjAllocator>(TexViewObjAllocator)), @@ -200,7 +200,7 @@ protected: /// Pure virtual function that creates texture view for the specific engine implementation. virtual void CreateViewInternal(const struct TextureViewDesc& ViewDesc, ITextureView** ppView, bool bIsDefaultView) = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG TTexViewObjAllocator& m_dbgTexViewObjAllocator; #endif // WARNING! We cannot use ITextureView here, because ITextureView has no virtual dtor! diff --git a/Graphics/GraphicsEngine/include/TextureViewBase.hpp b/Graphics/GraphicsEngine/include/TextureViewBase.hpp index f416796f..07552d97 100644 --- a/Graphics/GraphicsEngine/include/TextureViewBase.hpp +++ b/Graphics/GraphicsEngine/include/TextureViewBase.hpp @@ -79,7 +79,7 @@ public: /// Implementation of ITextureView::SetSampler() virtual void DILIGENT_CALL_TYPE SetSampler(ISampler* pSampler) override final { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (this->m_Desc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE) LOG_ERROR("Texture view \"", this->m_Desc.Name, "\": a sampler can be attached to a shader resource view only. The view type is ", GetTexViewTypeLiteralName(this->m_Desc.ViewType)); #endif diff --git a/Graphics/GraphicsEngine/src/Texture.cpp b/Graphics/GraphicsEngine/src/Texture.cpp index 3c9ec721..4cfdbd0b 100644 --- a/Graphics/GraphicsEngine/src/Texture.cpp +++ b/Graphics/GraphicsEngine/src/Texture.cpp @@ -142,7 +142,7 @@ void ValidateTextureRegion(const TextureDesc& TexDesc, Uint32 MipLevel, Uint32 S } \ } while (false) -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT VERIFY_TEX_PARAMS(MipLevel < TexDesc.MipLevels, "Mip level (", MipLevel, ") is out of allowed range [0, ", TexDesc.MipLevels - 1, "]"); VERIFY_TEX_PARAMS(Box.MinX < Box.MaxX, "Invalid X range: ", Box.MinX, "..", Box.MaxX); VERIFY_TEX_PARAMS(Box.MinY < Box.MaxY, "Invalid Y range: ", Box.MinY, "..", Box.MaxY); @@ -208,7 +208,7 @@ void ValidateUpdateTextureParams(const TextureDesc& TexDesc, Uint32 MipLevel, Ui VERIFY((SubresData.pData != nullptr) ^ (SubresData.pSrcBuffer != nullptr), "Either CPU data pointer (pData) or GPU buffer (pSrcBuffer) must not be null, but not both"); ValidateTextureRegion(TexDesc, MipLevel, Slice, DstBox); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT VERIFY_TEX_PARAMS(TexDesc.SampleCount == 1, "Only non-multisampled textures can be updated with UpdateData()"); VERIFY_TEX_PARAMS((SubresData.Stride & 0x03) == 0, "Texture data stride (", SubresData.Stride, ") must be at least 32-bit aligned"); VERIFY_TEX_PARAMS((SubresData.DepthStride & 0x03) == 0, "Texture data depth stride (", SubresData.DepthStride, ") must be at least 32-bit aligned"); diff --git a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp index 987faccc..f8db6f23 100644 --- a/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/DeviceContextD3D11Impl.hpp @@ -39,7 +39,7 @@ #include "QueryD3D11Impl.hpp" #include "DisjointQueryPool.hpp" -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG # define VERIFY_CONTEXT_BINDINGS #endif diff --git a/Graphics/GraphicsEngineD3D11/include/EngineD3D11Defines.h b/Graphics/GraphicsEngineD3D11/include/EngineD3D11Defines.h index b17cf359..0e62e63f 100644 --- a/Graphics/GraphicsEngineD3D11/include/EngineD3D11Defines.h +++ b/Graphics/GraphicsEngineD3D11/include/EngineD3D11Defines.h @@ -27,6 +27,6 @@ #pragma once -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG # define VERIFY_SHADER_BINDINGS #endif diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.hpp b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.hpp index 4c7e2c69..dc70eec1 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.hpp +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceCacheD3D11.hpp @@ -327,7 +327,7 @@ private: Uint8* m_pResourceData = nullptr; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG IMemoryAllocator* m_pdbgMemoryAllocator = nullptr; #endif }; diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.hpp b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.hpp index 6325d3c6..4b4d13b2 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.hpp +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceLayoutD3D11.hpp @@ -259,7 +259,7 @@ public: // while Layout is alive void BindResources(IResourceMapping* pResourceMapping, Uint32 Flags, const ShaderResourceCacheD3D11& dbgResourceCache); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool dvpVerifyBindings() const; #endif diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.hpp b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.hpp index 6fe91203..ce0e0478 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.hpp +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourcesD3D11.hpp @@ -111,7 +111,7 @@ public: __forceinline Int32 GetMaxUAVBindPoint() const { return m_MaxUAVBindPoint; } // clang-format on -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void dvpVerifyCommittedResources(ID3D11Buffer* CommittedD3D11CBs[], ID3D11ShaderResourceView* CommittedD3D11SRVs[], ID3D11Resource* CommittedD3D11SRVResources[], diff --git a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp index f7e8c886..0ff2227d 100755 --- a/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/DeviceContextD3D11Impl.cpp @@ -173,7 +173,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* if (pShaderResourceBinding == nullptr)
{
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
bool ResourcesPresent = false;
for (Uint32 s = 0; s < pPipelineStateD3D11->GetNumShaders(); ++s)
{
@@ -193,7 +193,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* auto pShaderResBindingD3D11 = ValidatedCast<ShaderResourceBindingD3D11Impl>(pShaderResourceBinding);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (pPipelineStateD3D11->IsIncompatibleWith(pShaderResourceBinding->GetPipelineState()))
{
LOG_ERROR_MESSAGE("Shader resource binding does not match Pipeline State");
@@ -204,18 +204,20 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* auto NumShaders = pShaderResBindingD3D11->GetNumActiveShaders();
VERIFY(NumShaders == pPipelineStateD3D11->GetNumShaders(), "Number of active shaders in shader resource binding is not consistent with the number of shaders in the pipeline state");
-#ifdef DEVELOPMENT
- bool StaticResourcesPresent = false;
- for (Uint32 s = 0; s < NumShaders; ++s)
- {
- const auto& StaticResLayout = pPipelineStateD3D11->GetStaticResourceLayout(s);
- if (StaticResLayout.GetTotalResourceCount() > 0)
- StaticResourcesPresent = true;
- }
- // Static resource bindings are verified in BindStaticShaderResources()
- if (StaticResourcesPresent && !pShaderResBindingD3D11->IsStaticResourcesBound())
+#ifdef DILIGENT_DEVELOPMENT
{
- LOG_ERROR_MESSAGE("Static resources have not been initialized in the shader resource binding object being committed for PSO '", pPSO->GetDesc().Name, "'. Please call IShaderResourceBinding::InitializeStaticResources().");
+ bool StaticResourcesPresent = false;
+ for (Uint32 s = 0; s < NumShaders; ++s)
+ {
+ const auto& StaticResLayout = pPipelineStateD3D11->GetStaticResourceLayout(s);
+ if (StaticResLayout.GetTotalResourceCount() > 0)
+ StaticResourcesPresent = true;
+ }
+ // Static resource bindings are verified in BindStaticShaderResources()
+ if (StaticResourcesPresent && !pShaderResBindingD3D11->IsStaticResourcesBound())
+ {
+ LOG_ERROR_MESSAGE("Static resources have not been initialized in the shader resource binding object being committed for PSO '", pPSO->GetDesc().Name, "'. Please call IShaderResourceBinding::InitializeStaticResources().");
+ }
}
#endif
@@ -225,7 +227,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* {
auto ShaderTypeInd = pShaderResBindingD3D11->GetActiveShaderTypeIndex(s);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
auto* pShaderD3D11 = pPipelineStateD3D11->GetShader<ShaderD3D11Impl>(s);
VERIFY_EXPR(ShaderTypeInd == static_cast<Int32>(GetShaderTypeIndex(pShaderD3D11->GetDesc().ShaderType)));
#endif
@@ -274,7 +276,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* }
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (VerifyStates)
{
if (const auto* pTexture = ValidatedCast<TextureBaseD3D11>(UAVRes.pTexture))
@@ -336,7 +338,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* }
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if ((m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE) != 0 && ShaderTypeInd == CSInd)
{
dbgVerifyCommittedUAVs(pShaderD3D11->GetDesc().ShaderType);
@@ -371,7 +373,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* {
auto ShaderTypeInd = pShaderResBindingD3D11->GetActiveShaderTypeIndex(s);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
auto* pShaderD3D11 = pPipelineStateD3D11->GetShader<ShaderD3D11Impl>(s);
VERIFY_EXPR(ShaderTypeInd == static_cast<Int32>(GetShaderTypeIndex(pShaderD3D11->GetDesc().ShaderType)));
#endif
@@ -414,7 +416,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* }
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (VerifyStates)
{
VERIFY_EXPR(CommitResources);
@@ -446,7 +448,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* (m_pd3d11DeviceContext->*SetCBMethod)(MinSlot, MaxSlot - MinSlot + 1, CommittedD3D11CBs + MinSlot);
m_NumCommittedCBs[ShaderTypeInd] = std::max(m_NumCommittedCBs[ShaderTypeInd], static_cast<Uint8>(NumCBs));
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedCBs(pShaderD3D11->GetDesc().ShaderType);
@@ -513,7 +515,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* }
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (VerifyStates)
{
VERIFY_EXPR(CommitResources);
@@ -553,7 +555,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* (m_pd3d11DeviceContext->*SetSRVMethod)(MinSlot, MaxSlot - MinSlot + 1, CommittedD3D11SRVs + MinSlot);
m_NumCommittedSRVs[ShaderTypeInd] = std::max(m_NumCommittedSRVs[ShaderTypeInd], static_cast<Uint8>(NumSRVs));
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedSRVs(pShaderD3D11->GetDesc().ShaderType);
@@ -593,7 +595,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* (m_pd3d11DeviceContext->*SetSamplerMethod)(MinSlot, MaxSlot - MinSlot + 1, CommittedD3D11Samplers + MinSlot);
m_NumCommittedSamplers[ShaderTypeInd] = std::max(m_NumCommittedSamplers[ShaderTypeInd], static_cast<Uint8>(NumSamplers));
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedSamplers(pShaderD3D11->GetDesc().ShaderType);
@@ -604,7 +606,7 @@ void DeviceContextD3D11Impl::TransitionAndCommitShaderResources(IPipelineState* -#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (CommitResources && (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_SHADER_RESOURCES) != 0)
{
// Use full resource layout to verify that all required resources are committed
@@ -751,7 +753,7 @@ void DeviceContextD3D11Impl::CommitD3D11VertexBuffers(PipelineStateD3D11Impl* pP void DeviceContextD3D11Impl::PrepareForDraw(DRAW_FLAGS Flags)
{
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if ((Flags & DRAW_FLAG_VERIFY_RENDER_TARGETS) != 0)
DvpVerifyRenderTargets();
#endif
@@ -763,7 +765,7 @@ void DeviceContextD3D11Impl::PrepareForDraw(DRAW_FLAGS Flags) CommitD3D11VertexBuffers(m_pPipelineState);
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if ((Flags & DRAW_FLAG_VERIFY_STATES) != 0)
{
for (UINT Slot = 0; Slot < m_NumVertexStreams; ++Slot)
@@ -801,7 +803,7 @@ void DeviceContextD3D11Impl::PrepareForIndexedDraw(DRAW_FLAGS Flags, VALUE_TYPE {
CommitD3D11IndexBuffer(IndexType);
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (Flags & DRAW_FLAG_VERIFY_STATES)
{
if (m_pIndexBuffer->IsInKnownState() && m_pIndexBuffer->CheckState(RESOURCE_STATE_UNORDERED_ACCESS))
@@ -873,7 +875,7 @@ void DeviceContextD3D11Impl::DispatchCompute(const DispatchComputeAttribs& Attri if (!DvpVerifyDispatchArguments(Attribs))
return;
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
// Verify bindings
@@ -893,7 +895,7 @@ void DeviceContextD3D11Impl::DispatchComputeIndirect(const DispatchComputeIndire if (!DvpVerifyDispatchIndirectArguments(Attribs, pAttribsBuffer))
return;
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
// Verify bindings
@@ -1178,7 +1180,7 @@ void DeviceContextD3D11Impl::SetVertexBuffers(Uint32 Sta pBuffD3D11Impl->ClearState(RESOURCE_STATE_UNORDERED_ACCESS);
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY)
{
if (pBuffD3D11Impl->IsInKnownState() && pBuffD3D11Impl->CheckState(RESOURCE_STATE_UNORDERED_ACCESS))
@@ -1208,7 +1210,7 @@ void DeviceContextD3D11Impl::SetIndexBuffer(IBuffer* pIndexBuffer, Uint32 ByteOf m_pIndexBuffer->ClearState(RESOURCE_STATE_UNORDERED_ACCESS);
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY)
{
if (m_pIndexBuffer->IsInKnownState() && m_pIndexBuffer->CheckState(RESOURCE_STATE_UNORDERED_ACCESS))
@@ -1444,7 +1446,7 @@ void DeviceContextD3D11Impl::UnbindBufferFromInput(BufferD3D11Impl* pBuffer, ID3 m_bCommittedD3D11IBUpToDate = false;
m_pd3d11DeviceContext->IASetIndexBuffer(nullptr, DXGI_FORMAT_R32_UINT, m_CommittedD3D11IndexDataStartOffset);
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedIndexBuffer();
@@ -1472,7 +1474,7 @@ void DeviceContextD3D11Impl::UnbindBufferFromInput(BufferD3D11Impl* pBuffer, ID3 m_pd3d11DeviceContext->IASetVertexBuffers(Slot, _countof(ppNullBuffer), ppNullBuffer, Zero, Zero);
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedVertexBuffers();
@@ -1498,7 +1500,7 @@ void DeviceContextD3D11Impl::UnbindBufferFromInput(BufferD3D11Impl* pBuffer, ID3 }
}
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedCBs();
@@ -1582,7 +1584,7 @@ void DeviceContextD3D11Impl::SetRenderTargets(Uint32 Num if (pTex->IsInKnownState())
pTex->SetState(RESOURCE_STATE_RENDER_TARGET);
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY)
{
DvpVerifyTextureState(*pTex, RESOURCE_STATE_RENDER_TARGET, "Setting render targets (DeviceContextD3D11Impl::SetRenderTargets)");
@@ -1600,7 +1602,7 @@ void DeviceContextD3D11Impl::SetRenderTargets(Uint32 Num if (pTex->IsInKnownState())
pTex->SetState(RESOURCE_STATE_DEPTH_WRITE);
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY)
{
DvpVerifyTextureState(*pTex, RESOURCE_STATE_DEPTH_WRITE, "Setting depth-stencil buffer (DeviceContextD3D11Impl::SetRenderTargets)");
@@ -1684,7 +1686,7 @@ void DeviceContextD3D11Impl::ReleaseCommittedShaderResources() m_NumCommittedUAVs[ShaderType] = 0;
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
dbgVerifyCommittedSRVs();
@@ -1717,7 +1719,7 @@ void DeviceContextD3D11Impl::FinishCommandList(ICommandList** ppCommandList) // Device context is now in default state
InvalidateState();
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
// Verify bindings
@@ -1754,7 +1756,7 @@ void DeviceContextD3D11Impl::ExecuteCommandList(ICommandList* pCommandList) // Device context is now in default state
InvalidateState();
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (m_DebugFlags & D3D11_DEBUG_FLAG_VERIFY_COMMITTED_RESOURCE_RELEVANCE)
{
// Verify bindings
@@ -1945,7 +1947,7 @@ void DeviceContextD3D11Impl::TransitionResourceStates(Uint32 BarrierCount, State for (Uint32 i = 0; i < BarrierCount; ++i)
{
const auto& Barrier = pResourceBarriers[i];
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
DvpVerifyStateTransitionDesc(Barrier);
#endif
DEV_CHECK_ERR((Barrier.pTexture != nullptr) ^ (Barrier.pBuffer != nullptr), "Exactly one of pTexture or pBuffer must not be null");
diff --git a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp index 6dd980a6..d82f0668 100644 --- a/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/EngineFactoryD3D11.cpp @@ -77,7 +77,7 @@ public: }; -#if defined(_DEBUG) +#if defined(DILIGENT_DEVELOPMENT) // Check for SDK Layer support. inline bool SdkLayersAvailable() { @@ -130,7 +130,7 @@ void EngineFactoryD3D11Impl::CreateDeviceAndContextsD3D11(const EngineD3D11Creat // D3D11_CREATE_DEVICE_BGRA_SUPPORT; UINT creationFlags = 0; -#if defined(DEVELOPMENT) +#if defined(DILIGENT_DEVELOPMENT) if ((EngineCI.DebugFlags & D3D11_DEBUG_FLAG_CREATE_DEBUG_DEVICE) != 0 && SdkLayersAvailable()) { // If the project is in a debug build, enable debugging via SDK Layers with this flag. diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index f155c4fd..984a34a6 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -131,7 +131,7 @@ PipelineStateD3D11Impl::PipelineStateD3D11Impl(IReferenceCounters* pRefCoun const auto& ResourceLayout = m_Desc.ResourceLayout; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { const ShaderResources* pResources[MAX_SHADERS_IN_PIPELINE] = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp index 7af06af3..12875694 100644 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceBindingD3D11Impl.cpp @@ -154,7 +154,7 @@ void ShaderResourceBindingD3D11Impl::InitializeStaticResources(const IPipelineSt { const auto& StaticResLayout = pPSOD3D11->GetStaticResourceLayout(shader); auto* pShaderD3D11 = ValidatedCast<ShaderD3D11Impl>(ppShaders[shader]); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!StaticResLayout.dvpVerifyBindings()) { LOG_ERROR_MESSAGE("Static resources in SRB of PSO '", pPSOD3D11->GetDesc().Name, @@ -165,10 +165,12 @@ void ShaderResourceBindingD3D11Impl::InitializeStaticResources(const IPipelineSt } #endif -#ifdef _DEBUG - auto ShaderTypeInd = GetShaderTypeIndex(pShaderD3D11->GetDesc().ShaderType); - auto ResourceLayoutInd = m_ResourceLayoutIndex[ShaderTypeInd]; - VERIFY_EXPR(ResourceLayoutInd == static_cast<Int8>(shader)); +#ifdef DILIGENT_DEBUG + { + auto ShaderTypeInd = GetShaderTypeIndex(pShaderD3D11->GetDesc().ShaderType); + auto ResourceLayoutInd = m_ResourceLayoutIndex[ShaderTypeInd]; + VERIFY_EXPR(ResourceLayoutInd == static_cast<Int8>(shader)); + } #endif StaticResLayout.CopyResources(m_pBoundResourceCaches[shader]); pPSOD3D11->SetStaticSamplers(m_pBoundResourceCaches[shader], shader); diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp index 2286d65e..28086285 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceCacheD3D11.cpp @@ -99,7 +99,7 @@ void ShaderResourceCacheD3D11::Initialize(Uint32 CBCount, Uint32 SRVCount, Uint3 (sizeof(CachedResource) + sizeof(ID3D11UnorderedAccessView*)) * UAVCount );
// clang-format on
-#ifdef _DEBUG
+#ifdef DILIGENT_DEBUG
m_pdbgMemoryAllocator = &MemAllocator;
#endif
if (BufferSize > 0)
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index 741b5692..fd6c7299 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -239,7 +239,7 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& if (!SamplerFound)
{
AssignedSamplerIndex = TexSRVBindInfo::InvalidSamplerIndex;
-#ifdef _DEBUG
+#ifdef DILIGENT_DEBUG
// Shader error will be logged by the PipelineStateD3D11Impl
constexpr bool LogStaticSamplerArrayError = false;
if (m_pResources->FindStaticSampler(AssignedSamplerAttribs, ResourceLayout, LogStaticSamplerArrayError) < 0)
@@ -250,7 +250,7 @@ ShaderResourceLayoutD3D11::ShaderResourceLayoutD3D11(IObject& }
else
{
-#ifdef _DEBUG
+#ifdef DILIGENT_DEBUG
// Shader error will be logged by the PipelineStateD3D11Impl
constexpr bool LogStaticSamplerArrayError = false;
if (m_pResources->FindStaticSampler(AssignedSamplerAttribs, ResourceLayout, LogStaticSamplerArrayError) >= 0)
@@ -430,7 +430,7 @@ void ShaderResourceLayoutD3D11::ConstBuffBindInfo::BindResource(IDeviceObject* p // We cannot use ValidatedCast<> here as the resource retrieved from the
// resource mapping can be of wrong type
RefCntAutoPtr<BufferD3D11Impl> pBuffD3D11Impl(pBuffer, IID_BufferD3D11);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
{
auto& CachedCB = m_ParentResLayout.m_ResourceCache.GetCB(m_Attribs.BindPoint + ArrayIndex);
VerifyConstantBufferBinding(m_Attribs, GetType(), ArrayIndex, pBuffer, pBuffD3D11Impl.RawPtr(), CachedCB.pBuff.RawPtr(), m_ParentResLayout.GetShaderName());
@@ -449,7 +449,7 @@ void ShaderResourceLayoutD3D11::TexSRVBindInfo::BindResource(IDeviceObject* pVie // We cannot use ValidatedCast<> here as the resource retrieved from the
// resource mapping can be of wrong type
RefCntAutoPtr<TextureViewD3D11Impl> pViewD3D11(pView, IID_TextureViewD3D11);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
{
auto& CachedSRV = ResourceCache.GetSRV(m_Attribs.BindPoint + ArrayIndex);
VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {TEXTURE_VIEW_SHADER_RESOURCE}, CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName());
@@ -467,7 +467,7 @@ void ShaderResourceLayoutD3D11::TexSRVBindInfo::BindResource(IDeviceObject* pVie if (pViewD3D11)
{
pSamplerD3D11Impl = ValidatedCast<SamplerD3D11Impl>(pViewD3D11->GetSampler());
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (pSamplerD3D11Impl == nullptr)
{
if (Sampler.m_Attribs.BindCount > 1)
@@ -477,7 +477,7 @@ void ShaderResourceLayoutD3D11::TexSRVBindInfo::BindResource(IDeviceObject* pVie }
#endif
}
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (Sampler.GetType() != SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC)
{
auto& CachedSampler = ResourceCache.GetSampler(SamplerBindPoint);
@@ -507,7 +507,7 @@ void ShaderResourceLayoutD3D11::SamplerBindInfo::BindResource(IDeviceObject* pSa // resource mapping can be of wrong type
RefCntAutoPtr<SamplerD3D11Impl> pSamplerD3D11(pSampler, IID_SamplerD3D11);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
if (pSampler && !pSamplerD3D11)
{
LOG_ERROR_MESSAGE("Failed to bind object '", pSampler->GetDesc().Name, "' to variable '", m_Attribs.GetPrintName(ArrayIndex),
@@ -549,7 +549,7 @@ void ShaderResourceLayoutD3D11::BuffSRVBindInfo::BindResource(IDeviceObject* pVi // We cannot use ValidatedCast<> here as the resource retrieved from the
// resource mapping can be of wrong type
RefCntAutoPtr<BufferViewD3D11Impl> pViewD3D11(pView, IID_BufferViewD3D11);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
{
auto& CachedSRV = ResourceCache.GetSRV(m_Attribs.BindPoint + ArrayIndex);
VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_SHADER_RESOURCE}, CachedSRV.pView.RawPtr(), m_ParentResLayout.GetShaderName());
@@ -569,7 +569,7 @@ void ShaderResourceLayoutD3D11::TexUAVBindInfo::BindResource(IDeviceObject* pVie // We cannot use ValidatedCast<> here as the resource retrieved from the
// resource mapping can be of wrong type
RefCntAutoPtr<TextureViewD3D11Impl> pViewD3D11(pView, IID_TextureViewD3D11);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
{
auto& CachedUAV = ResourceCache.GetUAV(m_Attribs.BindPoint + ArrayIndex);
VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {TEXTURE_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName());
@@ -589,7 +589,7 @@ void ShaderResourceLayoutD3D11::BuffUAVBindInfo::BindResource(IDeviceObject* pVi // We cannot use ValidatedCast<> here as the resource retrieved from the
// resource mapping can be of wrong type
RefCntAutoPtr<BufferViewD3D11Impl> pViewD3D11(pView, IID_BufferViewD3D11);
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
{
auto& CachedUAV = ResourceCache.GetUAV(m_Attribs.BindPoint + ArrayIndex);
VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewD3D11.RawPtr(), {BUFFER_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr(), m_ParentResLayout.GetShaderName());
@@ -752,10 +752,12 @@ public: template <typename ResourceType>
bool TryResource(ShaderResourceLayoutD3D11::OffsetType NextResourceTypeOffset)
{
-#ifdef _DEBUG
- VERIFY(Layout.GetResourceOffset<ResourceType>() >= dbgPreviousResourceOffset, "Resource types are processed out of order!");
- dbgPreviousResourceOffset = Layout.GetResourceOffset<ResourceType>();
- VERIFY_EXPR(NextResourceTypeOffset >= Layout.GetResourceOffset<ResourceType>());
+#ifdef DILIGENT_DEBUG
+ {
+ VERIFY(Layout.GetResourceOffset<ResourceType>() >= dbgPreviousResourceOffset, "Resource types are processed out of order!");
+ dbgPreviousResourceOffset = Layout.GetResourceOffset<ResourceType>();
+ VERIFY_EXPR(NextResourceTypeOffset >= Layout.GetResourceOffset<ResourceType>());
+ }
#endif
if (VarOffset < NextResourceTypeOffset)
{
@@ -777,7 +779,7 @@ private: const ShaderResourceLayoutD3D11& Layout;
const size_t VarOffset;
Uint32 Index = 0;
-#ifdef _DEBUG
+#ifdef DILIGENT_DEBUG
Uint32 dbgPreviousResourceOffset = 0;
#endif
};
@@ -830,9 +832,11 @@ public: template <typename ResourceType>
IShaderResourceVariable* TryResource()
{
-#ifdef _DEBUG
- VERIFY(Layout.GetResourceOffset<ResourceType>() >= dbgPreviousResourceOffset, "Resource types are processed out of order!");
- dbgPreviousResourceOffset = Layout.GetResourceOffset<ResourceType>();
+#ifdef DILIGENT_DEBUG
+ {
+ VERIFY(Layout.GetResourceOffset<ResourceType>() >= dbgPreviousResourceOffset, "Resource types are processed out of order!");
+ dbgPreviousResourceOffset = Layout.GetResourceOffset<ResourceType>();
+ }
#endif
auto NumResources = Layout.GetNumResources<ResourceType>();
if (Index < NumResources)
@@ -847,7 +851,7 @@ public: private:
ShaderResourceLayoutD3D11& Layout;
Uint32 Index = 0;
-#ifdef _DEBUG
+#ifdef DILIGENT_DEBUG
Uint32 dbgPreviousResourceOffset = 0;
#endif
};
@@ -883,7 +887,7 @@ IShaderResourceVariable* ShaderResourceLayoutD3D11::GetShaderVariable(Uint32 Ind }
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
bool ShaderResourceLayoutD3D11::dvpVerifyBindings() const
{
diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index e39830aa..769c91e2 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -118,7 +118,7 @@ ShaderResourcesD3D11::~ShaderResourcesD3D11() }
-#ifdef DEVELOPMENT
+#ifdef DILIGENT_DEVELOPMENT
static String DbgMakeResourceName(const D3DShaderResourceAttribs& Attr, Uint32 BindPoint)
{
VERIFY(BindPoint >= Uint32{Attr.BindPoint} && BindPoint < Uint32{Attr.BindPoint} + Attr.BindCount, "Bind point is out of allowed range");
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp index e15e70f2..ab90dfe7 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp @@ -65,7 +65,7 @@ public: virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void DvpVerifyDynamicAllocation(class DeviceContextD3D12Impl* pCtx) const; #endif @@ -92,7 +92,7 @@ public: { if (m_Desc.Usage == USAGE_DYNAMIC) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DvpVerifyDynamicAllocation(pCtx); #endif return m_DynamicData[ContextId].GPUAddress; diff --git a/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp b/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp index 30134445..a8211db6 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp +++ b/Graphics/GraphicsEngineD3D12/include/CommandContext.hpp @@ -413,7 +413,7 @@ inline ComputeContext& CommandContext::AsComputeContext() inline void CommandContext::SetDescriptorHeaps(ShaderDescriptorHeaps& Heaps) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG VERIFY(Heaps.pSrvCbvUavHeap != nullptr || Heaps.pSamplerHeap != nullptr, "At least one heap is expected to be set"); VERIFY(Heaps.pSrvCbvUavHeap == nullptr || Heaps.pSrvCbvUavHeap->GetDesc().Type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, "Invalid heap type provided in pSrvCbvUavHeap"); VERIFY(Heaps.pSamplerHeap == nullptr || Heaps.pSamplerHeap->GetDesc().Type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, "Invalid heap type provided in pSamplerHeap"); diff --git a/Graphics/GraphicsEngineD3D12/include/CommandListManager.hpp b/Graphics/GraphicsEngineD3D12/include/CommandListManager.hpp index 6548a637..b9fe244c 100644 --- a/Graphics/GraphicsEngineD3D12/include/CommandListManager.hpp +++ b/Graphics/GraphicsEngineD3D12/include/CommandListManager.hpp @@ -58,7 +58,7 @@ public: // allocator void FreeAllocator(CComPtr<ID3D12CommandAllocator>&& Allocator); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::Long GetAllocatorCounter() const { return m_AllocatorCounter; @@ -73,7 +73,7 @@ private: Atomics::AtomicLong m_NumAllocators = 0; // For debug purposes only -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicLong m_AllocatorCounter = 0; #endif }; diff --git a/Graphics/GraphicsEngineD3D12/include/D3D12DynamicHeap.hpp b/Graphics/GraphicsEngineD3D12/include/D3D12DynamicHeap.hpp index cc0b1a9e..636ae0a5 100644 --- a/Graphics/GraphicsEngineD3D12/include/D3D12DynamicHeap.hpp +++ b/Graphics/GraphicsEngineD3D12/include/D3D12DynamicHeap.hpp @@ -45,7 +45,7 @@ struct D3D12DynamicAllocation Uint64 _Size, void* _CPUAddress, D3D12_GPU_VIRTUAL_ADDRESS _GPUAddress -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , Uint64 _DvpCtxFrameNumber #endif @@ -56,7 +56,7 @@ struct D3D12DynamicAllocation Size {_Size }, CPUAddress {_CPUAddress }, GPUAddress {_GPUAddress } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , DvpCtxFrameNumber(_DvpCtxFrameNumber) #endif // clang-format on @@ -67,7 +67,7 @@ struct D3D12DynamicAllocation Uint64 Size = 0; // Reserved size of this allocation void* CPUAddress = nullptr; // The CPU-writeable address D3D12_GPU_VIRTUAL_ADDRESS GPUAddress = 0; // The GPU-visible address -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Uint64 DvpCtxFrameNumber = static_cast<Uint64>(-1); #endif }; @@ -141,7 +141,7 @@ public: D3D12DynamicPage AllocatePage(Uint64 SizeInBytes); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t GetAllocatedPageCounter() const { return m_AllocatedPageCounter; @@ -155,7 +155,7 @@ private: using AvailablePagesMapElemType = std::pair<const Uint64, D3D12DynamicPage>; std::multimap<Uint64, D3D12DynamicPage, std::less<Uint64>, STDAllocatorRawMem<AvailablePagesMapElemType>> m_AvailablePages; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_AllocatedPageCounter = 0; #endif }; diff --git a/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp b/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp index f1267e59..7a96bdc2 100644 --- a/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp +++ b/Graphics/GraphicsEngineD3D12/include/DescriptorHeap.hpp @@ -273,7 +273,7 @@ public: rhs.m_FirstCPUHandle.ptr = 0; rhs.m_FirstGPUHandle.ptr = 0; rhs.m_MaxAllocatedSize = 0; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_AllocationsCounter.store(rhs.m_AllocationsCounter.load()); rhs.m_AllocationsCounter = 0; #endif @@ -298,7 +298,7 @@ public: size_t GetMaxAllocatedSize() const { return m_MaxAllocatedSize; } // clang-format on -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t DvpGetAllocationsCounter() const { return m_AllocationsCounter; @@ -337,7 +337,7 @@ private: size_t m_MaxAllocatedSize = 0; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_AllocationsCounter = 0; #endif @@ -384,7 +384,7 @@ public: virtual void Free(DescriptorHeapAllocation&& Allocation, Uint64 CmdQueueMask) override final; virtual Uint32 GetDescriptorSize() const override final { return m_DescriptorSize; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t DvpGetTotalAllocationCount(); #endif @@ -483,7 +483,7 @@ public: Uint32 GetMaxStaticDescriptors() const { return m_HeapAllocationManager.GetMaxDescriptors(); } Uint32 GetMaxDynamicDescriptors() const { return m_DynamicAllocationsManager.GetMaxDescriptors(); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t DvpGetTotalAllocationCount() const { return m_HeapAllocationManager.DvpGetAllocationsCounter() + diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp index 9790aa7c..d2ce5e0b 100644 --- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp @@ -161,7 +161,7 @@ private: std::mutex m_ContextPoolMutex; std::vector<PooledCommandContext, STDAllocatorRawMem<PooledCommandContext>> m_ContextPool; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicLong m_AllocatedCtxCounter = 0; #endif diff --git a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp index e723896a..cc7ae67f 100644 --- a/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp +++ b/Graphics/GraphicsEngineD3D12/include/RootSignature.hpp @@ -99,7 +99,7 @@ public: m_RootParam.ShaderVisibility = Visibility; m_RootParam.DescriptorTable.NumDescriptorRanges = NumRanges; m_RootParam.DescriptorTable.pDescriptorRanges = pRanges; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (Uint32 r = 0; r < NumRanges; ++r) pRanges[r].RangeType = static_cast<D3D12_DESCRIPTOR_RANGE_TYPE>(-1); #endif @@ -133,7 +133,7 @@ public: DstTbl.pDescriptorRanges = pRanges; const auto& SrcTbl = RP.m_RootParam.DescriptorTable; memcpy(pRanges, SrcTbl.pDescriptorRanges, SrcTbl.NumDescriptorRanges * sizeof(D3D12_DESCRIPTOR_RANGE)); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { Uint32 dbgTableSize = 0; for (Uint32 r = 0; r < SrcTbl.NumDescriptorRanges; ++r) @@ -375,11 +375,11 @@ public: } private: -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void dbgVerifyRootParameters() const; #endif -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT static void DvpVerifyResourceState(const ShaderResourceCacheD3D12::Resource& Res, D3D12_DESCRIPTOR_RANGE_TYPE RangeType); #endif @@ -533,7 +533,7 @@ void RootSignature::CommitRootViews(ShaderResourceCacheD3D12& ResourceCache, auto RootInd = RootView.GetRootIndex(); SHADER_TYPE dbgShaderType = SHADER_TYPE_UNKNOWN; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { auto& Param = static_cast<const D3D12_ROOT_PARAMETER&>(RootView); VERIFY_EXPR(Param.ParameterType == D3D12_ROOT_PARAMETER_TYPE_CBV); @@ -549,7 +549,7 @@ void RootSignature::CommitRootViews(ShaderResourceCacheD3D12& ResourceCache, { if (IsDynamic) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (pBuffToTransition->IsInKnownState()) { VERIFY(pBuffToTransition->CheckState(RESOURCE_STATE_CONSTANT_BUFFER), @@ -566,7 +566,7 @@ void RootSignature::CommitRootViews(ShaderResourceCacheD3D12& ResourceCache, CmdCtx.TransitionResource(pBuffToTransition, RESOURCE_STATE_CONSTANT_BUFFER); } } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (ValidateStates) { diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp index 240366c5..09854e17 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceBindingD3D12Impl.hpp @@ -67,7 +67,7 @@ public: ShaderResourceCacheD3D12& GetResourceCache() { return m_ShaderResourceCache; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void dvpVerifyResourceBindings(const PipelineStateD3D12Impl* pPSO) const; #endif diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp index 9f24d2d4..1a0362ab 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceCacheD3D12.hpp @@ -112,7 +112,7 @@ public: ShaderResourceCacheD3D12(DbgCacheContentType dbgContentType) // clang-format off -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG : m_DbgContentType { dbgContentType @@ -183,7 +183,7 @@ public: // Offset from the start of the descriptor heap allocation to the start of the table Uint32 m_TableStartOffset = InvalidDescriptorOffset; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void SetDebugAttribs(Uint32 MaxOffset, const D3D12_DESCRIPTOR_HEAP_TYPE dbgDescriptorHeapType, const SHADER_TYPE dbgRefShaderType) @@ -199,7 +199,7 @@ public: const Uint32 m_NumResources = 0; private: -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG D3D12_DESCRIPTOR_HEAP_TYPE m_dbgHeapType = D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; SHADER_TYPE m_dbgShaderType = SHADER_TYPE_UNKNOWN; #endif @@ -223,7 +223,7 @@ public: void SetDescriptorHeapSpace(DescriptorHeapAllocation&& CbcSrvUavHeapSpace, DescriptorHeapAllocation&& SamplerHeapSpace) { VERIFY(m_SamplerHeapSpace.GetCpuHandle().ptr == 0 && m_CbvSrvUavHeapSpace.GetCpuHandle().ptr == 0, "Space has already been allocated in GPU descriptor heaps"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG Uint32 NumSamplerDescriptors = 0, NumSrvCbvUavDescriptors = 0; for (Uint32 rt = 0; rt < m_NumTables; ++rt) { @@ -319,7 +319,7 @@ public: // Returns the number of dynamic constant buffers bound in the cache regardless of their variable types Uint32 GetNumDynamicCBsBound() const { return m_NumDynamicCBsBound; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // Only for debug purposes: indicates what types of resources are stored in the cache DbgCacheContentType DbgGetContentType() const { return m_DbgContentType; } void DbgVerifyBoundDynamicCBsCounter() const; @@ -345,7 +345,7 @@ private: // The number of the dynamic buffers bound in the resource cache regardless of their variable type Uint32 m_NumDynamicCBsBound = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // Only for debug purposes: indicates what types of resources are stored in the cache const DbgCacheContentType m_DbgContentType; #endif diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp index 56889271..19c8afb7 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderResourceLayoutD3D12.hpp @@ -239,7 +239,7 @@ public: const ShaderResourceLayoutD3D12& DstLayout, ShaderResourceCacheD3D12& DstCache) const; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool dvpVerifyBindings(const ShaderResourceCacheD3D12& ResourceCache) const; #endif diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp index deadc6d6..213748d9 100644 --- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp +++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp @@ -119,7 +119,7 @@ private: ShaderVariableD3D12Impl* m_pVariables = nullptr; Uint32 m_NumVariables = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG IMemoryAllocator& m_DbgAllocator; #endif // clang-format on diff --git a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp index b1c4c8e8..a6e4a0c8 100644 --- a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp @@ -388,7 +388,7 @@ ID3D12Resource* BufferD3D12Impl::GetD3D12Buffer(Uint64& DataStartByteOffset, IDe { VERIFY(m_Desc.Usage == USAGE_DYNAMIC, "Dynamic buffer is expected"); auto* pCtxD3D12 = ValidatedCast<DeviceContextD3D12Impl>(pContext); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DvpVerifyDynamicAllocation(pCtxD3D12); #endif auto ContextId = pCtxD3D12->GetContextId(); @@ -397,7 +397,7 @@ ID3D12Resource* BufferD3D12Impl::GetD3D12Buffer(Uint64& DataStartByteOffset, IDe } } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void BufferD3D12Impl::DvpVerifyDynamicAllocation(DeviceContextD3D12Impl* pCtx) const { auto ContextId = pCtx->GetContextId(); diff --git a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp index 253d2822..dded6b29 100644 --- a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp +++ b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp @@ -167,7 +167,7 @@ void CommandContext::TransitionResource(const StateTransitionDesc& Barrier) pd3d12Resource = pBufferD3D12Impl->GetD3D12Resource(); OldState = pBufferD3D12Impl->GetState(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT // Dynamic buffers wtih no SRV/UAV bind flags are suballocated in // the upload heap when Map() is called and must always be in // D3D12_RESOURCE_STATE_GENERIC_READ state diff --git a/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp b/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp index 53827add..f1099ac7 100644 --- a/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp +++ b/Graphics/GraphicsEngineD3D12/src/CommandListManager.cpp @@ -81,7 +81,7 @@ void CommandListManager::RequestAllocator(ID3D12CommandAllocator** ppAllocator) swprintf(AllocatorName, _countof(AllocatorName), L"Cmd list allocator %ld", Atomics::AtomicIncrement(m_NumAllocators) - 1); (*ppAllocator)->SetName(AllocatorName); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicIncrement(m_AllocatorCounter); #endif } @@ -125,7 +125,7 @@ void CommandListManager::FreeAllocator(CComPtr<ID3D12CommandAllocator>&& Allocat { std::lock_guard<std::mutex> LockGuard(m_AllocatorMutex); m_FreeAllocators.emplace_back(std::move(Allocator)); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicDecrement(m_AllocatorCounter); #endif } diff --git a/Graphics/GraphicsEngineD3D12/src/D3D12DynamicHeap.cpp b/Graphics/GraphicsEngineD3D12/src/D3D12DynamicHeap.cpp index 2c010f84..98fb5ada 100644 --- a/Graphics/GraphicsEngineD3D12/src/D3D12DynamicHeap.cpp +++ b/Graphics/GraphicsEngineD3D12/src/D3D12DynamicHeap.cpp @@ -92,7 +92,7 @@ D3D12DynamicMemoryManager::D3D12DynamicMemoryManager(IMemoryAllocator& Allo D3D12DynamicPage D3D12DynamicMemoryManager::AllocatePage(Uint64 SizeInBytes) { std::lock_guard<std::mutex> AvailablePagesLock(m_AvailablePagesMtx); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_AllocatedPageCounter; #endif auto PageIt = m_AvailablePages.lower_bound(SizeInBytes); // Returns an iterator pointing to the first element that is not less than key @@ -140,7 +140,7 @@ void D3D12DynamicMemoryManager::ReleasePages(std::vector<D3D12DynamicPage>& Page if (Mgr != nullptr) { std::lock_guard<std::mutex> Lock{Mgr->m_AvailablePagesMtx}; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --Mgr->m_AllocatedPageCounter; #endif auto PageSize = Page.GetSize(); @@ -238,7 +238,7 @@ D3D12DynamicAllocation D3D12DynamicHeap::Allocate(Uint64 SizeInBytes, Uint64 Ali SizeInBytes, CurrPage.GetCPUAddress(AlignedOffset), CurrPage.GetGPUAddress(AlignedOffset) -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , DvpCtxFrameNumber #endif }; diff --git a/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp b/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp index be598856..48345745 100644 --- a/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DescriptorHeap.cpp @@ -122,7 +122,7 @@ DescriptorHeapAllocation DescriptorHeapAllocationManager::Allocate(uint32_t Coun m_MaxAllocatedSize = std::max(m_MaxAllocatedSize, m_FreeBlockManager.GetUsedSize()); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_AllocationsCounter; #endif @@ -144,7 +144,7 @@ void DescriptorHeapAllocationManager::FreeAllocation(DescriptorHeapAllocation&& // Clear the allocation Allocation.Reset(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --m_AllocationsCounter; #endif } @@ -196,7 +196,7 @@ CPUDescriptorHeap::~CPUDescriptorHeap() " (", std::fixed, std::setprecision(2), m_MaxSize * 100.0 / std::max(TotalDescriptors, 1u), "%)."); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t CPUDescriptorHeap::DvpGetTotalAllocationCount() { int32_t AllocationCount = 0; diff --git a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp index 582b8cad..f118bc98 100644 --- a/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/DeviceContextD3D12Impl.cpp @@ -317,7 +317,7 @@ void DeviceContextD3D12Impl::CommitD3D12IndexBuffer(GraphicsContext& GraphCtx, V //GraphicsCtx.AddReferencedObject(pd3d12Resource); bool IsDynamic = m_pIndexBuffer->GetDesc().Usage == USAGE_DYNAMIC; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (IsDynamic) m_pIndexBuffer->DvpVerifyDynamicAllocation(this); #endif @@ -359,7 +359,7 @@ void DeviceContextD3D12Impl::CommitD3D12VertexBuffers(GraphicsContext& GraphCtx) if (pBufferD3D12->GetDesc().Usage == USAGE_DYNAMIC) { DynamicBufferPresent = true; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT pBufferD3D12->DvpVerifyDynamicAllocation(this); #endif } @@ -390,7 +390,7 @@ void DeviceContextD3D12Impl::CommitD3D12VertexBuffers(GraphicsContext& GraphCtx) void DeviceContextD3D12Impl::PrepareForDraw(GraphicsContext& GraphCtx, DRAW_FLAGS Flags) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_RENDER_TARGETS) != 0) DvpVerifyRenderTargets(); #endif @@ -400,7 +400,7 @@ void DeviceContextD3D12Impl::PrepareForDraw(GraphicsContext& GraphCtx, DRAW_FLAG CommitD3D12VertexBuffers(GraphCtx); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_STATES) != 0) { for (Uint32 Buff = 0; Buff < m_NumVertexStreams; ++Buff) @@ -440,7 +440,7 @@ void DeviceContextD3D12Impl::PrepareForDraw(GraphicsContext& GraphCtx, DRAW_FLAG } } } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else { if (m_pPipelineState->ContainsShaderResources()) @@ -458,7 +458,7 @@ void DeviceContextD3D12Impl::PrepareForIndexedDraw(GraphicsContext& GraphCtx, DR { CommitD3D12IndexBuffer(GraphCtx, IndexType); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_STATES) != 0) { DvpVerifyBufferState(*m_pIndexBuffer, RESOURCE_STATE_INDEX_BUFFER, "Indexed draw (DeviceContextD3D12Impl::Draw())"); @@ -497,7 +497,7 @@ void DeviceContextD3D12Impl::PrepareDrawIndirectBuffer(GraphicsContext& DEV_CHECK_ERR(pAttribsBuffer != nullptr, "Indirect draw attribs buffer must not be null"); auto* pIndirectDrawAttribsD3D12 = ValidatedCast<BufferD3D12Impl>(pAttribsBuffer); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pIndirectDrawAttribsD3D12->GetDesc().Usage == USAGE_DYNAMIC) pIndirectDrawAttribsD3D12->DvpVerifyDynamicAllocation(this); #endif @@ -563,7 +563,7 @@ void DeviceContextD3D12Impl::PrepareForDispatchCompute(ComputeContext& ComputeCt ); } } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else { if (m_pPipelineState->ContainsShaderResources()) @@ -593,7 +593,7 @@ void DeviceContextD3D12Impl::DispatchComputeIndirect(const DispatchComputeIndire auto* pBufferD3D12 = ValidatedCast<BufferD3D12Impl>(pAttribsBuffer); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pBufferD3D12->GetDesc().Usage == USAGE_DYNAMIC) pBufferD3D12->DvpVerifyDynamicAllocation(this); #endif @@ -712,7 +712,7 @@ void DeviceContextD3D12Impl::Flush() void DeviceContextD3D12Impl::FinishFrame() { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& MappedBuffIt : m_DbgMappedBuffers) { const auto& BuffDesc = MappedBuffIt.first->GetDesc(); @@ -1302,7 +1302,7 @@ void DeviceContextD3D12Impl::CopyTextureRegion(ID3D12Resource* pd { StateTransitionRequired = TextureD3D12.IsInKnownState() && !TextureD3D12.CheckState(RESOURCE_STATE_COPY_DEST); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (TextureTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { DvpVerifyTextureState(TextureD3D12, RESOURCE_STATE_COPY_DEST, "Using texture as copy destination (DeviceContextD3D12Impl::CopyTextureRegion)"); @@ -1337,7 +1337,7 @@ void DeviceContextD3D12Impl::CopyTextureRegion(ID3D12Resource* pd Footprint.Footprint.RowPitch = static_cast<UINT>(SrcStride); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto& FmtAttribs = GetTextureFormatAttribs(TexDesc.Format); const Uint32 RowCount = std::max((Footprint.Footprint.Height / FmtAttribs.BlockHeight), 1u); @@ -1388,7 +1388,7 @@ void DeviceContextD3D12Impl::CopyTextureRegion(IBuffer* pS if (pBufferD3D12->IsInKnownState() && pBufferD3D12->GetState() != RESOURCE_STATE_GENERIC_READ) GetCmdContext().TransitionResource(pBufferD3D12, RESOURCE_STATE_GENERIC_READ); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (BufferTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { DvpVerifyBufferState(*pBufferD3D12, RESOURCE_STATE_COPY_SOURCE, "Using buffer as copy source (DeviceContextD3D12Impl::CopyTextureRegion)"); @@ -1447,7 +1447,7 @@ void DeviceContextD3D12Impl::UpdateTextureRegion(const void* const auto& TexDesc = TextureD3D12.GetDesc(); auto UploadSpace = AllocateTextureUploadSpace(TexDesc.Format, DstBox); auto UpdateRegionDepth = DstBox.MaxZ - DstBox.MinZ; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { VERIFY(SrcStride >= UploadSpace.RowSize, "Source data stride (", SrcStride, ") is below the image row size (", UploadSpace.RowSize, ")"); const Uint32 PlaneSize = SrcStride * UploadSpace.RowCount; @@ -1732,7 +1732,7 @@ void DeviceContextD3D12Impl::TransitionResourceStates(Uint32 BarrierCount, State auto& CmdCtx = GetCmdContext(); for (Uint32 i = 0; i < BarrierCount; ++i) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DvpVerifyStateTransitionDesc(pResourceBarriers[i]); #endif CmdCtx.TransitionResource(pResourceBarriers[i]); @@ -1750,7 +1750,7 @@ void DeviceContextD3D12Impl::TransitionOrVerifyBufferState(CommandContext& if (Buffer.IsInKnownState() && !Buffer.CheckState(RequiredState)) CmdCtx.TransitionResource(&Buffer, RequiredState); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (TransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { DvpVerifyBufferState(Buffer, RequiredState, OperationName); @@ -1769,7 +1769,7 @@ void DeviceContextD3D12Impl::TransitionOrVerifyTextureState(CommandContext& if (Texture.IsInKnownState() && !Texture.CheckState(RequiredState)) CmdCtx.TransitionResource(&Texture, RequiredState); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (TransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { DvpVerifyTextureState(Texture, RequiredState, OperationName); diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index c2fa083c..467ed491 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -92,7 +92,7 @@ PipelineStateD3D12Impl::PipelineStateD3D12Impl(IReferenceCounters* pRefCoun m_pStaticVarManagers = ALLOCATE(ShaderVarMgrAllocator, "Raw memory for ShaderVariableManagerD3D12", ShaderVariableManagerD3D12, m_NumShaders); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { const ShaderResources* pResources[MAX_SHADERS_IN_PIPELINE] = {}; for (Uint32 s = 0; s < m_NumShaders; ++s) @@ -348,7 +348,7 @@ bool PipelineStateD3D12Impl::IsCompatibleWith(const IPipelineState* pPSO) const auto IsSameRootSignature = m_RootSig.IsSameAs(pPSOD3D12->m_RootSig); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { bool IsCompatibleShaders = true; if (m_NumShaders != pPSOD3D12->m_NumShaders) @@ -387,7 +387,7 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou class CommandContext& CmdCtx, CommitAndTransitionResourcesAttribs& Attrib) const { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (Attrib.pShaderResourceBinding == nullptr && ContainsShaderResources()) { LOG_ERROR_MESSAGE("Pipeline state '", m_Desc.Name, "' requires shader resource binding object to ", @@ -408,7 +408,7 @@ ShaderResourceCacheD3D12* PipelineStateD3D12Impl::CommitAndTransitionShaderResou return nullptr; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (IsIncompatibleWith(pResBindingD3D12Impl->GetPipelineState())) { LOG_ERROR_MESSAGE("Shader resource binding is incompatible with the pipeline state '", m_Desc.Name, "'. Operation will be ignored."); diff --git a/Graphics/GraphicsEngineD3D12/src/QueryManagerD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/QueryManagerD3D12.cpp index e27d6be6..2391e2a6 100644 --- a/Graphics/GraphicsEngineD3D12/src/QueryManagerD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/QueryManagerD3D12.cpp @@ -183,7 +183,7 @@ void QueryManagerD3D12::ReleaseQuery(QUERY_TYPE Type, Uint32 Index) auto& HeapInfo = m_Heaps[Type]; VERIFY(Index < HeapInfo.HeapSize, "Query index ", Index, " is out of range"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& ind : HeapInfo.AvailableQueries) { VERIFY(ind != Index, "Index ", Index, " already present in available queries list"); diff --git a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp index 781a711d..e86c0373 100644 --- a/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RenderDeviceD3D12Impl.cpp @@ -207,7 +207,7 @@ RenderDeviceD3D12Impl::~RenderDeviceD3D12Impl() IdleGPU(); ReleaseStaleResources(true); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT for (auto i = 0; i < _countof(m_CPUDescriptorHeaps); ++i) { DEV_CHECK_ERR(m_CPUDescriptorHeaps[i].DvpGetTotalAllocationCount() == 0, "All CPU descriptor heap allocations must be released"); @@ -240,7 +240,7 @@ void RenderDeviceD3D12Impl::FreeCommandContext(PooledCommandContext&& Ctx) { std::lock_guard<std::mutex> LockGuard(m_ContextPoolMutex); m_ContextPool.emplace_back(std::move(Ctx)); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicDecrement(m_AllocatedCtxCounter); #endif } @@ -339,7 +339,7 @@ RenderDeviceD3D12Impl::PooledCommandContext RenderDeviceD3D12Impl::AllocateComma m_ContextPool.pop_back(); Ctx->Reset(m_CmdListManager); Ctx->SetID(ID); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicIncrement(m_AllocatedCtxCounter); #endif return Ctx; @@ -350,7 +350,7 @@ RenderDeviceD3D12Impl::PooledCommandContext RenderDeviceD3D12Impl::AllocateComma auto* pRawMem = ALLOCATE(CmdCtxAllocator, "CommandContext instance", CommandContext, 1); auto pCtx = new (pRawMem) CommandContext(m_CmdListManager); pCtx->SetID(ID); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Atomics::AtomicIncrement(m_AllocatedCtxCounter); #endif return PooledCommandContext(pCtx, CmdCtxAllocator); diff --git a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp index 33978eaf..958df523 100644 --- a/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp +++ b/Graphics/GraphicsEngineD3D12/src/RootSignature.cpp @@ -189,7 +189,7 @@ D3D12_SHADER_VISIBILITY GetShaderVisibility(SHADER_TYPE ShaderType) { auto ShaderInd = GetShaderTypeIndex(ShaderType); auto ShaderVisibility = ShaderTypeInd2ShaderVisibilityMap[ShaderInd]; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG switch (ShaderType) { // clang-format off @@ -222,7 +222,7 @@ SHADER_TYPE ShaderTypeFromShaderVisibility(D3D12_SHADER_VISIBILITY ShaderVisibil { VERIFY_EXPR(ShaderVisibility >= D3D12_SHADER_VISIBILITY_ALL && ShaderVisibility <= D3D12_SHADER_VISIBILITY_PIXEL); auto ShaderType = ShaderVisibility2ShaderTypeMap[ShaderVisibility]; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG switch (ShaderVisibility) { // clang-format off @@ -254,7 +254,7 @@ D3D12_DESCRIPTOR_HEAP_TYPE HeapTypeFromRangeType(D3D12_DESCRIPTOR_RANGE_TYPE Ran VERIFY_EXPR(RangeType >= D3D12_DESCRIPTOR_RANGE_TYPE_SRV && RangeType <= D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER); auto HeapType = RangeType2HeapTypeMap[RangeType]; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG switch (RangeType) { // clang-format off @@ -367,7 +367,7 @@ void RootSignature::AllocateResourceSlot(SHADER_TYPE ShaderT } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void RootSignature::dbgVerifyRootParameters() const { Uint32 dbgTotalSrvCbvUavSlots = 0; @@ -473,7 +473,7 @@ void RootSignature::Finalize(ID3D12Device* pd3d12Device) ++m_TotalRootViews[RootView.GetShaderVariableType()]; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG dbgVerifyRootParameters(); #endif @@ -645,7 +645,7 @@ void RootSignature::InitResourceCache(RenderDeviceD3D12Impl* pDeviceD3D12Impl auto& RootTableCache = ResourceCache.GetRootTable(RootParam.GetRootIndex()); SHADER_TYPE dbgShaderType = SHADER_TYPE_UNKNOWN; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG dbgShaderType = ShaderTypeFromShaderVisibility(D3D12RootParam.ShaderVisibility); #endif VERIFY_EXPR(D3D12RootParam.ParameterType == D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE); @@ -655,7 +655,7 @@ void RootSignature::InitResourceCache(RenderDeviceD3D12Impl* pDeviceD3D12Impl auto HeapType = HeapTypeFromRangeType(D3D12RootParam.DescriptorTable.pDescriptorRanges[0].RangeType); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG RootTableCache.SetDebugAttribs(TableSize, HeapType, dbgShaderType); #endif @@ -679,7 +679,7 @@ void RootSignature::InitResourceCache(RenderDeviceD3D12Impl* pDeviceD3D12Impl } } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (Uint32 rv = 0; rv < m_RootParams.GetNumRootViews(); ++rv) { auto& RootParam = m_RootParams.GetRootView(rv); @@ -776,7 +776,7 @@ __forceinline void TransitionResource(CommandContext& Ctx, } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void RootSignature::DvpVerifyResourceState(const ShaderResourceCacheD3D12::Resource& Res, D3D12_DESCRIPTOR_RANGE_TYPE RangeType) { @@ -872,7 +872,7 @@ void RootSignature::DvpVerifyResourceState(const ShaderResourceCacheD3D12::Resou VERIFY(Res.pObject == nullptr && Res.CPUDescriptorHandle.ptr == 0, "Bound resource is unexpected"); } } -#endif // DEVELOPMENT +#endif // DILIGENT_DEVELOPMENT template <class TOperation> __forceinline void RootSignature::RootParamsManager::ProcessRootTables(TOperation Operation) const @@ -889,7 +889,7 @@ __forceinline void RootSignature::RootParamsManager::ProcessRootTables(TOperatio VERIFY(d3d12Table.NumDescriptorRanges > 0 && RootTable.GetDescriptorTableSize() > 0, "Unexepected empty descriptor table"); bool IsResourceTable = d3d12Table.pDescriptorRanges[0].RangeType != D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER; D3D12_DESCRIPTOR_HEAP_TYPE dbgHeapType = D3D12_DESCRIPTOR_HEAP_TYPE_NUM_TYPES; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG dbgHeapType = IsResourceTable ? D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV : D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER; #endif Operation(RootInd, RootTable, D3D12Param, IsResourceTable, dbgHeapType); @@ -909,7 +909,7 @@ __forceinline void ProcessCachedTableResources(Uint32 RootI for (UINT d = 0; d < range.NumDescriptors; ++d) { SHADER_TYPE dbgShaderType = SHADER_TYPE_UNKNOWN; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG dbgShaderType = ShaderTypeFromShaderVisibility(D3D12Param.ShaderVisibility); VERIFY(dbgHeapType == HeapTypeFromRangeType(range.RangeType), "Mistmatch between descriptor heap type and descriptor range type"); #endif @@ -1016,7 +1016,7 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl* { TransitionResource(Ctx, Res, range.RangeType); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (ValidateStates) { DvpVerifyResourceState(Res, range.RangeType); @@ -1033,7 +1033,7 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl* { pd3d12Device->CopyDescriptorsSimple(1, DynamicCbvSrvUavDescriptors.GetCpuHandle(DynamicCbvSrvUavTblOffset), Res.CPUDescriptorHandle, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else { LOG_ERROR_MESSAGE("No valid CbvSrvUav descriptor handle found for root parameter ", RootInd, ", descriptor slot ", OffsetFromTableStart); @@ -1050,7 +1050,7 @@ void RootSignature::CommitDescriptorHandlesInternal_SMD(RenderDeviceD3D12Impl* { pd3d12Device->CopyDescriptorsSimple(1, DynamicSamplerDescriptors.GetCpuHandle(DynamicSamplerTblOffset), Res.CPUDescriptorHandle, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else { LOG_ERROR_MESSAGE("No valid sampler descriptor handle found for root parameter ", RootInd, ", descriptor slot ", OffsetFromTableStart); @@ -1108,7 +1108,7 @@ void RootSignature::CommitDescriptorHandlesInternal_SM(RenderDeviceD3D12Impl* } // ); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (ValidateStates) { ProcessCachedTableResources( diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp index 93d444d7..19ad36bc 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceBindingD3D12Impl.cpp @@ -155,7 +155,7 @@ IShaderResourceVariable* ShaderResourceBindingD3D12Impl::GetVariableByIndex(SHAD } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void ShaderResourceBindingD3D12Impl::dvpVerifyResourceBindings(const PipelineStateD3D12Impl* pPSO) const { auto* pRefPSO = GetPipelineState<const PipelineStateD3D12Impl>(); @@ -170,7 +170,7 @@ void ShaderResourceBindingD3D12Impl::dvpVerifyResourceBindings(const PipelineSta const auto& ShaderResLayout = pRefPSO->GetShaderResLayout(l); ShaderResLayout.dvpVerifyBindings(m_ShaderResourceCache); } -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG m_ShaderResourceCache.DbgVerifyBoundDynamicCBsCounter(); # endif } @@ -203,7 +203,7 @@ void ShaderResourceBindingD3D12Impl::InitializeStaticResources(const IPipelineSt const auto& ShaderResLayout = pPSO12->GetShaderResLayout(s); auto& StaticResLayout = pPSO12->GetStaticShaderResLayout(s); auto& StaticResCache = pPSO12->GetStaticShaderResCache(s); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!StaticResLayout.dvpVerifyBindings(StaticResCache)) { auto* pShader = pPSO12->GetShader<ShaderD3D12Impl>(s); @@ -217,7 +217,7 @@ void ShaderResourceBindingD3D12Impl::InitializeStaticResources(const IPipelineSt StaticResLayout.CopyStaticResourceDesriptorHandles(StaticResCache, ShaderResLayout, m_ShaderResourceCache); } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_ShaderResourceCache.DbgVerifyBoundDynamicCBsCounter(); #endif diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp index 482443a7..a5224fb3 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp @@ -99,7 +99,7 @@ ShaderResourceCacheD3D12::~ShaderResourceCacheD3D12() } } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void ShaderResourceCacheD3D12::DbgVerifyBoundDynamicCBsCounter() const { Uint32 NumDynamicCBsBound = 0; diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp index ce7c81f8..66f6c1d7 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceLayoutD3D12.cpp @@ -293,7 +293,7 @@ ShaderResourceLayoutD3D12::ShaderResourceLayoutD3D12(IObject& if (StaticSamplerInd >= 0) { // Static samplers are never copied, and SamplerId == InvalidSamplerId -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG auto SamplerCount = GetTotalSamplerCount(); for (Uint32 s = 0; s < SamplerCount; ++s) { @@ -346,7 +346,7 @@ ShaderResourceLayoutD3D12::ShaderResourceLayoutD3D12(IObject& } // ); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (SHADER_RESOURCE_VARIABLE_TYPE VarType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; VarType < SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES; VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(VarType + 1)) { VERIFY(CurrCbvSrvUav[VarType] == CbvSrvUavCount[VarType], "Not all Srv/Cbv/Uavs are initialized, which result in a crash when dtor is called"); @@ -361,7 +361,7 @@ ShaderResourceLayoutD3D12::ShaderResourceLayoutD3D12(IObject& // http://diligentgraphics.com/diligent-engine/architecture/d3d12/shader-resource-cache#Initializing-Shader-Objects VERIFY_EXPR(pRootSig == nullptr); pResourceCache->Initialize(GetRawAllocator(), _countof(StaticResCacheTblSizes), StaticResCacheTblSizes); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG pResourceCache->GetRootTable(D3D12_DESCRIPTOR_RANGE_TYPE_SRV).SetDebugAttribs(StaticResCacheTblSizes[D3D12_DESCRIPTOR_RANGE_TYPE_SRV], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_pResources->GetShaderType()); pResourceCache->GetRootTable(D3D12_DESCRIPTOR_RANGE_TYPE_UAV).SetDebugAttribs(StaticResCacheTblSizes[D3D12_DESCRIPTOR_RANGE_TYPE_UAV], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_pResources->GetShaderType()); pResourceCache->GetRootTable(D3D12_DESCRIPTOR_RANGE_TYPE_CBV).SetDebugAttribs(StaticResCacheTblSizes[D3D12_DESCRIPTOR_RANGE_TYPE_CBV], D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, m_pResources->GetShaderType()); @@ -382,7 +382,7 @@ void ShaderResourceLayoutD3D12::D3D12Resource::CacheCB(IDeviceObject* // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<BufferD3D12Impl> pBuffD3D12(pBuffer, IID_BufferD3D12); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT VerifyConstantBufferBinding(Attribs, GetVariableType(), ArrayInd, pBuffer, pBuffD3D12.RawPtr(), DstRes.pObject.RawPtr(), ParentResLayout.GetShaderName()); #endif if (pBuffD3D12) @@ -451,7 +451,7 @@ void ShaderResourceLayoutD3D12::D3D12Resource::CacheResourceView(IDeviceObject* // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<TResourceViewType> pViewD3D12(pView, ResourceViewTraits<TResourceViewType>::IID); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT VerifyResourceViewBinding(Attribs, GetVariableType(), ArrayIndex, pView, pViewD3D12.RawPtr(), {dbgExpectedViewType}, DstRes.pObject.RawPtr(), ParentResLayout.GetShaderName()); #endif if (pViewD3D12) @@ -563,7 +563,7 @@ void ShaderResourceLayoutD3D12::D3D12Resource::BindResource(IDeviceObject* ResourceCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER>(RootIndex, OffsetFromTableStart + ArrayIndex) : ResourceCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV>(RootIndex, OffsetFromTableStart + ArrayIndex); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { if (ResourceCache.DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) { @@ -613,7 +613,7 @@ void ShaderResourceLayoutD3D12::D3D12Resource::BindResource(IDeviceObject* auto ShdrVisibleSamplerHeapCPUDescriptorHandle = ResourceCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER>(Sam.RootIndex, Sam.OffsetFromTableStart + SamplerArrInd); auto& DstSam = ResourceCache.GetRootTable(Sam.RootIndex).GetResource(Sam.OffsetFromTableStart + SamplerArrInd, D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, ParentResLayout.m_pResources->GetShaderType()); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { if (ResourceCache.DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) { @@ -828,7 +828,7 @@ void ShaderResourceLayoutD3D12::CopyStaticResourceDesriptorHandles(const ShaderR } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool ShaderResourceLayoutD3D12::dvpVerifyBindings(const ShaderResourceCacheD3D12& ResourceCache) const { bool BindingsOK = true; @@ -874,7 +874,7 @@ bool ShaderResourceLayoutD3D12::dvpVerifyBindings(const ShaderResourceCacheD3D12 } } -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG { const auto ShdrVisibleHeapCPUDescriptorHandle = ResourceCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV>(res.RootIndex, res.OffsetFromTableStart + ArrInd); if (ResourceCache.DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) @@ -923,7 +923,7 @@ bool ShaderResourceLayoutD3D12::dvpVerifyBindings(const ShaderResourceCacheD3D12 BindingsOK = false; } -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG { const auto ShdrVisibleHeapCPUDescriptorHandle = ResourceCache.GetShaderVisibleTableCPUDescriptorHandle<D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER>(SamInfo.RootIndex, SamInfo.OffsetFromTableStart + ArrInd); if (ResourceCache.DbgGetContentType() == ShaderResourceCacheD3D12::DbgCacheContentType::StaticShaderResources) diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp index 1c825a15..f7c23096 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp @@ -63,7 +63,7 @@ ShaderVariableManagerD3D12::ShaderVariableManagerD3D12(IObject& // clang-format off m_Owner {Owner}, m_ResourceCache {ResourceCache} -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG , m_DbgAllocator {Allocator} #endif // clang-format on diff --git a/Graphics/GraphicsEngineD3DBase/include/D3DShaderResourceLoader.hpp b/Graphics/GraphicsEngineD3DBase/include/D3DShaderResourceLoader.hpp index 829eae5d..ea3a9f3e 100644 --- a/Graphics/GraphicsEngineD3DBase/include/D3DShaderResourceLoader.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/D3DShaderResourceLoader.hpp @@ -127,7 +127,7 @@ void LoadD3DShaderResources(ID3DBlob* pShaderByteCode, Name.erase(OpenBracketPos, Name.length() - OpenBracketPos); // Name == "g_tex2DDiffuse" VERIFY_EXPR(Name.length() == OpenBracketPos); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& ExistingRes : Resources) { VERIFY(Name.compare(ExistingRes.Name) != 0, "Resource with the same name has already been enumerated. All array elements are expected to be enumerated one after another"); diff --git a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp index 9dcd44b4..e12d094e 100644 --- a/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp +++ b/Graphics/GraphicsEngineD3DBase/include/ShaderResources.hpp @@ -128,7 +128,7 @@ public: SamplerOrTexSRVId {_SamplerId} // clang-format on { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // clang-format off VERIFY(_BindPoint <= MaxBindPoint || _BindPoint == InvalidBindPoint, "Bind Point is out of allowed range"); VERIFY(_BindCount <= MaxBindCount, "Bind Count is out of allowed range"); @@ -376,7 +376,7 @@ public: const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, Uint32 NumAllowedTypes, bool CountStaticSamplers) const noexcept; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT static void DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& ResourceLayout, const ShaderResources* const pShaderResources[], Uint32 NumShaders); @@ -540,7 +540,7 @@ void ShaderResources::Initialize(ID3DBlob* pShaderByteCode, { m_SamplerSuffix = m_ResourceNames.CopyString(CombinedSamplerSuffix); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT for (Uint32 n = 0; n < GetNumSamplers(); ++n) { const auto& Sampler = GetSampler(n); diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp index 8e35198d..e880fe0f 100644 --- a/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp +++ b/Graphics/GraphicsEngineD3DBase/src/ShaderD3DBase.cpp @@ -92,7 +92,7 @@ static HRESULT CompileShader(const char* Source, ID3DBlob** ppCompilerOutput) { DWORD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS; -#if defined(DEBUG) || defined(_DEBUG) +#if defined(DILIGENT_DEBUG) // Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders. // Setting this flag improves the shader debugging experience, but still allows // the shaders to be optimized and to run exactly the way they will run in diff --git a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp index 3f166a9b..ae8e5d8a 100644 --- a/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp +++ b/Graphics/GraphicsEngineD3DBase/src/ShaderResources.cpp @@ -213,7 +213,7 @@ D3DShaderResourceCounters ShaderResources::CountResources(const PipelineResource return Counters; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void ShaderResources::DvpVerifyResourceLayout(const PipelineResourceLayoutDesc& ResourceLayout, const ShaderResources* const pShaderResources[], Uint32 NumShaders) diff --git a/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.hpp b/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.hpp index 906a846f..f1b4ba7b 100644 --- a/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.hpp +++ b/Graphics/GraphicsEngineNextGenBase/include/DynamicHeap.hpp @@ -105,7 +105,7 @@ public: Uint32 Size) : m_AllocationsMgr{Size, Allocator} { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_MasterBlockCounter = 0; #endif } @@ -155,7 +155,7 @@ public: if (Mgr != nullptr) { std::lock_guard<std::mutex> Lock{Mgr->m_AllocationsMgrMtx}; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --Mgr->m_MasterBlockCounter; #endif Mgr->m_AllocationsMgr.Free(std::move(Block)); @@ -174,7 +174,7 @@ public: OffsetType GetUsedSize() const { return m_AllocationsMgr.GetUsedSize();} // clang-format on -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t GetMasterBlockCounter() const { return m_MasterBlockCounter; @@ -186,7 +186,7 @@ protected: { std::lock_guard<std::mutex> Lock{m_AllocationsMgrMtx}; auto NewBlock = m_AllocationsMgr.Allocate(SizeInBytes, Alignment); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (NewBlock.IsValid()) { ++m_MasterBlockCounter; @@ -199,7 +199,7 @@ private: std::mutex m_AllocationsMgrMtx; VariableSizeAllocationsManager m_AllocationsMgr; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_MasterBlockCounter; #endif }; diff --git a/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp b/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp index 67f1e1ec..cf6a9e86 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp +++ b/Graphics/GraphicsEngineOpenGL/include/GLPipelineResourceLayout.hpp @@ -283,7 +283,7 @@ public: // while Layout is alive void BindResources(SHADER_TYPE ShaderStage, IResourceMapping* pResourceMapping, Uint32 Flags, const GLProgramResourceCache& dbgResourceCache); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool dvpVerifyBindings(const GLProgramResourceCache& ResourceCache) const; #endif diff --git a/Graphics/GraphicsEngineOpenGL/include/GLProgramResourceCache.hpp b/Graphics/GraphicsEngineOpenGL/include/GLProgramResourceCache.hpp index cb2cce48..3fbc550e 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLProgramResourceCache.hpp +++ b/Graphics/GraphicsEngineOpenGL/include/GLProgramResourceCache.hpp @@ -268,7 +268,7 @@ private: Uint8* m_pResourceData = nullptr; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG IMemoryAllocator* m_pdbgMemoryAllocator = nullptr; #endif }; diff --git a/Graphics/GraphicsEngineOpenGL/include/pch.h b/Graphics/GraphicsEngineOpenGL/include/pch.h index 739cfa4c..2d81c6b3 100644 --- a/Graphics/GraphicsEngineOpenGL/include/pch.h +++ b/Graphics/GraphicsEngineOpenGL/include/pch.h @@ -142,7 +142,7 @@ LogError<true>(/*IsFatal=*/false, __FUNCTION__, __FILE__, __LINE__, __VA_ARGS__, "\nGL Error Code: ", err); \ } while (false) -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT # define DEV_CHECK_GL_ERROR CHECK_GL_ERROR #else # define DEV_CHECK_GL_ERROR(...) \ diff --git a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp index e3fff3ee..70df3725 100644 --- a/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/BufferGLImpl.cpp @@ -342,7 +342,7 @@ void BufferGLImpl::Unmap(GLContextState& CtxState) void BufferGLImpl::BufferMemoryBarrier(Uint32 RequiredBarriers, GLContextState& GLContextState) { #if GL_ARB_shader_image_load_store -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG { // clang-format off constexpr Uint32 BufferBarriers = diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index 8b13486d..02ab028c 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -416,7 +416,7 @@ void DeviceContextGLImpl::BindProgramResources(Uint32& NewMemoryBarriers, IShade auto* pShaderResBindingGL = ValidatedCast<ShaderResourceBindingGLImpl>(pResBinding); const auto& ResourceCache = pShaderResBindingGL->GetResourceCache(m_pPipelineState); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_pPipelineState->GetResourceLayout().dvpVerifyBindings(ResourceCache); #endif @@ -517,7 +517,7 @@ void DeviceContextGLImpl::BindProgramResources(Uint32& NewMemoryBarriers, IShade m_BoundWritableTextures.push_back(pTextureGL); } -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG // Check that the texure being bound has immutable storage { m_ContextState.BindTexture(-1, pTexViewGL->GetBindTarget(), pTexViewGL->GetHandle()); @@ -655,7 +655,7 @@ void DeviceContextGLImpl::BindProgramResources(Uint32& NewMemoryBarriers, IShade void DeviceContextGLImpl::PrepareForDraw(DRAW_FLAGS Flags, bool IsIndexed, GLenum& GlTopology) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_RENDER_TARGETS) != 0) DvpVerifyRenderTargets(); #endif diff --git a/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp b/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp index 1165dba8..5d18a955 100644 --- a/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/FBOCache.cpp @@ -186,7 +186,7 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Nu if (DSVDesc.Format == TEX_FORMAT_D32_FLOAT || DSVDesc.Format == TEX_FORMAT_D16_UNORM) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto GLTexFmt = pDepthTexGL->GetGLTexFormat(); VERIFY(GLTexFmt == GL_DEPTH_COMPONENT32F || GLTexFmt == GL_DEPTH_COMPONENT16, @@ -199,7 +199,7 @@ const GLObjectWrappers::GLFrameBufferObj& FBOCache::GetFBO(Uint32 Nu else if (DSVDesc.Format == TEX_FORMAT_D32_FLOAT_S8X24_UINT || DSVDesc.Format == TEX_FORMAT_D24_UNORM_S8_UINT) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto GLTexFmt = pDepthTexGL->GetGLTexFormat(); VERIFY(GLTexFmt == GL_DEPTH24_STENCIL8 || GLTexFmt == GL_DEPTH32F_STENCIL8, diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp index 978a810f..4d4eb383 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp @@ -207,7 +207,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa 0, 0 // }; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG attribs[5] |= WGL_CONTEXT_DEBUG_BIT_ARB; #endif diff --git a/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp b/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp index f0110128..16940bda 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLPipelineResourceLayout.cpp @@ -119,7 +119,7 @@ void GLPipelineResourceLayout::Initialize(GLProgramResources* P Uint32 ImageBindingSlots = 0; Uint32 SSBOBindingSlots = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG const Uint32 DbgAllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes); #endif for (Uint32 prog = 0; prog < NumPrograms; ++prog) @@ -256,7 +256,7 @@ void GLPipelineResourceLayout::UniformBuffBindInfo::BindResource(IDeviceObject* // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<BufferGLImpl> pBuffGLImpl(pBuffer, IID_BufferGL); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { const auto& CachedUB = ResourceCache.GetConstUB(m_Attribs.Binding + ArrayIndex); VerifyConstantBufferBinding(m_Attribs, GetType(), ArrayIndex, pBuffer, pBuffGLImpl.RawPtr(), CachedUB.pBuffer.RawPtr()); @@ -283,7 +283,7 @@ void GLPipelineResourceLayout::SamplerBindInfo::BindResource(IDeviceObject* pVie // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<TextureViewGLImpl> pViewGL(pView, IID_TextureViewGL); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { auto& CachedTexSampler = ResourceCache.GetConstSampler(m_Attribs.Binding + ArrayIndex); VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewGL.RawPtr(), {TEXTURE_VIEW_SHADER_RESOURCE}, CachedTexSampler.pView.RawPtr()); @@ -300,7 +300,7 @@ void GLPipelineResourceLayout::SamplerBindInfo::BindResource(IDeviceObject* pVie // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<BufferViewGLImpl> pViewGL(pView, IID_BufferViewGL); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { auto& CachedBuffSampler = ResourceCache.GetConstSampler(m_Attribs.Binding + ArrayIndex); VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewGL.RawPtr(), {BUFFER_VIEW_SHADER_RESOURCE}, CachedBuffSampler.pView.RawPtr()); @@ -327,7 +327,7 @@ void GLPipelineResourceLayout::ImageBindInfo::BindResource(IDeviceObject* pView, // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<TextureViewGLImpl> pViewGL(pView, IID_TextureViewGL); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { auto& CachedUAV = ResourceCache.GetConstImage(m_Attribs.Binding + ArrayIndex); VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewGL.RawPtr(), {TEXTURE_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr()); @@ -340,7 +340,7 @@ void GLPipelineResourceLayout::ImageBindInfo::BindResource(IDeviceObject* pView, // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<BufferViewGLImpl> pViewGL(pView, IID_BufferViewGL); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { auto& CachedUAV = ResourceCache.GetConstImage(m_Attribs.Binding + ArrayIndex); VerifyResourceViewBinding(m_Attribs, GetType(), ArrayIndex, pView, pViewGL.RawPtr(), {BUFFER_VIEW_UNORDERED_ACCESS}, CachedUAV.pView.RawPtr()); @@ -367,7 +367,7 @@ void GLPipelineResourceLayout::StorageBufferBindInfo::BindResource(IDeviceObject // We cannot use ValidatedCast<> here as the resource retrieved from the // resource mapping can be of wrong type RefCntAutoPtr<BufferViewGLImpl> pViewGL(pView, IID_BufferViewGL); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { auto& CachedSSBO = ResourceCache.GetConstSSBO(m_Attribs.Binding + ArrayIndex); // HLSL structured buffers are mapped to SSBOs in GLSL @@ -521,7 +521,7 @@ Uint32 GLPipelineResourceLayout::GetNumVariables(SHADER_TYPE ShaderStage) const VariableEndOffset.NumStorageBlocks - VariableStartOffset.NumStorageBlocks; // clang-format on -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { Uint32 DbgNumVars = 0; auto CountVar = [&](const GLVariableBase& Var) { @@ -721,7 +721,7 @@ void GLPipelineResourceLayout::CopyResources(GLProgramResourceCache& DstCache) c ); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool GLPipelineResourceLayout::dvpVerifyBindings(const GLProgramResourceCache& ResourceCache) const { # define LOG_MISSING_BINDING(VarType, BindInfo, BindPt) LOG_ERROR_MESSAGE("No resource is bound to ", VarType, " variable '", BindInfo.m_Attribs.GetPrintName(BindPt - BindInfo.m_Attribs.Binding), "'") diff --git a/Graphics/GraphicsEngineOpenGL/src/GLProgramResourceCache.cpp b/Graphics/GraphicsEngineOpenGL/src/GLProgramResourceCache.cpp index 5981ce86..95557557 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLProgramResourceCache.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLProgramResourceCache.cpp @@ -62,7 +62,7 @@ void GLProgramResourceCache::Initialize(Uint32 UBCount, Uint32 SamplerCount, Uin VERIFY_EXPR(BufferSize == GetRequriedMemorySize(UBCount, SamplerCount, ImageCount, SSBOCount)); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_pdbgMemoryAllocator = &MemAllocator; #endif if (BufferSize > 0) diff --git a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp index f3e206ec..176c1651 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLProgramResources.cpp @@ -511,7 +511,7 @@ void GLProgramResources::LoadUniforms(SHADER_TYPE Shad } else { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& ub : UniformBlocks) VERIFY(strcmp(ub.Name, Name.data()) != 0, "Uniform block with the name '", ub.Name, "' has already been enumerated"); #endif @@ -567,7 +567,7 @@ void GLProgramResources::LoadUniforms(SHADER_TYPE Shad } else { -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG for (const auto& sb : StorageBlocks) VERIFY(strcmp(sb.Name, Name.data()) != 0, "Storage block with the name \"", sb.Name, "\" has already been enumerated"); # endif diff --git a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp index c2e6a576..407b4b22 100644 --- a/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/RenderDeviceGLImpl.cpp @@ -639,7 +639,7 @@ void RenderDeviceGLImpl::FlagSupportedTexFormats() FLAG_FORMAT(TEX_FORMAT_BC7_UNORM_SRGB, bBPTC ); // clang-format on -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG bool bGL43OrAbove = DeviceCaps.DevType == RENDER_DEVICE_TYPE_GL && (DeviceCaps.MajorVersion >= 5 || (DeviceCaps.MajorVersion == 4 && DeviceCaps.MinorVersion >= 3)); diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp index ac855bb2..c9639956 100644 --- a/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/ShaderResourceBindingGLImpl.cpp @@ -85,7 +85,7 @@ IShaderResourceVariable* ShaderResourceBindingGLImpl::GetVariableByIndex(SHADER_ const GLProgramResourceCache& ShaderResourceBindingGLImpl::GetResourceCache(PipelineStateGLImpl* pdbgPSO) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (pdbgPSO->IsIncompatibleWith(GetPipelineState())) { LOG_ERROR("Shader resource binding is incompatible with the currently bound pipeline state."); @@ -114,7 +114,7 @@ void ShaderResourceBindingGLImpl::InitializeStaticResources(const IPipelineState const auto* pPSOGL = ValidatedCast<const PipelineStateGLImpl>(pPipelineState); const auto& StaticResLayout = pPSOGL->GetStaticResourceLayout(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!StaticResLayout.dvpVerifyBindings(pPSOGL->GetStaticResourceCache())) { LOG_ERROR_MESSAGE("Static resources in SRB of PSO '", pPSOGL->GetDesc().Name, diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp index 4c9c0e19..ee8b1182 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture2DArray_OGL.cpp @@ -186,7 +186,7 @@ void Texture2DArray_OGL::UpdateData(GLContextState& ContextState, ((DstBox.MaxX % 4) == 0 || DstBox.MaxX == MipWidth) && ((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight), "Compressed texture update region must be 4 pixel-aligned"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format); auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3) / 4) * Uint32{FmtAttribs.ComponentSize}; diff --git a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp index e854960f..fd2f4dc2 100644 --- a/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/Texture2D_OGL.cpp @@ -208,7 +208,7 @@ void Texture2D_OGL::UpdateData(GLContextState& ContextState, ((DstBox.MaxX % 4) == 0 || DstBox.MaxX == MipWidth) && ((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight), "Compressed texture update region must be 4 pixel-aligned"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format); auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3) / 4) * Uint32{FmtAttribs.ComponentSize}; diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp index 19119423..e5914960 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp @@ -517,7 +517,7 @@ void TextureBaseGL::CopyData(DeviceContextGLImpl* pDeviceCtxGL, } auto* pRenderDeviceGL = ValidatedCast<RenderDeviceGLImpl>(GetDevice()); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { auto& TexViewObjAllocator = pRenderDeviceGL->GetTexViewObjAllocator(); VERIFY(&TexViewObjAllocator == &m_dbgTexViewObjAllocator, "Texture view allocator does not match allocator provided during texture initialization"); @@ -582,7 +582,7 @@ void TextureBaseGL::CopyData(DeviceContextGLImpl* pDeviceCtxGL, void TextureBaseGL::TextureMemoryBarrier(Uint32 RequiredBarriers, GLContextState& GLContextState) { #if GL_ARB_shader_image_load_store -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG { // clang-format off constexpr Uint32 TextureBarriers = @@ -603,27 +603,29 @@ void TextureBaseGL::TextureMemoryBarrier(Uint32 RequiredBarriers, GLContextState void TextureBaseGL::SetDefaultGLParameters() { -#ifdef _DEBUG - GLint BoundTex; - GLint TextureBinding = 0; - switch (m_BindTarget) +#ifdef DILIGENT_DEBUG { - // clang-format off - case GL_TEXTURE_1D: TextureBinding = GL_TEXTURE_BINDING_1D; break; - case GL_TEXTURE_1D_ARRAY: TextureBinding = GL_TEXTURE_BINDING_1D_ARRAY; break; - case GL_TEXTURE_2D: TextureBinding = GL_TEXTURE_BINDING_2D; break; - case GL_TEXTURE_2D_ARRAY: TextureBinding = GL_TEXTURE_BINDING_2D_ARRAY; break; - case GL_TEXTURE_2D_MULTISAMPLE: TextureBinding = GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; - case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: TextureBinding = GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break; - case GL_TEXTURE_3D: TextureBinding = GL_TEXTURE_BINDING_3D; break; - case GL_TEXTURE_CUBE_MAP: TextureBinding = GL_TEXTURE_BINDING_CUBE_MAP; break; - case GL_TEXTURE_CUBE_MAP_ARRAY: TextureBinding = GL_TEXTURE_BINDING_CUBE_MAP_ARRAY; break; - default: UNEXPECTED("Unknown bind target"); - // clang-format on + GLint BoundTex; + GLint TextureBinding = 0; + switch (m_BindTarget) + { + // clang-format off + case GL_TEXTURE_1D: TextureBinding = GL_TEXTURE_BINDING_1D; break; + case GL_TEXTURE_1D_ARRAY: TextureBinding = GL_TEXTURE_BINDING_1D_ARRAY; break; + case GL_TEXTURE_2D: TextureBinding = GL_TEXTURE_BINDING_2D; break; + case GL_TEXTURE_2D_ARRAY: TextureBinding = GL_TEXTURE_BINDING_2D_ARRAY; break; + case GL_TEXTURE_2D_MULTISAMPLE: TextureBinding = GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; + case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: TextureBinding = GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY; break; + case GL_TEXTURE_3D: TextureBinding = GL_TEXTURE_BINDING_3D; break; + case GL_TEXTURE_CUBE_MAP: TextureBinding = GL_TEXTURE_BINDING_CUBE_MAP; break; + case GL_TEXTURE_CUBE_MAP_ARRAY: TextureBinding = GL_TEXTURE_BINDING_CUBE_MAP_ARRAY; break; + default: UNEXPECTED("Unknown bind target"); + // clang-format on + } + glGetIntegerv(TextureBinding, &BoundTex); + CHECK_GL_ERROR("Failed to set GL_TEXTURE_MIN_FILTER texture parameter"); + VERIFY(static_cast<GLuint>(BoundTex) == m_GlTexture, "Current texture is not bound to GL context"); } - glGetIntegerv(TextureBinding, &BoundTex); - CHECK_GL_ERROR("Failed to set GL_TEXTURE_MIN_FILTER texture parameter"); - VERIFY(static_cast<GLuint>(BoundTex) == m_GlTexture, "Current texture is not bound to GL context"); #endif if (m_BindTarget != GL_TEXTURE_2D_MULTISAMPLE && diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp index 646e78f2..8acdd5f5 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureCubeArray_OGL.cpp @@ -176,7 +176,7 @@ void TextureCubeArray_OGL::UpdateData(GLContextState& ContextState, ((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight), "Compressed texture update region must be 4 pixel-aligned"); // clang-format on -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format); auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3) / 4) * Uint32{FmtAttribs.ComponentSize}; diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp index 8193aca5..165961fa 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureCube_OGL.cpp @@ -193,7 +193,7 @@ void TextureCube_OGL::UpdateData(GLContextState& ContextState, ((DstBox.MaxY % 4) == 0 || DstBox.MaxY == MipHeight), "Compressed texture update region must be 4 pixel-aligned" ); // clang-format on -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { const auto& FmtAttribs = GetTextureFormatAttribs(m_Desc.Format); auto BlockBytesInRow = ((DstBox.MaxX - DstBox.MinX + 3) / 4) * Uint32{FmtAttribs.ComponentSize}; diff --git a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.hpp b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.hpp index 0f9a5a9e..a54fe6bc 100644 --- a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.hpp +++ b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.hpp @@ -68,7 +68,7 @@ public: virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void DvpVerifyDynamicAllocation(DeviceContextVkImpl* pCtx) const; #endif @@ -82,7 +82,7 @@ public: { VERIFY(m_Desc.Usage == USAGE_DYNAMIC, "Dynamic buffer is expected"); VERIFY_EXPR(!m_DynamicAllocations.empty()); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DvpVerifyDynamicAllocation(pCtx); #endif auto& DynAlloc = m_DynamicAllocations[CtxId]; diff --git a/Graphics/GraphicsEngineVulkan/include/CommandPoolManager.hpp b/Graphics/GraphicsEngineVulkan/include/CommandPoolManager.hpp index 33aec74d..75bbccb8 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandPoolManager.hpp +++ b/Graphics/GraphicsEngineVulkan/include/CommandPoolManager.hpp @@ -62,7 +62,7 @@ public: void DestroyPools(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t GetAllocatedPoolCount() const { return m_AllocatedPoolCounter; @@ -81,7 +81,7 @@ private: std::mutex m_Mutex; std::deque<VulkanUtilities::CommandPoolWrapper, STDAllocatorRawMem<VulkanUtilities::CommandPoolWrapper>> m_CmdPools; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_AllocatedPoolCounter; #endif }; diff --git a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.hpp b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.hpp index bba4c285..98438da3 100644 --- a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.hpp +++ b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.hpp @@ -144,7 +144,7 @@ public: m_MaxSets {MaxSets }, m_AllowFreeing{AllowFreeing } { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_AllocatedPoolCounter = 0; #endif } @@ -162,7 +162,7 @@ public: RenderDeviceVkImpl& GetDeviceVkImpl() { return m_DeviceVkImpl; } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t GetAllocatedPoolCounter() const { return m_AllocatedPoolCounter; @@ -185,7 +185,7 @@ protected: private: void FreePool(VulkanUtilities::DescriptorPoolWrapper&& Pool); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_AllocatedPoolCounter; #endif }; @@ -213,7 +213,7 @@ public: } // clang-format on { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_AllocatedSetCounter = 0; #endif } @@ -222,7 +222,7 @@ public: DescriptorSetAllocation Allocate(Uint64 CommandQueueMask, VkDescriptorSetLayout SetLayout, const char* DebugName = ""); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t GetAllocatedDescriptorSetCounter() const { return m_AllocatedSetCounter; @@ -232,7 +232,7 @@ public: private: void FreeDescriptorSet(VkDescriptorSet Set, VkDescriptorPool Pool, Uint64 QueueMask); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_AllocatedSetCounter; #endif }; diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineLayout.hpp b/Graphics/GraphicsEngineVulkan/include/PipelineLayout.hpp index a0ac52c8..73fced1f 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineLayout.hpp +++ b/Graphics/GraphicsEngineVulkan/include/PipelineLayout.hpp @@ -102,7 +102,7 @@ public: Uint32 DynamicOffsetCount = 0; bool DynamicBuffersPresent = false; bool DynamicDescriptorsBound = false; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG const PipelineLayout* pDbgPipelineLayout = nullptr; #endif DescriptorSetBindInfo() : @@ -122,7 +122,7 @@ public: DynamicBuffersPresent = false; DynamicDescriptorsBound = false; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // In release mode, do not clear vectors as this causes unnecessary work vkSets.clear(); DynamicOffsets.clear(); @@ -235,7 +235,7 @@ __forceinline void PipelineLayout::BindDescriptorSetsWithDynamicOffsets(VulkanUt VERIFY(BindInfo.DynamicOffsetCount > 0, "This function should only be called for pipelines that contain dynamic descriptors"); VERIFY_EXPR(BindInfo.pResourceCache != nullptr); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG Uint32 TotalDynamicDescriptors = 0; for (SHADER_RESOURCE_VARIABLE_TYPE VarType = SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE; VarType <= SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC; VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(VarType + 1)) { diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp index b1c7f56b..172c82a8 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.hpp @@ -76,7 +76,7 @@ public: // clang-format off ShaderResourceCacheVk(DbgCacheContentType dbgContentType) -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG : m_DbgContentType{dbgContentType} #endif { @@ -186,7 +186,7 @@ public: Uint16& GetDynamicBuffersCounter() { return m_NumDynamicBuffers; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // Only for debug purposes: indicates what types of resources are stored in the cache DbgCacheContentType DbgGetContentType() const { return m_DbgContentType; } void DbgVerifyResourceInitialization() const; @@ -215,7 +215,7 @@ private: Uint16 m_NumDynamicBuffers = 0; Uint32 m_TotalResources = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // Only for debug purposes: indicates what types of resources are stored in the cache const DbgCacheContentType m_DbgContentType; // Debug array that stores flags indicating if resources in the cache have been initialized @@ -269,7 +269,7 @@ __forceinline Uint32 ShaderResourceCacheVk::GetDynamicBufferOffsets(Uint32 ++res; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (; res < DescrSet.GetSize(); ++res) { const auto& Res = DescrSet.GetResource(res); diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp index d0852883..529255a0 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.hpp @@ -270,7 +270,7 @@ public: const ShaderResourceCacheVk& SrcResourceCache, ShaderResourceCacheVk& DstResourceCache) const; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool dvpVerifyBindings(const ShaderResourceCacheVk& ResourceCache) const; static void dvpVerifyResourceLayoutDesc(Uint32 NumShaders, const std::shared_ptr<const SPIRVShaderResources> pShaderResources[], diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.hpp b/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.hpp index d54e440c..9039e04e 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.hpp +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVariableVk.hpp @@ -114,7 +114,7 @@ private: ShaderVariableVkImpl* m_pVariables = nullptr; Uint32 m_NumVariables = 0; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG IMemoryAllocator& m_DbgAllocator; #endif }; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp b/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp index b9b066b5..6aa8ba38 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp +++ b/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.hpp @@ -65,14 +65,14 @@ struct VulkanDynamicAllocation pDynamicMemMgr{rhs.pDynamicMemMgr}, AlignedOffset {rhs.AlignedOffset }, Size {rhs.Size } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT , dvpFrameNumber{rhs.dvpFrameNumber} #endif { rhs.pDynamicMemMgr = nullptr; rhs.AlignedOffset = 0; rhs.Size = 0; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT rhs.dvpFrameNumber = 0; #endif } @@ -86,7 +86,7 @@ struct VulkanDynamicAllocation rhs.pDynamicMemMgr = nullptr; rhs.AlignedOffset = 0; rhs.Size = 0; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT dvpFrameNumber = rhs.dvpFrameNumber; rhs.dvpFrameNumber = 0; #endif @@ -96,7 +96,7 @@ struct VulkanDynamicAllocation VulkanDynamicMemoryManager* pDynamicMemMgr = nullptr; size_t AlignedOffset = 0; // Offset from the start of the buffer size_t Size = 0; // Reserved size of this allocation -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT Int64 dvpFrameNumber = 0; #endif }; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBufferPool.hpp b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBufferPool.hpp index 1454a0a5..e755ffe4 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBufferPool.hpp +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBufferPool.hpp @@ -60,7 +60,7 @@ public: CommandPoolWrapper&& Release(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT int32_t DvpGetBufferCounter() const { return m_BuffCounter; @@ -74,7 +74,7 @@ private: std::mutex m_Mutex; std::deque<VkCommandBuffer> m_CmdBuffers; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::atomic_int32_t m_BuffCounter; #endif }; diff --git a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp index a7a655b1..1e64e97b 100644 --- a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp @@ -160,7 +160,7 @@ BufferVkImpl::BufferVkImpl(IReferenceCounters* pRefCounters, RESOURCE_STATE_INDIRECT_ARGUMENT); SetState(State); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { VkAccessFlags AccessFlags = VK_ACCESS_INDIRECT_COMMAND_READ_BIT | @@ -405,7 +405,7 @@ VkAccessFlags BufferVkImpl::GetAccessFlags() const return ResourceStateFlagsToVkAccessFlags(GetState()); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void BufferVkImpl::DvpVerifyDynamicAllocation(DeviceContextVkImpl* pCtx) const { auto ContextId = pCtx->GetContextId(); diff --git a/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp b/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp index 1c0f21c5..e7fbc9bd 100644 --- a/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp @@ -44,7 +44,7 @@ CommandPoolManager::CommandPoolManager(RenderDeviceVkImpl& DeviceVkImpl, m_CmdPools (STD_ALLOCATOR_RAW_MEM(VulkanUtilities::CommandPoolWrapper, GetRawAllocator(), "Allocator for deque<VulkanUtilities::CommandPoolWrapper>")) // clang-format on { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_AllocatedPoolCounter = 0; #endif } @@ -76,7 +76,7 @@ VulkanUtilities::CommandPoolWrapper CommandPoolManager::AllocateCommandPool(cons LogicalDevice.ResetCommandPool(CmdPool); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_AllocatedPoolCounter; #endif return std::move(CmdPool); @@ -130,7 +130,7 @@ void CommandPoolManager::SafeReleaseCommandPool(VulkanUtilities::CommandPoolWrap void CommandPoolManager::FreeCommandPool(VulkanUtilities::CommandPoolWrapper&& CmdPool) { std::lock_guard<std::mutex> LockGuard(m_Mutex); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --m_AllocatedPoolCounter; #endif m_CmdPools.emplace_back(std::move(CmdPool)); diff --git a/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp b/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp index a4cf5973..412ddd7b 100644 --- a/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp @@ -68,7 +68,7 @@ DescriptorPoolManager::~DescriptorPoolManager() VulkanUtilities::DescriptorPoolWrapper DescriptorPoolManager::GetPool(const char* DebugName) { std::lock_guard<std::mutex> Lock{m_Mutex}; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_AllocatedPoolCounter; #endif if (m_Pools.empty()) @@ -128,7 +128,7 @@ void DescriptorPoolManager::FreePool(VulkanUtilities::DescriptorPoolWrapper&& Po std::lock_guard<std::mutex> Lock{m_Mutex}; m_DeviceVkImpl.GetLogicalDevice().ResetDescriptorPool(Pool); m_Pools.emplace_back(std::move(Pool)); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --m_AllocatedPoolCounter; #endif } @@ -177,7 +177,7 @@ DescriptorSetAllocation DescriptorSetAllocator::Allocate(Uint64 CommandQueueMask std::swap(*it, m_Pools.front()); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_AllocatedSetCounter; #endif return {Set, Pool, CommandQueueMask, *this}; @@ -192,7 +192,7 @@ DescriptorSetAllocation DescriptorSetAllocator::Allocate(Uint64 CommandQueueMask auto Set = AllocateDescriptorSet(LogicalDevice, NewPool, SetLayout, DebugName); DEV_CHECK_ERR(Set != VK_NULL_HANDLE, "Failed to allocate descriptor set"); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_AllocatedSetCounter; #endif @@ -234,7 +234,7 @@ void DescriptorSetAllocator::FreeDescriptorSet(VkDescriptorSet Set, VkDescriptor { std::lock_guard<std::mutex> Lock{Allocator->m_Mutex}; Allocator->m_DeviceVkImpl.GetLogicalDevice().FreeDescriptorSet(Pool, Set); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --Allocator->m_AllocatedSetCounter; #endif } diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 75b1305d..1681b456 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -327,7 +327,7 @@ void DeviceContextVkImpl::SetBlendFactors(const float* pBlendFactors) void DeviceContextVkImpl::CommitVkVertexBuffers() { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (m_NumVertexStreams < m_pPipelineState->GetNumBufferSlotsUsed()) LOG_ERROR("Currently bound pipeline state '", m_pPipelineState->GetDesc().Name, "' expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); #endif @@ -344,7 +344,7 @@ void DeviceContextVkImpl::CommitVkVertexBuffers() if (pBufferVk->GetDesc().Usage == USAGE_DYNAMIC) { DynamicBufferPresent = true; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT pBufferVk->DvpVerifyDynamicAllocation(this); #endif } @@ -414,7 +414,7 @@ void DeviceContextVkImpl::DvpLogRenderPass_PSOMismatch() void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_RENDER_TARGETS) != 0) DvpVerifyRenderTargets(); #endif @@ -426,7 +426,7 @@ void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags) CommitVkVertexBuffers(); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_STATES) != 0) { for (Uint32 slot = 0; slot < m_NumVertexStreams; ++slot) @@ -451,7 +451,7 @@ void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags) } } #if 0 -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG else { if ( m_pPipelineState->dbgContainsShaderResources() ) @@ -460,7 +460,7 @@ void DeviceContextVkImpl::PrepareForDraw(DRAW_FLAGS Flags) # endif #endif -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (m_pPipelineState->GetVkRenderPass() != m_RenderPass) { DvpLogRenderPass_PSOMismatch(); @@ -475,7 +475,7 @@ BufferVkImpl* DeviceContextVkImpl::PrepareIndirectDrawAttribsBuffer(IBuffer* pAt DEV_CHECK_ERR(pAttribsBuffer, "Indirect draw attribs buffer must not be null"); auto* pIndirectDrawAttribsVk = ValidatedCast<BufferVkImpl>(pAttribsBuffer); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pIndirectDrawAttribsVk->GetDesc().Usage == USAGE_DYNAMIC) pIndirectDrawAttribsVk->DvpVerifyDynamicAllocation(this); #endif @@ -490,7 +490,7 @@ void DeviceContextVkImpl::PrepareForIndexedDraw(DRAW_FLAGS Flags, VALUE_TYPE Ind { PrepareForDraw(Flags); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if ((Flags & DRAW_FLAG_VERIFY_STATES) != 0) { DvpVerifyBufferState(*m_pIndexBuffer, RESOURCE_STATE_INDEX_BUFFER, "Indexed draw call (DeviceContextVkImpl::Draw)"); @@ -570,7 +570,7 @@ void DeviceContextVkImpl::PrepareForDispatchCompute() } } #if 0 -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG else { if ( m_pPipelineState->dbgContainsShaderResources() ) @@ -599,7 +599,7 @@ void DeviceContextVkImpl::DispatchComputeIndirect(const DispatchComputeIndirectA auto* pBufferVk = ValidatedCast<BufferVkImpl>(pAttribsBuffer); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pBufferVk->GetDesc().Usage == USAGE_DYNAMIC) pBufferVk->DvpVerifyDynamicAllocation(this); #endif @@ -803,7 +803,7 @@ void DeviceContextVkImpl::ClearRenderTarget(ITextureView* pView, const float* RG void DeviceContextVkImpl::FinishFrame() { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& MappedBuffIt : m_DbgMappedBuffers) { const auto& BuffDesc = MappedBuffIt.first->GetDesc(); @@ -1107,7 +1107,7 @@ void DeviceContextVkImpl::CommitRenderPassAndFramebuffer(bool VerifyStates) if (m_Framebuffer != VK_NULL_HANDLE) { VERIFY_EXPR(m_RenderPass != VK_NULL_HANDLE); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (VerifyStates) { TransitionRenderTargets(RESOURCE_STATE_TRANSITION_MODE_VERIFY); @@ -1197,7 +1197,7 @@ void DeviceContextVkImpl::UpdateBufferRegion(BufferVkImpl* pBuf Uint64 SrcOffset, RESOURCE_STATE_TRANSITION_MODE TransitionMode) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (DstOffset + NumBytes > pBuffVk->GetDesc().uiSizeInBytes) { LOG_ERROR("Update region is out of buffer bounds which will result in an undefined behavior"); @@ -1228,7 +1228,7 @@ void DeviceContextVkImpl::UpdateBuffer(IBuffer* pBuffer, // be resource barrier issues in the cmd list in the device context auto* pBuffVk = ValidatedCast<BufferVkImpl>(pBuffer); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pBuffVk->GetDesc().Usage == USAGE_DYNAMIC) { LOG_ERROR("Dynamic buffers must be updated via Map()"); @@ -1258,7 +1258,7 @@ void DeviceContextVkImpl::CopyBuffer(IBuffer* pSrcBuffer, auto* pSrcBuffVk = ValidatedCast<BufferVkImpl>(pSrcBuffer); auto* pDstBuffVk = ValidatedCast<BufferVkImpl>(pDstBuffer); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pDstBuffVk->GetDesc().Usage == USAGE_DYNAMIC) { LOG_ERROR("Dynamic buffers cannot be copy destinations"); @@ -1634,7 +1634,7 @@ void DeviceContextVkImpl::UpdateTextureRegion(const void* pSr // pages will be discarded VERIFY((Allocation.AlignedOffset % BufferOffsetAlignment) == 0, "Allocation offset must be at least 32-bit algined"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { VERIFY(SrcStride >= CopyInfo.RowSize, "Source data stride (", SrcStride, ") is below the image row size (", CopyInfo.RowSize, ")"); const Uint32 PlaneSize = SrcStride * CopyInfo.RowCount; @@ -2205,7 +2205,7 @@ void DeviceContextVkImpl::TransitionOrVerifyTextureState(TextureVkImpl& VERIFY_EXPR(Texture.GetLayout() == ExpectedLayout); } } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (TransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { DvpVerifyTextureState(Texture, RequiredState, OperationName); @@ -2301,7 +2301,7 @@ void DeviceContextVkImpl::TransitionOrVerifyBufferState(BufferVkImpl& VERIFY_EXPR(Buffer.CheckAccessFlags(ExpectedAccessFlags)); } } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (TransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { DvpVerifyBufferState(Buffer, RequiredState, OperationName); @@ -2312,7 +2312,7 @@ void DeviceContextVkImpl::TransitionOrVerifyBufferState(BufferVkImpl& VulkanDynamicAllocation DeviceContextVkImpl::AllocateDynamicSpace(Uint32 SizeInBytes, Uint32 Alignment) { auto DynAlloc = m_DynamicHeap.Allocate(SizeInBytes, Alignment); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DynAlloc.dvpFrameNumber = m_ContextFrameNumber; #endif return DynAlloc; @@ -2328,7 +2328,7 @@ void DeviceContextVkImpl::TransitionResourceStates(Uint32 BarrierCount, StateTra for (Uint32 i = 0; i < BarrierCount; ++i) { const auto& Barrier = pResourceBarriers[i]; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT DvpVerifyStateTransitionDesc(Barrier); #endif if (Barrier.TransitionType == STATE_TRANSITION_TYPE_BEGIN) diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp index 95e652ec..32a68780 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp @@ -146,7 +146,7 @@ size_t PipelineLayout::DescriptorSetLayoutManager::DescriptorSetLayout::GetMemor } VERIFY_EXPR(((NumBindings & (NumBindings - 1)) == 0) && NumBindings == MemSize || NumBindings < MemSize); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG static constexpr size_t MinMemSize = 1; #else static constexpr size_t MinMemSize = 16; @@ -442,7 +442,7 @@ void PipelineLayout::InitResourceCache(RenderDeviceVkImpl* pDeviceVkImpl, if (StaticAndMutSet.SetIndex >= 0) { const char* DescrSetName = "Static/Mutable Descriptor Set"; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::string _DescrSetName(DbgPipelineName); _DescrSetName.append(" - static/mutable set"); DescrSetName = _DescrSetName.c_str(); @@ -458,7 +458,7 @@ void PipelineLayout::PrepareDescriptorSets(DeviceContextVkImpl* pCtxVkIm DescriptorSetBindInfo& BindInfo, VkDescriptorSet VkDynamicDescrSet) const { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG BindInfo.vkSets.clear(); #endif @@ -491,7 +491,7 @@ void PipelineLayout::PrepareDescriptorSets(DeviceContextVkImpl* pCtxVkIm TotalDynamicDescriptors += Set.NumDynamicDescriptors; } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& set : BindInfo.vkSets) VERIFY(set != VK_NULL_HANDLE, "Descriptor set must not be null"); #endif @@ -501,7 +501,7 @@ void PipelineLayout::PrepareDescriptorSets(DeviceContextVkImpl* pCtxVkIm BindInfo.DynamicOffsets.resize(TotalDynamicDescriptors); BindInfo.BindPoint = IsCompute ? VK_PIPELINE_BIND_POINT_COMPUTE : VK_PIPELINE_BIND_POINT_GRAPHICS; BindInfo.pResourceCache = &ResourceCache; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG BindInfo.pDbgPipelineLayout = this; #endif BindInfo.DynamicBuffersPresent = ResourceCache.GetNumDynamicBuffers() > 0; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 1d2339a4..9e7b69c7 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -271,7 +271,7 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, PipelineCI.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; PipelineCI.pNext = nullptr; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG PipelineCI.flags = VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT; #endif PipelineCI.basePipelineHandle = VK_NULL_HANDLE; // a pipeline to derive from @@ -299,7 +299,7 @@ PipelineStateVkImpl::PipelineStateVkImpl(IReferenceCounters* pRefCounters, PipelineCI.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; PipelineCI.pNext = nullptr; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG PipelineCI.flags = VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT; #endif @@ -512,7 +512,7 @@ bool PipelineStateVkImpl::IsCompatibleWith(const IPipelineState* pPSO) const auto IsSamePipelineLayout = m_PipelineLayout.IsSameAs(pPSOVk->m_PipelineLayout); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { bool IsCompatibleShaders = true; if (m_NumShaders != pPSOVk->m_NumShaders) @@ -559,7 +559,7 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind if (!m_HasStaticResources && !m_HasNonStaticResources) return; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pShaderResourceBinding == nullptr) { LOG_ERROR_MESSAGE("Pipeline state '", m_Desc.Name, "' requires shader resource binding object to ", @@ -570,7 +570,7 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind auto* pResBindingVkImpl = ValidatedCast<ShaderResourceBindingVkImpl>(pShaderResourceBinding); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { auto* pRefPSO = pResBindingVkImpl->GetPipelineState(); if (IsIncompatibleWith(pRefPSO)) @@ -588,13 +588,13 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind auto& ResourceCache = pResBindingVkImpl->GetResourceCache(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT for (Uint32 s = 0; s < m_NumShaders; ++s) { m_ShaderResourceLayouts[s].dvpVerifyBindings(ResourceCache); } #endif -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG ResourceCache.DbgVerifyDynamicBuffersCounter(); #endif @@ -602,7 +602,7 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind { ResourceCache.TransitionResources<false>(pCtxVkImpl); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else if (StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_VERIFY) { ResourceCache.TransitionResources<true>(pCtxVkImpl); @@ -616,7 +616,7 @@ void PipelineStateVkImpl::CommitAndTransitionShaderResources(IShaderResourceBind if (DynamicDescriptorSetVkLayout != VK_NULL_HANDLE) { const char* DynamicDescrSetName = "Dynamic Descriptor Set"; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT std::string _DynamicDescrSetName(m_Desc.Name); _DynamicDescrSetName.append(" - dynamic set"); DynamicDescrSetName = _DynamicDescrSetName.c_str(); @@ -689,7 +689,7 @@ void PipelineStateVkImpl::InitializeStaticSRBResources(ShaderResourceCacheVk& Re { const auto& StaticResLayout = GetStaticShaderResLayout(s); const auto& StaticResCache = GetStaticResCache(s); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!StaticResLayout.dvpVerifyBindings(StaticResCache)) { const auto* pShaderVk = GetShader<const ShaderVkImpl>(s); @@ -703,7 +703,7 @@ void PipelineStateVkImpl::InitializeStaticSRBResources(ShaderResourceCacheVk& Re const auto& ShaderResourceLayouts = GetShaderResLayout(s); ShaderResourceLayouts.InitializeStaticResources(StaticResLayout, StaticResCache, ResourceCache); } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG ResourceCache.DbgVerifyDynamicBuffersCounter(); #endif } diff --git a/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp b/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp index 901f7228..ebc57289 100644 --- a/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp @@ -186,7 +186,7 @@ void QueryManagerVk::DiscardQuery(QUERY_TYPE Type, Uint32 Index) auto& HeapInfo = m_Heaps[Type]; VERIFY(Index < HeapInfo.PoolSize, "Query index ", Index, " is out of range"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (const auto& ind : HeapInfo.AvailableQueries) { VERIFY(ind != Index, "Index ", Index, " already present in available queries list"); diff --git a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp index 13800f49..22135811 100644 --- a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp @@ -59,7 +59,7 @@ SamplerVkImpl::SamplerVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImp SamplerCI.addressModeW = AddressModeToVkAddressMode(m_Desc.AddressW); SamplerCI.mipLodBias = m_Desc.MipLODBias; SamplerCI.anisotropyEnable = IsAnisotropicFilter(m_Desc.MinFilter); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!((SamplerCI.anisotropyEnable && IsAnisotropicFilter(m_Desc.MagFilter)) || (!SamplerCI.anisotropyEnable && !IsAnisotropicFilter(m_Desc.MagFilter)))) { @@ -69,7 +69,7 @@ SamplerVkImpl::SamplerVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImp SamplerCI.maxAnisotropy = static_cast<float>(m_Desc.MaxAnisotropy); SamplerCI.compareEnable = IsComparisonFilter(m_Desc.MinFilter); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (!((SamplerCI.compareEnable && IsComparisonFilter(m_Desc.MagFilter)) || (!SamplerCI.compareEnable && !IsComparisonFilter(m_Desc.MagFilter)))) { diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp index da361e1a..ee6a3709 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp @@ -78,7 +78,7 @@ ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl(IReferenceCounters* pR const SHADER_RESOURCE_VARIABLE_TYPE VarTypes[] = {SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE, SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC}; new (m_pShaderVarMgrs + s) ShaderVariableManagerVk(*this, SrcLayout, VarDataAllocator, VarTypes, _countof(VarTypes), m_ShaderResourceCache); } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_ShaderResourceCache.DbgVerifyResourceInitialization(); #endif } diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp index 1f09846a..06239703 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceCacheVk.cpp @@ -68,7 +68,7 @@ void ShaderResourceCacheVk::InitializeSets(IMemoryAllocator& MemAllocator, Uint3 m_TotalResources += SetSizes[t]; auto MemorySize = NumSets * sizeof(DescriptorSet) + m_TotalResources * sizeof(Resource); VERIFY_EXPR(MemorySize == GetRequiredMemorySize(NumSets, SetSizes)); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_DbgInitializedResources.resize(m_NumSets); #endif if (MemorySize > 0) @@ -80,7 +80,7 @@ void ShaderResourceCacheVk::InitializeSets(IMemoryAllocator& MemAllocator, Uint3 { new (&GetDescriptorSet(t)) DescriptorSet(SetSizes[t], SetSizes[t] > 0 ? pCurrResPtr : nullptr); pCurrResPtr += SetSizes[t]; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_DbgInitializedResources[t].resize(SetSizes[t]); #endif } @@ -94,13 +94,13 @@ void ShaderResourceCacheVk::InitializeResources(Uint32 Set, Uint32 Offset, Uint3 for (Uint32 res = 0; res < ArraySize; ++res) { new (&DescrSet.GetResource(Offset + res)) Resource{Type}; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG m_DbgInitializedResources[Set][Offset + res] = true; #endif } } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG void ShaderResourceCacheVk::DbgVerifyResourceInitialization() const { for (const auto& SetFlags : m_DbgInitializedResources) @@ -203,7 +203,7 @@ void ShaderResourceCacheVk::TransitionResources(DeviceContextVkImpl* pCtxVkImpl) Res.Type == SPIRVShaderResourceAttribs::ResourceType::StorageTexelBuffer) ? RESOURCE_STATE_UNORDERED_ACCESS : RESOURCE_STATE_SHADER_RESOURCE; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG const VkAccessFlags RequiredAccessFlags = (RequiredState == RESOURCE_STATE_SHADER_RESOURCE) ? VK_ACCESS_SHADER_READ_BIT : (VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT); @@ -416,7 +416,7 @@ VkDescriptorImageInfo ShaderResourceCacheVk::Resource::GetImageDescriptorWriteIn // object (13.2.4) DescrImgInfo.sampler = pSamplerVk->GetVkSampler(); } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT else { LOG_ERROR_MESSAGE("No sampler is assigned to texture view '", pTexViewVk->GetDesc().Name, "'"); diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index 69883529..af258044 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -220,7 +220,7 @@ void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr<cons } // ); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (SHADER_RESOURCE_VARIABLE_TYPE VarType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; VarType < SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES; VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(VarType + 1)) { VERIFY(CurrResInd[VarType] == m_NumResources[VarType], "Not all resources have been initialized, which will cause a crash when dtor is called"); @@ -229,12 +229,12 @@ void ShaderResourceLayoutVk::InitializeStaticResourceLayout(std::shared_ptr<cons StaticResourceCache.InitializeSets(GetRawAllocator(), 1, &StaticResCacheSize); InitializeResourceMemoryInCache(StaticResourceCache); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG StaticResourceCache.DbgVerifyResourceInitialization(); #endif } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT void ShaderResourceLayoutVk::dvpVerifyResourceLayoutDesc(Uint32 NumShaders, const std::shared_ptr<const SPIRVShaderResources> pShaderResources[], const PipelineResourceLayoutDesc& ResourceLayoutDesc) @@ -344,7 +344,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice* std::vector<uint32_t> SPIRVs[], class PipelineLayout& PipelineLayout) { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT dvpVerifyResourceLayoutDesc(NumShaders, pShaderResources, ResourceLayoutDesc); #endif @@ -361,7 +361,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice* VERIFY_EXPR(NumShaders <= MAX_SHADERS_IN_PIPELINE); std::array<std::array<Uint32, SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES>, MAX_SHADERS_IN_PIPELINE> CurrResInd = {}; std::array<Uint32, MAX_SHADERS_IN_PIPELINE> CurrImmutableSamplerInd = {}; -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG std::unordered_map<Uint32, std::pair<Uint32, Uint32>> dbgBindings_CacheOffsets; #endif @@ -408,7 +408,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice* VERIFY(DescriptorSet <= std::numeric_limits<decltype(VkResource::DescriptorSet)>::max(), "Descriptor set (", DescriptorSet, ") excceeds maximum representable value"); VERIFY(Binding <= std::numeric_limits<decltype(VkResource::Binding)>::max(), "Binding (", Binding, ") excceeds maximum representable value"); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG // Verify that bindings and cache offsets monotonically increase in every descriptor set auto Binding_OffsetIt = dbgBindings_CacheOffsets.find(DescriptorSet); if (Binding_OffsetIt != dbgBindings_CacheOffsets.end()) @@ -501,7 +501,7 @@ void ShaderResourceLayoutVk::Initialize(IRenderDevice* // clang-format on } -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG for (Uint32 s = 0; s < NumShaders; ++s) { auto& Layout = Layouts[s]; @@ -611,7 +611,7 @@ void ShaderResourceLayoutVk::VkResource::CacheUniformBuffer(IDeviceObject* { VERIFY(SpirvAttribs.Type == SPIRVShaderResourceAttribs::ResourceType::UniformBuffer, "Uniform buffer resource is expected"); RefCntAutoPtr<BufferVkImpl> pBufferVk(pBuffer, IID_BufferVk); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT VerifyConstantBufferBinding(SpirvAttribs, GetVariableType(), ArrayInd, pBuffer, pBufferVk.RawPtr(), DstRes.pObject.RawPtr(), ParentResLayout.GetShaderName()); #endif @@ -652,7 +652,7 @@ void ShaderResourceLayoutVk::VkResource::CacheStorageBuffer(IDeviceObject* // clang-format on RefCntAutoPtr<BufferViewVkImpl> pBufferViewVk(pBufferView, IID_BufferViewVk); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { // HLSL buffer SRVs are mapped to storge buffers in GLSL auto RequiredViewType = SpirvAttribs.Type == SPIRVShaderResourceAttribs::ResourceType::ROStorageBuffer ? BUFFER_VIEW_SHADER_RESOURCE : BUFFER_VIEW_UNORDERED_ACCESS; @@ -698,7 +698,7 @@ void ShaderResourceLayoutVk::VkResource::CacheTexelBuffer(IDeviceObject* // clang-format on RefCntAutoPtr<BufferViewVkImpl> pBufferViewVk(pBufferView, IID_BufferViewVk); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { // HLSL buffer SRVs are mapped to storge buffers in GLSL auto RequiredViewType = SpirvAttribs.Type == SPIRVShaderResourceAttribs::ResourceType::StorageTexelBuffer ? BUFFER_VIEW_UNORDERED_ACCESS : BUFFER_VIEW_SHADER_RESOURCE; @@ -747,7 +747,7 @@ void ShaderResourceLayoutVk::VkResource::CacheImage(IDeviceObject* // clang-format on RefCntAutoPtr<TextureViewVkImpl> pTexViewVk0(pTexView, IID_TextureViewVk); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT { // HLSL buffer SRVs are mapped to storge buffers in GLSL auto RequiredViewType = SpirvAttribs.Type == SPIRVShaderResourceAttribs::ResourceType::StorageImage ? TEXTURE_VIEW_UNORDERED_ACCESS : TEXTURE_VIEW_SHADER_RESOURCE; @@ -758,7 +758,7 @@ void ShaderResourceLayoutVk::VkResource::CacheImage(IDeviceObject* { // We can do RawPtr here safely since UpdateCachedResource() returned true auto* pTexViewVk = DstRes.pObject.RawPtr<TextureViewVkImpl>(); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (SpirvAttribs.Type == SPIRVShaderResourceAttribs::ResourceType::SampledImage && !IsImmutableSamplerAssigned()) { if (pTexViewVk->GetSampler() == nullptr) @@ -811,7 +811,7 @@ void ShaderResourceLayoutVk::VkResource::CacheSeparateSampler(IDeviceObject* VERIFY(!IsImmutableSamplerAssigned(), "This separate sampler is assigned an immutable sampler"); RefCntAutoPtr<SamplerVkImpl> pSamplerVk(pSampler, IID_Sampler); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT if (pSampler != nullptr && pSamplerVk == nullptr) { LOG_ERROR_MESSAGE("Failed to bind object '", pSampler->GetDesc().Name, "' to variable '", SpirvAttribs.GetPrintName(ArrayInd), @@ -845,7 +845,7 @@ void ShaderResourceLayoutVk::VkResource::BindResource(IDeviceObject* pObj, Uint3 auto& DstDescrSet = ResourceCache.GetDescriptorSet(DescriptorSet); auto vkDescrSet = DstDescrSet.GetVkDescriptorSet(); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (ResourceCache.DbgGetContentType() == ShaderResourceCacheVk::DbgCacheContentType::SRBResources) { if (VariableType == SHADER_RESOURCE_VARIABLE_TYPE_STATIC || VariableType == SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE) @@ -991,7 +991,7 @@ void ShaderResourceLayoutVk::InitializeStaticResources(const ShaderResourceLayou } -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT bool ShaderResourceLayoutVk::dvpVerifyBindings(const ShaderResourceCacheVk& ResourceCache) const { bool BindingsOK = true; @@ -1012,7 +1012,7 @@ bool ShaderResourceLayoutVk::dvpVerifyBindings(const ShaderResourceCacheVk& Reso LOG_ERROR_MESSAGE("No resource is bound to ", GetShaderVariableTypeLiteralName(Res.GetVariableType()), " variable '", Res.SpirvAttribs.GetPrintName(ArrInd), "' in shader '", GetShaderName(), "'"); BindingsOK = false; } -# ifdef _DEBUG +# ifdef DILIGENT_DEBUG auto vkDescSet = CachedDescrSet.GetVkDescriptorSet(); auto dbgCacheContentType = ResourceCache.DbgGetContentType(); if (dbgCacheContentType == ShaderResourceCacheVk::DbgCacheContentType::StaticShaderResources) @@ -1055,7 +1055,7 @@ void ShaderResourceLayoutVk::CommitDynamicResources(const ShaderResourceCacheVk& VERIFY(NumDynamicResources != 0, "This shader resource layout does not contain dynamic resources"); VERIFY_EXPR(vkDynamicDescriptorSet != VK_NULL_HANDLE); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG static constexpr size_t ImgUpdateBatchSize = 4; static constexpr size_t BuffUpdateBatchSize = 2; static constexpr size_t TexelBuffUpdateBatchSize = 2; @@ -1079,7 +1079,7 @@ void ShaderResourceLayoutVk::CommitDynamicResources(const ShaderResourceCacheVk& auto BuffViewIt = DescrBuffViewArr.begin(); auto WriteDescrSetIt = WriteDescrSetArr.begin(); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG Int32 DynamicDescrSetIndex = -1; #endif @@ -1087,7 +1087,7 @@ void ShaderResourceLayoutVk::CommitDynamicResources(const ShaderResourceCacheVk& { const auto& Res = GetResource(SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC, ResNum); VERIFY_EXPR(Res.GetVariableType() == SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG if (DynamicDescrSetIndex < 0) DynamicDescrSetIndex = Res.DescriptorSet; else diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp index 8f476082..82d26b44 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp @@ -74,7 +74,7 @@ ShaderVariableManagerVk::ShaderVariableManagerVk(IObject& // clang-format off m_Owner {Owner }, m_ResourceCache{ResourceCache} -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG , m_DbgAllocator {Allocator} #endif // clang-format on diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index 147e4f1f..5ed8c222 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -404,7 +404,7 @@ void SwapChainVkImpl::InitBuffersAndViews() auto* pDeviceVkImpl = m_pRenderDevice.RawPtr<RenderDeviceVkImpl>(); auto LogicalVkDevice = pDeviceVkImpl->GetVkDevice(); -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG { uint32_t swapchainImageCount = 0; auto err = vkGetSwapchainImagesKHR(LogicalVkDevice, m_VkSwapChain, &swapchainImageCount, NULL); diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp index c0f49db1..c881f0dd 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp @@ -49,7 +49,7 @@ VulkanCommandBufferPool::VulkanCommandBufferPool(std::shared_ptr<const VulkanLog m_CmdPool = m_LogicalDevice->CreateCommandPool(CmdPoolCI); DEV_CHECK_ERR(m_CmdPool != VK_NULL_HANDLE, "Failed to create vulkan command pool"); -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT m_BuffCounter = 0; #endif } @@ -108,7 +108,7 @@ VkCommandBuffer VulkanCommandBufferPool::GetCommandBuffer(const char* DebugName) auto err = vkBeginCommandBuffer(CmdBuffer, &CmdBuffBeginInfo); DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to begin command buffer"); (void)err; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT ++m_BuffCounter; #endif return CmdBuffer; @@ -119,7 +119,7 @@ void VulkanCommandBufferPool::FreeCommandBuffer(VkCommandBuffer&& CmdBuffer) std::lock_guard<std::mutex> Lock{m_Mutex}; m_CmdBuffers.emplace_back(CmdBuffer); CmdBuffer = VK_NULL_HANDLE; -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT --m_BuffCounter; #endif } diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp index b4d57a7c..5bb694b3 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp @@ -39,7 +39,7 @@ VulkanFencePool::VulkanFencePool(std::shared_ptr<const VulkanLogicalDevice> Logi VulkanFencePool::~VulkanFencePool() { -#ifdef DEVELOPMENT +#ifdef DILIGENT_DEVELOPMENT for (const auto& fence : m_Fences) { DEV_CHECK_ERR(m_LogicalDevice->GetFenceStatus(fence) == VK_SUCCESS, "Destroying a fence that has not been signaled"); diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp index 11eb766d..22eee45e 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp @@ -116,7 +116,7 @@ uint32_t VulkanPhysicalDevice::FindQueueFamily(VkQueueFlags QueueFlags) const { if (QueueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT)) { -#ifdef _DEBUG +#ifdef DILIGENT_DEBUG const auto& Props = m_QueueFamilyProperties[FamilyInd]; // Queues supporting graphics and/or compute operations must report (1,1,1) // in minImageTransferGranularity, meaning that there are no additional restrictions diff --git a/Graphics/GraphicsTools/interface/MapHelper.hpp b/Graphics/GraphicsTools/interface/MapHelper.hpp index 8de2e0cd..7ddd63f8 100644 --- a/Graphics/GraphicsTools/interface/MapHelper.hpp +++ b/Graphics/GraphicsTools/interface/MapHelper.hpp @@ -119,9 +119,11 @@ public: { VERIFY(!m_pBuffer && !m_pMappedData && !m_pContext, "Object already mapped"); Unmap(); -#ifdef _DEBUG - auto& BuffDesc = pBuffer->GetDesc(); - VERIFY(sizeof(DataType) <= BuffDesc.uiSizeInBytes, "Data type size exceeds buffer size"); +#ifdef DILIGENT_DEBUG + { + auto& BuffDesc = pBuffer->GetDesc(); + VERIFY(sizeof(DataType) <= BuffDesc.uiSizeInBytes, "Data type size exceeds buffer size"); + } #endif pContext->MapBuffer(pBuffer, MapType, MapFlags, (PVoid&)m_pMappedData); if (m_pMappedData != nullptr) |
