diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-12-17 20:42:32 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-12-17 20:42:32 +0000 |
| commit | 393288b55058b1c9347aee9a9063d17cf58db172 (patch) | |
| tree | 83f1628de374fce459233b04c7c6ca604e916a16 /Graphics/GraphicsEngine | |
| parent | A bunch of minor updates (comments, parameter validation, etc.) (diff) | |
| download | DiligentCore-393288b55058b1c9347aee9a9063d17cf58db172.tar.gz DiligentCore-393288b55058b1c9347aee9a9063d17cf58db172.zip | |
Another set of minor updates
Diffstat (limited to 'Graphics/GraphicsEngine')
23 files changed, 450 insertions, 426 deletions
diff --git a/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp b/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp index edad49c7..b326bc99 100644 --- a/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp +++ b/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp @@ -40,17 +40,17 @@ namespace Diligent { -/// Template class implementing base functionality for a device object +/// Template class implementing base functionality of the device object template <class BaseInterface, typename RenderDeviceImplType, typename ObjectDescType> class DeviceObjectBase : public ObjectBase<BaseInterface> { public: typedef ObjectBase<BaseInterface> TBase; - /// \param pRefCounters - reference counters object that controls the lifetime of this device object - /// \param pDevice - pointer to the render device. - /// \param ObjDesc - object description. - /// \param bIsDeviceInternal - flag indicating if the object is an internal device object + /// \param pRefCounters - Reference counters object that controls the lifetime of this device object + /// \param pDevice - Pointer to the render device. + /// \param ObjDesc - Object description. + /// \param bIsDeviceInternal - Flag indicating if the object is an internal device object /// and must not keep a strong reference to the device. DeviceObjectBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, @@ -149,7 +149,7 @@ public: /// This unique ID is used to unambiguously identify device object for /// tracking purposes. /// Niether GL handle nor pointer could be safely used for this purpose - /// as both GL reuses released handles and the OS reuses released pointers + /// as both GL reuses released handles and the OS reuses released pointers. return m_UniqueID.GetID(); } diff --git a/Graphics/GraphicsEngine/include/EngineFactoryBase.hpp b/Graphics/GraphicsEngine/include/EngineFactoryBase.hpp index 4faf72c0..7696e482 100644 --- a/Graphics/GraphicsEngine/include/EngineFactoryBase.hpp +++ b/Graphics/GraphicsEngine/include/EngineFactoryBase.hpp @@ -39,9 +39,9 @@ namespace Diligent const APIInfo& GetAPIInfo(); -/// Template class implementing base functionality for an engine factory +/// Template class implementing base functionality of the engine factory -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IEngineFactoryD3D11, Diligent::IEngineFactoryD3D12, /// Diligent::IEngineFactoryVk or Diligent::IEngineFactoryOpenGL). template <class BaseInterface> diff --git a/Graphics/GraphicsEngine/include/FenceBase.hpp b/Graphics/GraphicsEngine/include/FenceBase.hpp index e6a21bbf..0a358524 100644 --- a/Graphics/GraphicsEngine/include/FenceBase.hpp +++ b/Graphics/GraphicsEngine/include/FenceBase.hpp @@ -37,9 +37,9 @@ namespace Diligent { -/// Template class implementing base functionality for a Fence object +/// Template class implementing base functionality of the fence object -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IFenceD3D11, Diligent::IFenceD3D12, /// Diligent::IFenceGL or Diligent::IFenceVk). /// \tparam RenderDeviceImplType - type of the render device implementation @@ -49,10 +49,10 @@ class FenceBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, F public: typedef DeviceObjectBase<BaseInterface, RenderDeviceImplType, FenceDesc> TDeviceObjectBase; - /// \param pRefCounters - reference counters object that controls the lifetime of this command list. - /// \param Desc - fence description - /// \param pDevice - pointer to the device. - /// \param bIsDeviceInternal - flag indicating if the Fence is an internal device object and + /// \param pRefCounters - Reference counters object that controls the lifetime of this command list. + /// \param Desc - Fence description + /// \param pDevice - Pointer to the device. + /// \param bIsDeviceInternal - Flag indicating if the Fence is an internal device object and /// must not keep a strong reference to the device. FenceBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, const FenceDesc& Desc, bool bIsDeviceInternal = false) : TDeviceObjectBase{pRefCounters, pDevice, Desc, bIsDeviceInternal} diff --git a/Graphics/GraphicsEngine/include/FramebufferBase.hpp b/Graphics/GraphicsEngine/include/FramebufferBase.hpp index 0cd484dc..4db590ef 100644 --- a/Graphics/GraphicsEngine/include/FramebufferBase.hpp +++ b/Graphics/GraphicsEngine/include/FramebufferBase.hpp @@ -41,11 +41,11 @@ namespace Diligent void ValidateFramebufferDesc(const FramebufferDesc& Desc) noexcept(false); -/// Template class implementing base functionality for the framebuffer object. +/// Template class implementing base functionality of the framebuffer object. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (e.g. Diligent::IFramebufferVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, /// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class RenderDeviceImplType> @@ -54,10 +54,10 @@ class FramebufferBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplT public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, FramebufferDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this framebuffer pass. - /// \param pDevice - pointer to the device. + /// \param pRefCounters - Reference counters object that controls the lifetime of this framebuffer pass. + /// \param pDevice - Pointer to the device. /// \param Desc - Framebuffer description. - /// \param bIsDeviceInternal - flag indicating if the Framebuffer is an internal device object and + /// \param bIsDeviceInternal - Flag indicating if the Framebuffer is an internal device object and /// must not keep a strong reference to the device. FramebufferBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, @@ -68,32 +68,24 @@ public: { ValidateFramebufferDesc(this->m_Desc); - if (this->m_Desc.AttachmentCount > 0) + if (this->m_Desc.Width == 0 || this->m_Desc.Height == 0 || this->m_Desc.NumArraySlices == 0) { - m_ppAttachments = - ALLOCATE(GetRawAllocator(), "Memory for framebuffer attachment array", ITextureView*, this->m_Desc.AttachmentCount); - this->m_Desc.ppAttachments = m_ppAttachments; for (Uint32 i = 0; i < this->m_Desc.AttachmentCount; ++i) { - if (Desc.ppAttachments[i] == nullptr) + auto* const pAttachment = Desc.ppAttachments[i]; + if (pAttachment == nullptr) continue; - m_ppAttachments[i] = Desc.ppAttachments[i]; - m_ppAttachments[i]->AddRef(); + const auto& ViewDesc = pAttachment->GetDesc(); + const auto& TexDesc = pAttachment->GetTexture()->GetDesc(); - if (this->m_Desc.Width == 0 || this->m_Desc.Height == 0 || this->m_Desc.NumArraySlices == 0) - { - const auto& ViewDesc = m_ppAttachments[i]->GetDesc(); - const auto& TexDesc = m_ppAttachments[i]->GetTexture()->GetDesc(); - - auto MipLevelProps = GetMipLevelProperties(TexDesc, ViewDesc.MostDetailedMip); - if (this->m_Desc.Width == 0) - this->m_Desc.Width = MipLevelProps.LogicalWidth; - if (this->m_Desc.Height == 0) - this->m_Desc.Height = MipLevelProps.LogicalHeight; - if (this->m_Desc.NumArraySlices == 0) - this->m_Desc.NumArraySlices = ViewDesc.NumArraySlices; - } + auto MipLevelProps = GetMipLevelProperties(TexDesc, ViewDesc.MostDetailedMip); + if (this->m_Desc.Width == 0) + this->m_Desc.Width = MipLevelProps.LogicalWidth; + if (this->m_Desc.Height == 0) + this->m_Desc.Height = MipLevelProps.LogicalHeight; + if (this->m_Desc.NumArraySlices == 0) + this->m_Desc.NumArraySlices = ViewDesc.NumArraySlices; } } @@ -108,6 +100,21 @@ public: if (this->m_Desc.NumArraySlices == 0) LOG_ERROR_AND_THROW("The framebuffer array slice count is zero and can't be automatically determined as there are no non-null attachments"); + if (this->m_Desc.AttachmentCount > 0) + { + m_ppAttachments = + ALLOCATE(GetRawAllocator(), "Memory for framebuffer attachment array", ITextureView*, this->m_Desc.AttachmentCount); + this->m_Desc.ppAttachments = m_ppAttachments; + for (Uint32 i = 0; i < this->m_Desc.AttachmentCount; ++i) + { + if (Desc.ppAttachments[i] == nullptr) + continue; + + m_ppAttachments[i] = Desc.ppAttachments[i]; + m_ppAttachments[i]->AddRef(); + } + } + Desc.pRenderPass->AddRef(); } diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp index 54b9ba0c..201a3c72 100644 --- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp @@ -31,9 +31,9 @@ /// Implementation of the Diligent::PipelineStateBase template class #include <array> -#include <vector> #include <unordered_map> #include <unordered_set> +#include <cstring> #include "PipelineState.h" #include "DeviceObjectBase.hpp" @@ -56,12 +56,12 @@ void CopyRayTracingShaderGroups(std::unordered_map<HashMapStringKey, Uint32, Has void CorrectGraphicsPipelineDesc(GraphicsPipelineDesc& GraphicsPipeline) noexcept; -/// Template class implementing base functionality for a pipeline state object. +/// Template class implementing base functionality of the pipeline state object. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IPipelineStateD3D11, Diligent::IPipelineStateD3D12, /// Diligent::IPipelineStateGL or Diligent::IPipelineStateVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, /// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class RenderDeviceImplType> @@ -84,11 +84,13 @@ private: Uint64 DeviceQueuesMask = pDevice->GetCommandQueueMask(); DEV_CHECK_ERR((this->m_Desc.CommandQueueMask & DeviceQueuesMask) != 0, "No bits in the command queue mask (0x", std::hex, this->m_Desc.CommandQueueMask, - ") correspond to one of ", pDevice->GetCommandQueueCount(), " available device command queues"); + ") correspond to one of ", pDevice->GetCommandQueueCount(), " available device command queues."); this->m_Desc.CommandQueueMask &= DeviceQueuesMask; } public: + /// Initializes the object as graphics pipeline + /// \param pRefCounters - Reference counters object that controls the lifetime of this PSO /// \param pDevice - Pointer to the device. /// \param GraphicsPipelineCI - Graphics pipeline create information. @@ -103,6 +105,8 @@ public: ValidateGraphicsPipelineCreateInfo(GraphicsPipelineCI); } + /// Initializes the object as compute pipeline + /// \param pRefCounters - Reference counters object that controls the lifetime of this PSO /// \param pDevice - Pointer to the device. /// \param ComputePipelineCI - Compute pipeline create information. @@ -117,6 +121,8 @@ public: ValidateComputePipelineCreateInfo(ComputePipelineCI); } + /// Initializes the object as ray tracing pipeline + /// \param pRefCounters - Reference counters object that controls the lifetime of this PSO /// \param pDevice - Pointer to the device. /// \param RayTracingPipelineCI - Ray tracing pipeline create information. @@ -231,7 +237,7 @@ public: std::memcpy(pData, &m_pRayTracingPipelineData->Shaders[ShaderHandleSize * iter->second], ShaderHandleSize); return; } - UNEXPECTED("Can't find shader group with specified name"); + UNEXPECTED("Can't find shader group with the specified name"); } protected: @@ -242,7 +248,7 @@ protected: if (!IsConsistentShaderType(ShaderType, this->m_Desc.PipelineType)) { LOG_WARNING_MESSAGE("Unable to get the number of static variables in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is invalid for ", GetPipelineTypeString(this->m_Desc.PipelineType), " pipeline '", this->m_Desc.Name, "'"); + " as the stage is invalid for ", GetPipelineTypeString(this->m_Desc.PipelineType), " pipeline '", this->m_Desc.Name, "'."); return -1; } @@ -251,7 +257,7 @@ protected: if (LayoutInd < 0) { LOG_WARNING_MESSAGE("Unable to get the number of static variables in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is inactive in PSO '", this->m_Desc.Name, "'"); + " as the stage is inactive in PSO '", this->m_Desc.Name, "'."); } return LayoutInd; @@ -262,7 +268,7 @@ protected: if (!IsConsistentShaderType(ShaderType, this->m_Desc.PipelineType)) { LOG_WARNING_MESSAGE("Unable to find static variable '", Name, "' in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is invalid for ", GetPipelineTypeString(this->m_Desc.PipelineType), " pipeline '", this->m_Desc.Name, "'"); + " as the stage is invalid for ", GetPipelineTypeString(this->m_Desc.PipelineType), " pipeline '", this->m_Desc.Name, "'."); return -1; } @@ -271,7 +277,7 @@ protected: if (LayoutInd < 0) { LOG_WARNING_MESSAGE("Unable to find static variable '", Name, "' in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is inactive in PSO '", this->m_Desc.Name, "'"); + " as the stage is inactive in PSO '", this->m_Desc.Name, "'."); } return LayoutInd; @@ -282,7 +288,7 @@ protected: if (!IsConsistentShaderType(ShaderType, this->m_Desc.PipelineType)) { LOG_WARNING_MESSAGE("Unable to get static variable at index ", Index, " in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is invalid for ", GetPipelineTypeString(this->m_Desc.PipelineType), " pipeline '", this->m_Desc.Name, "'"); + " as the stage is invalid for ", GetPipelineTypeString(this->m_Desc.PipelineType), " pipeline '", this->m_Desc.Name, "'."); return -1; } @@ -291,7 +297,7 @@ protected: if (LayoutInd < 0) { LOG_WARNING_MESSAGE("Unable to get static variable at index ", Index, " in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is inactive in PSO '", this->m_Desc.Name, "'"); + " as the stage is inactive in PSO '", this->m_Desc.Name, "'."); } return LayoutInd; @@ -343,10 +349,10 @@ protected: ReserveResourceLayout(CreateInfo.PSODesc.ResourceLayout, MemPool); size_t RTDataSize = sizeof(RayTracingPipelineData); - // reserve size for shader handles + // Reserve space for shader handles const auto ShaderHandleSize = this->m_pDevice->GetProperties().ShaderGroupHandleSize; RTDataSize += ShaderHandleSize * (CreateInfo.GeneralShaderCount + CreateInfo.TriangleHitShaderCount + CreateInfo.ProceduralHitShaderCount); - // Extra bytes are reserved to avoid compiler errors on zero-sized arrays + // Extra bytes were reserved to avoid compiler errors on zero-sized arrays RTDataSize -= sizeof(RayTracingPipelineData::Shaders); MemPool.AddSpace(RTDataSize, alignof(RayTracingPipelineData)); } @@ -459,12 +465,12 @@ protected: } if (ShaderStages[GetShaderTypePipelineIndex(SHADER_TYPE_RAY_GEN, PIPELINE_TYPE_RAY_TRACING)].Count() == 0) - LOG_ERROR_AND_THROW("At least one shader with type SHADER_TYPE_RAY_GEN must be provided"); + LOG_ERROR_AND_THROW("At least one shader with type SHADER_TYPE_RAY_GEN must be provided."); if (ShaderStages[GetShaderTypePipelineIndex(SHADER_TYPE_RAY_MISS, PIPELINE_TYPE_RAY_TRACING)].Count() == 0) - LOG_ERROR_AND_THROW("At least one shader with type SHADER_TYPE_RAY_MISS must be provided"); + LOG_ERROR_AND_THROW("At least one shader with type SHADER_TYPE_RAY_MISS must be provided."); - // remove empty stages + // Remove empty stages for (auto iter = ShaderStages.begin(); iter != ShaderStages.end();) { if (iter->Count() == 0) @@ -626,11 +632,11 @@ protected: CopyResourceLayout(CreateInfo.PSODesc.ResourceLayout, this->m_Desc.ResourceLayout, MemPool); size_t RTDataSize = sizeof(RayTracingPipelineData); - // reserve size for shader handles + // Reserve space for shader handles const auto ShaderHandleSize = this->m_pDevice->GetProperties().ShaderGroupHandleSize; const auto ShaderDataSize = ShaderHandleSize * (CreateInfo.GeneralShaderCount + CreateInfo.TriangleHitShaderCount + CreateInfo.ProceduralHitShaderCount); RTDataSize += ShaderDataSize; - // Extra bytes are reserved to avoid compiler errors on zero-sized arrays + // Extra bytes were reserved to avoid compiler errors on zero-sized arrays RTDataSize -= sizeof(RayTracingPipelineData::Shaders); this->m_pRayTracingPipelineData = static_cast<RayTracingPipelineData*>(MemPool.Allocate(RTDataSize, alignof(RayTracingPipelineData))); diff --git a/Graphics/GraphicsEngine/include/QueryBase.hpp b/Graphics/GraphicsEngine/include/QueryBase.hpp index f0252c0d..879dc880 100644 --- a/Graphics/GraphicsEngine/include/QueryBase.hpp +++ b/Graphics/GraphicsEngine/include/QueryBase.hpp @@ -38,9 +38,9 @@ namespace Diligent { -/// Template class implementing base functionality for a Query object +/// Template class implementing base functionality of the query object -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IQueryD3D11, Diligent::IQueryD3D12, /// Diligent::IQueryGL or Diligent::IQueryVk). /// \tparam RenderDeviceImplType - type of the render device implementation @@ -57,10 +57,10 @@ public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, QueryDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this command list. - /// \param pDevice - pointer to the device. + /// \param pRefCounters - Reference counters object that controls the lifetime of this command list. + /// \param pDevice - Pointer to the device. /// \param Desc - Query description - /// \param bIsDeviceInternal - flag indicating if the Query is an internal device object and + /// \param bIsDeviceInternal - Flag indicating if the Query is an internal device object and /// must not keep a strong reference to the device. QueryBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, @@ -145,7 +145,7 @@ public: { if (m_State != QueryState::Querying) { - LOG_ERROR_MESSAGE("Attempting to end query '", this->m_Desc.Name, "' that has not been begun"); + LOG_ERROR_MESSAGE("Attempting to end query '", this->m_Desc.Name, "' that has not been begun."); return false; } } @@ -154,7 +154,7 @@ public: { if (this->m_Desc.Type != QUERY_TYPE_TIMESTAMP) { - LOG_ERROR_MESSAGE("Ending query '", this->m_Desc.Name, "' that has not been begun"); + LOG_ERROR_MESSAGE("Ending query '", this->m_Desc.Name, "' that has not been begun."); return false; } @@ -162,7 +162,7 @@ public: } else if (m_pContext != pContext) { - LOG_ERROR_MESSAGE("Query '", this->m_Desc.Name, "' has been begun by another context"); + LOG_ERROR_MESSAGE("Query '", this->m_Desc.Name, "' has been begun by another context."); return false; } @@ -179,7 +179,7 @@ public: { if (m_State != QueryState::Ended) { - LOG_ERROR_MESSAGE("Attempting to get data of query '", this->m_Desc.Name, "' that has not been ended"); + LOG_ERROR_MESSAGE("Attempting to get data of query '", this->m_Desc.Name, "' that has not been ended."); return false; } @@ -191,17 +191,17 @@ public: return false; } - static_assert(QUERY_TYPE_NUM_TYPES == 6, "Not all QUERY_TYPE enum values are handled below"); + static_assert(QUERY_TYPE_NUM_TYPES == 6, "Not all QUERY_TYPE enum values are handled below."); switch (this->m_Desc.Type) { case QUERY_TYPE_UNDEFINED: - UNEXPECTED("Undefined query type is unexpected"); + UNEXPECTED("Undefined query type is unexpected."); return false; case QUERY_TYPE_OCCLUSION: if (DataSize != sizeof(QueryDataOcclusion)) { - LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataOcclusion), " (aka sizeof(QueryDataOcclusion)) is expected"); + LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataOcclusion), " (aka sizeof(QueryDataOcclusion)) is expected."); return false; } break; @@ -209,7 +209,7 @@ public: case QUERY_TYPE_BINARY_OCCLUSION: if (DataSize != sizeof(QueryDataBinaryOcclusion)) { - LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataBinaryOcclusion), " (aka sizeof(QueryDataBinaryOcclusion)) is expected"); + LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataBinaryOcclusion), " (aka sizeof(QueryDataBinaryOcclusion)) is expected."); return false; } break; @@ -217,7 +217,7 @@ public: case QUERY_TYPE_TIMESTAMP: if (DataSize != sizeof(QueryDataTimestamp)) { - LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataTimestamp), " (aka sizeof(QueryDataTimestamp)) is expected"); + LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataTimestamp), " (aka sizeof(QueryDataTimestamp)) is expected."); return false; } break; @@ -225,7 +225,7 @@ public: case QUERY_TYPE_PIPELINE_STATISTICS: if (DataSize != sizeof(QueryDataPipelineStatistics)) { - LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataPipelineStatistics), " (aka sizeof(QueryDataPipelineStatistics)) is expected"); + LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataPipelineStatistics), " (aka sizeof(QueryDataPipelineStatistics)) is expected."); return false; } break; @@ -233,13 +233,13 @@ public: case QUERY_TYPE_DURATION: if (DataSize != sizeof(QueryDataDuration)) { - LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataDuration), " (aka sizeof(QueryDataDuration)) is expected"); + LOG_ERROR_MESSAGE("The size of query data (", DataSize, ") is incorrect: ", sizeof(QueryDataDuration), " (aka sizeof(QueryDataDuration)) is expected."); return false; } break; default: - UNEXPECTED("Unexpected query type"); + UNEXPECTED("Unexpected query type."); return false; } } diff --git a/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp b/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp index cff25a92..ec6b846d 100644 --- a/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp +++ b/Graphics/GraphicsEngine/include/RenderDeviceBase.hpp @@ -237,11 +237,11 @@ public: const size_t SBTObjSize; }; - /// \param pRefCounters - reference counters object that controls the lifetime of this render device - /// \param RawMemAllocator - allocator that will be used to allocate memory for all device objects (including render device itself) - /// \param pEngineFactory - engine factory that was used to create this device - /// \param NumDeferredContexts - number of deferred device contexts - /// \param ObjectSizes - device object sizes + /// \param pRefCounters - Reference counters object that controls the lifetime of this render device + /// \param RawMemAllocator - Allocator that will be used to allocate memory for all device objects (including render device itself) + /// \param pEngineFactory - Engine factory that was used to create this device + /// \param NumDeferredContexts - The number of deferred device contexts + /// \param ObjectSizes - Device object sizes /// /// \remarks Render device uses fixed block allocators (see FixedBlockMemoryAllocator) to allocate memory for /// device objects. The object sizes provided to constructor are used to initialize the allocators. @@ -482,13 +482,13 @@ void RenderDeviceBase<BaseInterface>::CreateResourceMapping(const ResourceMappin } -/// \tparam TObjectType - type of the object being created (IBuffer, ITexture, etc.) -/// \tparam TObjectDescType - type of the object description structure (BufferDesc, TextureDesc, etc.) -/// \tparam TObjectConstructor - type of the function that constructs the object -/// \param ObjectTypeName - string name of the object type ("buffer", "texture", etc.) -/// \param Desc - object description -/// \param ppObject - memory address where the pointer to the created object will be stored -/// \param ConstructObject - function that constructs the object +/// \tparam TObjectType - The type of the object being created (IBuffer, ITexture, etc.). +/// \tparam TObjectDescType - The type of the object description structure (BufferDesc, TextureDesc, etc.). +/// \tparam TObjectConstructor - The type of the function that constructs the object. +/// \param ObjectTypeName - String name of the object type ("buffer", "texture", etc.). +/// \param Desc - Object description. +/// \param ppObject - Memory address where the pointer to the created object will be stored. +/// \param ConstructObject - Function that constructs the object. template <typename BaseInterface> template <typename TObjectType, typename TObjectDescType, typename TObjectConstructor> void RenderDeviceBase<BaseInterface>::CreateDeviceObject(const Char* ObjectTypeName, const TObjectDescType& Desc, TObjectType** ppObject, TObjectConstructor ConstructObject) diff --git a/Graphics/GraphicsEngine/include/RenderPassBase.hpp b/Graphics/GraphicsEngine/include/RenderPassBase.hpp index 627c2094..9eda4d36 100644 --- a/Graphics/GraphicsEngine/include/RenderPassBase.hpp +++ b/Graphics/GraphicsEngine/include/RenderPassBase.hpp @@ -57,11 +57,11 @@ inline void _CorrectAttachmentState<class RenderDeviceVkImpl>(RESOURCE_STATE& St } } -/// Template class implementing base functionality for the render pass object. +/// Template class implementing base functionality of the render pass object. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (e.g. Diligent::IRenderPassVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, /// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class RenderDeviceImplType> @@ -70,10 +70,10 @@ class RenderPassBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplTy public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, RenderPassDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this render pass. - /// \param pDevice - pointer to the device. + /// \param pRefCounters - Reference counters object that controls the lifetime of this render pass. + /// \param pDevice - Pointer to the device. /// \param Desc - Render pass description. - /// \param bIsDeviceInternal - flag indicating if the RenderPass is an internal device object and + /// \param bIsDeviceInternal - Flag indicating if the RenderPass is an internal device object and /// must not keep a strong reference to the device. RenderPassBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, diff --git a/Graphics/GraphicsEngine/include/ResourceMappingImpl.hpp b/Graphics/GraphicsEngine/include/ResourceMappingImpl.hpp index ad70ae9d..5f9a5440 100644 --- a/Graphics/GraphicsEngine/include/ResourceMappingImpl.hpp +++ b/Graphics/GraphicsEngine/include/ResourceMappingImpl.hpp @@ -88,14 +88,14 @@ private: { using TBase = HashMapStringKey; - ResMappingHashKey(const Char* Str, bool bMakeCopy, Uint32 ArrInd) : + ResMappingHashKey(const Char* Str, bool bMakeCopy, Uint32 ArrInd) noexcept : HashMapStringKey{Str, bMakeCopy}, ArrayIndex{ArrInd} { Ownership_Hash = (ComputeHash(GetHash(), ArrInd) & HashMask) | (Ownership_Hash & StrOwnershipMask); } - ResMappingHashKey(ResMappingHashKey&& rhs) : + ResMappingHashKey(ResMappingHashKey&& rhs) noexcept : HashMapStringKey{std::move(rhs)}, ArrayIndex{rhs.ArrayIndex} {} diff --git a/Graphics/GraphicsEngine/include/SamplerBase.hpp b/Graphics/GraphicsEngine/include/SamplerBase.hpp index 4c9c505d..8e62cc2f 100644 --- a/Graphics/GraphicsEngine/include/SamplerBase.hpp +++ b/Graphics/GraphicsEngine/include/SamplerBase.hpp @@ -37,12 +37,12 @@ namespace Diligent { -/// Template class implementing base functionality for a sampler object. +/// Template class implementing base functionality of the sampler object. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::ISamplerD3D11, Diligent::ISamplerD3D12, /// Diligent::ISamplerGL or Diligent::ISamplerVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, /// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class RenderDeviceImplType> @@ -51,10 +51,10 @@ class SamplerBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, SamplerDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this sampler. - /// \param pDevice - pointer to the device. - /// \param SamDesc - sampler description. - /// \param bIsDeviceInternal - flag indicating if the sampler is an internal device object and + /// \param pRefCounters - Reference counters object that controls the lifetime of this sampler. + /// \param pDevice - Pointer to the device. + /// \param SamDesc - Sampler description. + /// \param bIsDeviceInternal - Flag indicating if the sampler is an internal device object and /// must not keep a strong reference to the device. SamplerBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, const SamplerDesc& SamDesc, bool bIsDeviceInternal = false) : TDeviceObjectBase{pRefCounters, pDevice, SamDesc, bIsDeviceInternal} diff --git a/Graphics/GraphicsEngine/include/ShaderBase.hpp b/Graphics/GraphicsEngine/include/ShaderBase.hpp index 8b6e9efa..15185845 100644 --- a/Graphics/GraphicsEngine/include/ShaderBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderBase.hpp @@ -42,12 +42,12 @@ namespace Diligent { -/// Template class implementing base functionality for a shader object +/// Template class implementing base functionality of the shader object -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IShaderD3D11, Diligent::IShaderD3D12, /// Diligent::IShaderGL or Diligent::IShaderVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, /// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class RenderDeviceImplType> @@ -56,10 +56,10 @@ class ShaderBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, ShaderDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this shader. - /// \param pDevice - pointer to the device. - /// \param ShdrDesc - shader description. - /// \param bIsDeviceInternal - flag indicating if the shader is an internal device object and + /// \param pRefCounters - Reference counters object that controls the lifetime of this shader. + /// \param pDevice - Pointer to the device. + /// \param ShdrDesc - Shader description. + /// \param bIsDeviceInternal - Flag indicating if the shader is an internal device object and /// must not keep a strong reference to the device. ShaderBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, @@ -69,19 +69,19 @@ public: { const auto& deviceFeatures = pDevice->GetDeviceCaps().Features; if (ShdrDesc.ShaderType == SHADER_TYPE_GEOMETRY && !deviceFeatures.GeometryShaders) - LOG_ERROR_AND_THROW("Geometry shaders are not supported by this device"); + LOG_ERROR_AND_THROW("Geometry shaders are not supported by this device."); if ((ShdrDesc.ShaderType == SHADER_TYPE_DOMAIN || ShdrDesc.ShaderType == SHADER_TYPE_HULL) && !deviceFeatures.Tessellation) - LOG_ERROR_AND_THROW("Tessellation shaders are not supported by this device"); + LOG_ERROR_AND_THROW("Tessellation shaders are not supported by this device."); if (ShdrDesc.ShaderType == SHADER_TYPE_COMPUTE && !deviceFeatures.ComputeShaders) - LOG_ERROR_AND_THROW("Compute shaders are not supported by this device"); + LOG_ERROR_AND_THROW("Compute shaders are not supported by this device."); if ((ShdrDesc.ShaderType == SHADER_TYPE_AMPLIFICATION || ShdrDesc.ShaderType == SHADER_TYPE_MESH) && !deviceFeatures.MeshShaders) - LOG_ERROR_AND_THROW("Mesh shaders are not supported by this device"); + LOG_ERROR_AND_THROW("Mesh shaders are not supported by this device."); if ((ShdrDesc.ShaderType >= SHADER_TYPE_RAY_GEN && ShdrDesc.ShaderType <= SHADER_TYPE_CALLABLE) && !deviceFeatures.RayTracing) - LOG_ERROR_AND_THROW("Ray tracing shaders are not supported by this device"); + LOG_ERROR_AND_THROW("Ray tracing shaders are not supported by this device."); } IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_Shader, TDeviceObjectBase) diff --git a/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp b/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp index 340d8821..9554dda1 100644 --- a/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp @@ -31,6 +31,7 @@ /// Implementation of the Diligent::ShaderBindingTableBase template class #include <unordered_map> +#include <cstring> #include "ShaderBindingTable.h" #include "TopLevelASBase.hpp" @@ -45,11 +46,11 @@ namespace Diligent /// Validates SBT description and throws an exception in case of an error. void ValidateShaderBindingTableDesc(const ShaderBindingTableDesc& Desc, Uint32 ShaderGroupHandleSize, Uint32 MaxShaderRecordStride) noexcept(false); -/// Template class implementing base functionality for a shader binding table object. +/// Template class implementing base functionality of the shader binding table object. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IShaderBindingTableD3D12 or Diligent::IShaderBindingTableVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D12Impl or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class PipelineStateImplType, class TopLevelASImplType, class RenderDeviceImplType> class ShaderBindingTableBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, ShaderBindingTableDesc> @@ -57,10 +58,10 @@ class ShaderBindingTableBase : public DeviceObjectBase<BaseInterface, RenderDevi public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, ShaderBindingTableDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this SBT. - /// \param pDevice - pointer to the device. + /// \param pRefCounters - Reference counters object that controls the lifetime of this SBT. + /// \param pDevice - Pointer to the device. /// \param Desc - SBT description. - /// \param bIsDeviceInternal - flag indicating if the BLAS is an internal device object and + /// \param bIsDeviceInternal - Flag indicating if the BLAS is an internal device object and /// must not keep a strong reference to the device. ShaderBindingTableBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, @@ -351,7 +352,7 @@ public: if (Count == ShSize) { - LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: shader in '", GroupName, "'(", i / Stride, ") is not bound"); + LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: shader in '", GroupName, "'(", i / Stride, ") is not bound."); return false; } } @@ -362,10 +363,10 @@ public: for (size_t j = ShSize; j < Stride; ++j) Count += (Data[i + j] == EmptyElem); - // shader record data may not used in shader + // shader record data may not be used in the shader if (Count == Stride - ShSize) { - LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: shader record data in '", GroupName, "'(", i / Stride, ") is not initialized"); + LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: shader record data in '", GroupName, "' (", i / Stride, ") is not initialized."); return false; } } @@ -375,7 +376,7 @@ public: if (m_RayGenShaderRecord.empty()) { - LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: ray generation shader is not bound"); + LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: ray generation shader is not bound."); return false; } @@ -387,18 +388,18 @@ public: auto pTLAS = Binding.pTLAS.Lock(); if (!Binding.IsBound) { - LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: hit group at index (", i, ") is not bound"); + LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: hit group at index (", i, ") is not bound."); return false; } if (!pTLAS) { - LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: TLAS that was used to bind hit group at index (", i, ") was deleted"); + LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: TLAS that was used to bind hit group at index (", i, ") was deleted."); return false; } if (pTLAS->GetVersion() != Binding.Version) { LOG_INFO_MESSAGE("Shader binding table '", this->m_Desc.Name, "' is not valid: TLAS that was used to bind hit group at index '(", i, - ") with name '", pTLAS->GetDesc().Name, " was changed and no longer compatible with SBT"); + ") with name '", pTLAS->GetDesc().Name, " was changed and no longer compatible with SBT."); return false; } } @@ -463,7 +464,7 @@ public: pSBTBuffer = this->m_pBuffer; - if (m_RayGenShaderRecord.size()) + if (!m_RayGenShaderRecord.empty()) { RaygenShaderBindingTable.pData = this->m_Changed ? m_RayGenShaderRecord.data() : nullptr; RaygenShaderBindingTable.Offset = RayGenOffset; @@ -471,7 +472,7 @@ public: RaygenShaderBindingTable.Stride = this->m_ShaderRecordStride; } - if (m_MissShadersRecord.size()) + if (!m_MissShadersRecord.empty()) { MissShaderBindingTable.pData = this->m_Changed ? m_MissShadersRecord.data() : nullptr; MissShaderBindingTable.Offset = MissShaderOffset; @@ -479,7 +480,7 @@ public: MissShaderBindingTable.Stride = this->m_ShaderRecordStride; } - if (m_HitGroupsRecord.size()) + if (!m_HitGroupsRecord.empty()) { HitShaderBindingTable.pData = this->m_Changed ? m_HitGroupsRecord.data() : nullptr; HitShaderBindingTable.Offset = HitGroupOffset; @@ -487,7 +488,7 @@ public: HitShaderBindingTable.Stride = this->m_ShaderRecordStride; } - if (m_CallableShadersRecord.size()) + if (!m_CallableShadersRecord.empty()) { CallableShaderBindingTable.pData = this->m_Changed ? m_CallableShadersRecord.data() : nullptr; CallableShaderBindingTable.Offset = CallableShadersOffset; diff --git a/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp b/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp index a8725fd0..8839bb24 100644 --- a/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderResourceBindingBase.hpp @@ -42,9 +42,9 @@ namespace Diligent { -/// Template class implementing base functionality for a shader resource binding +/// Template class implementing base functionality of the shader resource binding -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::IShaderResourceBindingGL, Diligent::IShaderResourceBindingD3D11, /// Diligent::IShaderResourceBindingD3D12 or Diligent::IShaderResourceBindingVk). /// \tparam PipelineStateImplType - Type of the pipeline state implementation @@ -55,10 +55,10 @@ class ShaderResourceBindingBase : public ObjectBase<BaseInterface> public: typedef ObjectBase<BaseInterface> TObjectBase; - /// \param pRefCounters - reference counters object that controls the lifetime of this SRB. - /// \param pPSO - pipeline state that this SRB belongs to. - /// \param IsInternal - flag indicating if the shader resource binding is an internal PSO object and - /// must not keep a strong reference to the PSO. + /// \param pRefCounters - Reference counters object that controls the lifetime of this SRB. + /// \param pPSO - Pipeline state that this SRB belongs to. + /// \param IsInternal - Flag indicating if the shader resource binding is an internal PSO object and + /// must not keep a strong reference to the PSO. ShaderResourceBindingBase(IReferenceCounters* pRefCounters, PipelineStateImplType* pPSO, bool IsInternal = false) : TObjectBase{pRefCounters}, m_spPSO{IsInternal ? nullptr : pPSO}, @@ -92,7 +92,7 @@ protected: if (!IsConsistentShaderType(ShaderType, PipelineType)) { LOG_WARNING_MESSAGE("Unable to find mutable/dynamic variable '", Name, "' in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is invalid for ", GetPipelineTypeString(m_pPSO->GetDesc().PipelineType), " pipeline '", m_pPSO->GetDesc().Name, "'"); + " as the stage is invalid for ", GetPipelineTypeString(m_pPSO->GetDesc().PipelineType), " pipeline '", m_pPSO->GetDesc().Name, "'."); return -1; } @@ -101,7 +101,7 @@ protected: if (ResLayoutInd < 0) { LOG_WARNING_MESSAGE("Unable to find mutable/dynamic variable '", Name, "' in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is inactive in PSO '", m_pPSO->GetDesc().Name, "'"); + " as the stage is inactive in PSO '", m_pPSO->GetDesc().Name, "'."); } return ResLayoutInd; @@ -113,7 +113,7 @@ protected: if (!IsConsistentShaderType(ShaderType, PipelineType)) { LOG_WARNING_MESSAGE("Unable to get the number of mutable/dynamic variables in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is invalid for ", GetPipelineTypeString(m_pPSO->GetDesc().PipelineType), " pipeline '", m_pPSO->GetDesc().Name, "'"); + " as the stage is invalid for ", GetPipelineTypeString(m_pPSO->GetDesc().PipelineType), " pipeline '", m_pPSO->GetDesc().Name, "'."); return -1; } @@ -122,7 +122,7 @@ protected: if (ResLayoutInd < 0) { LOG_WARNING_MESSAGE("Unable to get the number of mutable/dynamic variables in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is inactive in PSO '", m_pPSO->GetDesc().Name, "'"); + " as the stage is inactive in PSO '", m_pPSO->GetDesc().Name, "'."); } return ResLayoutInd; @@ -134,7 +134,7 @@ protected: if (!IsConsistentShaderType(ShaderType, PipelineType)) { LOG_WARNING_MESSAGE("Unable to get mutable/dynamic variable at index ", Index, " in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is invalid for ", GetPipelineTypeString(m_pPSO->GetDesc().PipelineType), " pipeline '", m_pPSO->GetDesc().Name, "'"); + " as the stage is invalid for ", GetPipelineTypeString(m_pPSO->GetDesc().PipelineType), " pipeline '", m_pPSO->GetDesc().Name, "'."); return -1; } @@ -143,7 +143,7 @@ protected: if (ResLayoutInd < 0) { LOG_WARNING_MESSAGE("Unable to get mutable/dynamic variable at index ", Index, " in shader stage ", GetShaderTypeLiteralName(ShaderType), - " as the stage is inactive in PSO '", m_pPSO->GetDesc().Name, "'"); + " as the stage is inactive in PSO '", m_pPSO->GetDesc().Name, "'."); } return ResLayoutInd; diff --git a/Graphics/GraphicsEngine/include/SwapChainBase.hpp b/Graphics/GraphicsEngine/include/SwapChainBase.hpp index 4c0f685d..c7eae660 100644 --- a/Graphics/GraphicsEngine/include/SwapChainBase.hpp +++ b/Graphics/GraphicsEngine/include/SwapChainBase.hpp @@ -42,7 +42,7 @@ namespace Diligent /// Base implementation of the swap chain. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::ISwapChainGL, Diligent::ISwapChainD3D11, /// Diligent::ISwapChainD3D12 or Diligent::ISwapChainVk). /// \remarks Swap chain holds the strong reference to the device and a weak reference to the @@ -53,10 +53,10 @@ class SwapChainBase : public ObjectBase<BaseInterface> public: using TObjectBase = ObjectBase<BaseInterface>; - /// \param pRefCounters - reference counters object that controls the lifetime of this swap chain. - /// \param pDevice - pointer to the device. - /// \param pDeviceContext - pointer to the device context. - /// \param SCDesc - swap chain description + /// \param pRefCounters - Reference counters object that controls the lifetime of this swap chain. + /// \param pDevice - Pointer to the device. + /// \param pDeviceContext - Pointer to the device context. + /// \param SCDesc - Swap chain description SwapChainBase(IReferenceCounters* pRefCounters, IRenderDevice* pDevice, IDeviceContext* pDeviceContext, diff --git a/Graphics/GraphicsEngine/include/TextureBase.hpp b/Graphics/GraphicsEngine/include/TextureBase.hpp index ddd1a378..849e73ef 100644 --- a/Graphics/GraphicsEngine/include/TextureBase.hpp +++ b/Graphics/GraphicsEngine/include/TextureBase.hpp @@ -82,13 +82,13 @@ class TextureBase : public DeviceObjectBase<BaseInterface, TRenderDeviceImpl, Te public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, TRenderDeviceImpl, TextureDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this texture. - /// \param TexViewObjAllocator - allocator that is used to allocate memory for the instances of the texture view object. + /// \param pRefCounters - Reference counters object that controls the lifetime of this texture. + /// \param TexViewObjAllocator - Allocator that is used to allocate memory for the instances of the texture view object. /// This parameter is only used for debug purposes. - /// \param pDevice - pointer to the device - /// \param Desc - texture description - /// \param bIsDeviceInternal - flag indicating if the texture is an internal device object and - /// must not keep a strong reference to the device + /// \param pDevice - Pointer to the device + /// \param Desc - Texture description + /// \param bIsDeviceInternal - Flag indicating if the texture is an internal device object and + /// must not keep a strong reference to the device TextureBase(IReferenceCounters* pRefCounters, TTexViewObjAllocator& TexViewObjAllocator, TRenderDeviceImpl* pDevice, @@ -149,15 +149,15 @@ public: { DEV_CHECK_ERR(ViewDesc.ViewType != TEXTURE_VIEW_UNDEFINED, "Texture view type is not specified"); if (ViewDesc.ViewType == TEXTURE_VIEW_SHADER_RESOURCE) - DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_SHADER_RESOURCE, "Attempting to create SRV for texture '", this->m_Desc.Name, "' that was not created with BIND_SHADER_RESOURCE flag"); + DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_SHADER_RESOURCE, "Attempting to create SRV for texture '", this->m_Desc.Name, "' that was not created with BIND_SHADER_RESOURCE flag."); else if (ViewDesc.ViewType == TEXTURE_VIEW_UNORDERED_ACCESS) - DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_UNORDERED_ACCESS, "Attempting to create UAV for texture '", this->m_Desc.Name, "' that was not created with BIND_UNORDERED_ACCESS flag"); + DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_UNORDERED_ACCESS, "Attempting to create UAV for texture '", this->m_Desc.Name, "' that was not created with BIND_UNORDERED_ACCESS flag."); else if (ViewDesc.ViewType == TEXTURE_VIEW_RENDER_TARGET) - DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_RENDER_TARGET, "Attempting to create RTV for texture '", this->m_Desc.Name, "' that was not created with BIND_RENDER_TARGET flag"); + DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_RENDER_TARGET, "Attempting to create RTV for texture '", this->m_Desc.Name, "' that was not created with BIND_RENDER_TARGET flag."); else if (ViewDesc.ViewType == TEXTURE_VIEW_DEPTH_STENCIL) - DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_DEPTH_STENCIL, "Attempting to create DSV for texture '", this->m_Desc.Name, "' that was not created with BIND_DEPTH_STENCIL flag"); + DEV_CHECK_ERR(this->m_Desc.BindFlags & BIND_DEPTH_STENCIL, "Attempting to create DSV for texture '", this->m_Desc.Name, "' that was not created with BIND_DEPTH_STENCIL flag."); else - UNEXPECTED("Unexpected texture view type"); + UNEXPECTED("Unexpected texture view type."); CreateViewInternal(ViewDesc, ppView, false); } @@ -217,8 +217,8 @@ public: ITextureView* pView = nullptr; CreateViewInternal(ViewDesc, &pView, true); - VERIFY(pView != nullptr, "Failed to create default view for texture '", this->m_Desc.Name, "'"); - VERIFY(pView->GetDesc().ViewType == ViewType, "Unexpected view type"); + VERIFY(pView != nullptr, "Failed to create default view for texture '", this->m_Desc.Name, "'."); + VERIFY(pView->GetDesc().ViewType == ViewType, "Unexpected view type."); return static_cast<TTextureViewImpl*>(pView); }; diff --git a/Graphics/GraphicsEngine/include/TextureViewBase.hpp b/Graphics/GraphicsEngine/include/TextureViewBase.hpp index 07552d97..8566f271 100644 --- a/Graphics/GraphicsEngine/include/TextureViewBase.hpp +++ b/Graphics/GraphicsEngine/include/TextureViewBase.hpp @@ -38,12 +38,12 @@ namespace Diligent { -/// Template class implementing base functionality for a texture view interface +/// Template class implementing base functionality of the texture view interface -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::ITextureViewD3D11, Diligent::ITextureViewD3D12, /// Diligent::ITextureViewGL or Diligent::ITextureViewVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D11Impl, Diligent::RenderDeviceD3D12Impl, /// Diligent::RenderDeviceGLImpl, or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class RenderDeviceImplType> @@ -53,11 +53,11 @@ public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, TextureViewDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this texture view. - /// \param pDevice - pointer to the render device. - /// \param ViewDesc - texture view description. - /// \param pTexture - pointer to the texture that the view is to be created for. - /// \param bIsDefaultView - flag indicating if the view is default view, and is thus + /// \param pRefCounters - Reference counters object that controls the lifetime of this texture view. + /// \param pDevice - Pointer to the render device. + /// \param ViewDesc - Texture view description. + /// \param pTexture - Pointer to the texture that the view is to be created for. + /// \param bIsDefaultView - Flag indicating if the view is default view, and is thus /// part of the texture object. In this case the view will attach /// to the texture's reference counters. TextureViewBase(IReferenceCounters* pRefCounters, diff --git a/Graphics/GraphicsEngine/include/TopLevelASBase.hpp b/Graphics/GraphicsEngine/include/TopLevelASBase.hpp index c1b73ebc..497a8ed8 100644 --- a/Graphics/GraphicsEngine/include/TopLevelASBase.hpp +++ b/Graphics/GraphicsEngine/include/TopLevelASBase.hpp @@ -46,11 +46,11 @@ namespace Diligent /// Validates top-level AS description and throws an exception in case of an error. void ValidateTopLevelASDesc(const TopLevelASDesc& Desc) noexcept(false); -/// Template class implementing base functionality for a top-level acceleration structure object. +/// Template class implementing base functionality of the top-level acceleration structure object. -/// \tparam BaseInterface - base interface that this class will inheret +/// \tparam BaseInterface - Base interface that this class will inheret /// (Diligent::ITopLevelASD3D12 or Diligent::ITopLevelASVk). -/// \tparam RenderDeviceImplType - type of the render device implementation +/// \tparam RenderDeviceImplType - Type of the render device implementation /// (Diligent::RenderDeviceD3D12Impl or Diligent::RenderDeviceVkImpl) template <class BaseInterface, class BottomLevelASType, class RenderDeviceImplType> class TopLevelASBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, TopLevelASDesc> @@ -69,10 +69,10 @@ private: public: using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, TopLevelASDesc>; - /// \param pRefCounters - reference counters object that controls the lifetime of this BLAS. - /// \param pDevice - pointer to the device. + /// \param pRefCounters - Reference counters object that controls the lifetime of this BLAS. + /// \param pDevice - Pointer to the device. /// \param Desc - TLAS description. - /// \param bIsDeviceInternal - flag indicating if the BLAS is an internal device object and + /// \param bIsDeviceInternal - Flag indicating if the BLAS is an internal device object and /// must not keep a strong reference to the device. TopLevelASBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, @@ -140,14 +140,14 @@ public: this->m_BuildInfo.InstanceCount = InstanceCount; #ifdef DILIGENT_DEVELOPMENT - this->m_DbgVersion.fetch_add(1); + this->m_DvpVersion.fetch_add(1); #endif return true; } catch (...) { #ifdef DILIGENT_DEVELOPMENT - this->m_DbgVersion.fetch_add(1); + this->m_DvpVersion.fetch_add(1); #endif ClearInstanceData(); return false; @@ -201,7 +201,7 @@ public: Changed = Changed || (this->m_BuildInfo.LastContributionToHitGroupIndex != InstanceOffset); Changed = Changed || (this->m_BuildInfo.BindingMode != BindingMode); if (Changed) - this->m_DbgVersion.fetch_add(1); + this->m_DvpVersion.fetch_add(1); #endif this->m_BuildInfo.HitGroupStride = HitGroupStride; this->m_BuildInfo.FirstContributionToHitGroupIndex = BaseContributionToHitGroupIndex; @@ -227,10 +227,11 @@ public: VERIFY_EXPR(this->m_StringPool.GetRemainingSize() == 0); #ifdef DILIGENT_DEVELOPMENT - this->m_DbgVersion.fetch_add(1); + this->m_DvpVersion.fetch_add(1); #endif } + /// Implementation of ITopLevelAS::GetInstanceDesc(). virtual TLASInstanceDesc DILIGENT_CALL_TYPE GetInstanceDesc(const char* Name) const override final { VERIFY_EXPR(Name != nullptr && Name[0] != '\0'); @@ -255,11 +256,13 @@ public: return Result; } + /// Implementation of ITopLevelAS::GetBuildInfo(). virtual TLASBuildInfo DILIGENT_CALL_TYPE GetBuildInfo() const override final { return m_BuildInfo; } + /// Implementation of ITopLevelAS::SetState(). virtual void DILIGENT_CALL_TYPE SetState(RESOURCE_STATE State) override final { VERIFY(State == RESOURCE_STATE_UNKNOWN || State == RESOURCE_STATE_BUILD_AS_READ || State == RESOURCE_STATE_BUILD_AS_WRITE || State == RESOURCE_STATE_RAY_TRACING, @@ -267,6 +270,7 @@ public: this->m_State = State; } + /// Implementation of ITopLevelAS::GetState(). virtual RESOURCE_STATE DILIGENT_CALL_TYPE GetState() const override final { return this->m_State; @@ -308,15 +312,15 @@ public: if (Inst.Version != Inst.pBLAS->GetVersion()) { - LOG_ERROR_MESSAGE("Instance with name ('", NameAndInst.first.GetStr(), "') has BLAS with name ('", Inst.pBLAS->GetDesc().Name, - "') that was changed after TLAS build, you must rebuild TLAS"); + LOG_ERROR_MESSAGE("Instance with name '", NameAndInst.first.GetStr(), "' contains BLAS with name '", Inst.pBLAS->GetDesc().Name, + "' that was changed after TLAS build, you must rebuild TLAS"); result = false; } if (Inst.pBLAS->IsInKnownState() && Inst.pBLAS->GetState() != RESOURCE_STATE_BUILD_AS_READ) { - LOG_ERROR_MESSAGE("Instance with name ('", NameAndInst.first.GetStr(), "') has BLAS with name ('", Inst.pBLAS->GetDesc().Name, - "') that must be in BUILD_AS_READ state, but current state is ", + LOG_ERROR_MESSAGE("Instance with name '", NameAndInst.first.GetStr(), "' contains BLAS with name '", Inst.pBLAS->GetDesc().Name, + "' that must be in BUILD_AS_READ state, but current state is ", GetResourceStateFlagString(Inst.pBLAS->GetState())); result = false; } @@ -326,7 +330,7 @@ public: Uint32 GetVersion() const { - return this->m_DbgVersion.load(); + return this->m_DvpVersion.load(); } #endif // DILIGENT_DEVELOPMENT @@ -375,10 +379,11 @@ protected: ScratchBufferSizes m_ScratchSize; std::unordered_map<HashMapStringKey, InstanceDesc, HashMapStringKey::Hasher> m_Instances; - StringPool m_StringPool; + + StringPool m_StringPool; #ifdef DILIGENT_DEVELOPMENT - std::atomic<Uint32> m_DbgVersion{0}; + std::atomic<Uint32> m_DvpVersion{0}; #endif }; diff --git a/Graphics/GraphicsEngine/src/DeviceContextBase.cpp b/Graphics/GraphicsEngine/src/DeviceContextBase.cpp index 72a05729..6e355b01 100644 --- a/Graphics/GraphicsEngine/src/DeviceContextBase.cpp +++ b/Graphics/GraphicsEngine/src/DeviceContextBase.cpp @@ -26,6 +26,7 @@ */ #include "DeviceContextBase.hpp" + #include "GraphicsAccessories.hpp" namespace Diligent @@ -169,8 +170,8 @@ bool VerifyResolveTextureSubresourceAttribs(const ResolveTextureSubresourceAttri { #define CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Resolve texture subresource attribs are invalid: ", __VA_ARGS__) - CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(SrcTexDesc.SampleCount > 1, "source texture '", SrcTexDesc.Name, "' of a resolve operation is not multi-sampled"); - CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(DstTexDesc.SampleCount == 1, "destination texture '", DstTexDesc.Name, "' of a resolve operation is multi-sampled"); + CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(SrcTexDesc.SampleCount > 1, "source texture '", SrcTexDesc.Name, "' of a resolve operation is not multi-sampled."); + CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(DstTexDesc.SampleCount == 1, "destination texture '", DstTexDesc.Name, "' of a resolve operation is multi-sampled."); auto SrcMipLevelProps = GetMipLevelProperties(SrcTexDesc, ResolveAttribs.SrcMipLevel); auto DstMipLevelProps = GetMipLevelProperties(DstTexDesc, ResolveAttribs.DstMipLevel); @@ -180,7 +181,7 @@ bool VerifyResolveTextureSubresourceAttribs(const ResolveTextureSubresourceAttri SrcTexDesc.Name, "', mip ", ResolveAttribs.SrcMipLevel, ", slice ", ResolveAttribs.SrcSlice, ") does not match the size (", DstMipLevelProps.LogicalWidth, "x", DstMipLevelProps.LogicalHeight, ") of the destination subresource (texture '", DstTexDesc.Name, "', mip ", ResolveAttribs.DstMipLevel, ", slice ", - ResolveAttribs.DstSlice, ")"); + ResolveAttribs.DstSlice, ")."); const auto& SrcFmtAttribs = GetTextureFormatAttribs(SrcTexDesc.Format); const auto& DstFmtAttribs = GetTextureFormatAttribs(DstTexDesc.Format); @@ -189,18 +190,18 @@ bool VerifyResolveTextureSubresourceAttribs(const ResolveTextureSubresourceAttri { CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(SrcTexDesc.Format == DstTexDesc.Format, "source (", SrcFmtAttribs.Name, ") and destination (", DstFmtAttribs.Name, - ") texture formats of a resolve operation must match exaclty or be compatible typeless formats"); - CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(ResolveAttribs.Format == TEX_FORMAT_UNKNOWN || SrcTexDesc.Format == ResolveAttribs.Format, "Invalid format of a resolve operation"); + ") texture formats of a resolve operation must match exaclty or be compatible typeless formats."); + CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(ResolveAttribs.Format == TEX_FORMAT_UNKNOWN || SrcTexDesc.Format == ResolveAttribs.Format, "Invalid format of a resolve operation."); } if (SrcFmtAttribs.IsTypeless && DstFmtAttribs.IsTypeless) { CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(ResolveAttribs.Format != TEX_FORMAT_UNKNOWN, - "format of a resolve operation must not be unknown when both src and dst texture formats are typeless"); + "format of a resolve operation must not be unknown when both src and dst texture formats are typeless."); } if (SrcFmtAttribs.IsTypeless || DstFmtAttribs.IsTypeless) { CHECK_RESOLVE_TEX_SUBRES_ATTRIBS(!ResolveFmtAttribs.IsTypeless, - "format of a resolve operation must not be typeless when one of the texture formats is typeless"); + "format of a resolve operation must not be typeless when one of the texture formats is typeless."); } #undef CHECK_RESOLVE_TEX_SUBRES_ATTRIBS @@ -211,8 +212,8 @@ bool VerifyBeginRenderPassAttribs(const BeginRenderPassAttribs& Attribs) { #define CHECK_BEGIN_RENDER_PASS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Begin render pass attribs are invalid: ", __VA_ARGS__) - CHECK_BEGIN_RENDER_PASS_ATTRIBS(Attribs.pRenderPass != nullptr, "pRenderPass pass must not be null"); - CHECK_BEGIN_RENDER_PASS_ATTRIBS(Attribs.pFramebuffer != nullptr, "pFramebuffer must not be null"); + CHECK_BEGIN_RENDER_PASS_ATTRIBS(Attribs.pRenderPass != nullptr, "pRenderPass pass must not be null."); + CHECK_BEGIN_RENDER_PASS_ATTRIBS(Attribs.pFramebuffer != nullptr, "pFramebuffer must not be null."); const auto& RPDesc = Attribs.pRenderPass->GetDesc(); @@ -235,7 +236,7 @@ bool VerifyBeginRenderPassAttribs(const BeginRenderPassAttribs& Attribs) "at least ", NumRequiredClearValues, " clear values are required, but only ", Uint32{Attribs.ClearValueCount}, " are provided."); CHECK_BEGIN_RENDER_PASS_ATTRIBS(Attribs.ClearValueCount == 0 || Attribs.pClearValues != nullptr, - "pClearValues must not be null when ClearValueCount (", Attribs.ClearValueCount, ") is not zero"); + "pClearValues must not be null when ClearValueCount (", Attribs.ClearValueCount, ") is not zero."); #undef CHECK_BEGIN_RENDER_PASS_ATTRIBS @@ -246,8 +247,8 @@ bool VerifyStateTransitionDesc(const IRenderDevice* pDevice, const StateTransiti { #define CHECK_STATE_TRANSITION_DESC(Expr, ...) CHECK_PARAMETER(Expr, "State transition parameters are invalid: ", __VA_ARGS__) - CHECK_STATE_TRANSITION_DESC(Barrier.pResource != nullptr, "pResource must not be null"); - CHECK_STATE_TRANSITION_DESC(Barrier.NewState != RESOURCE_STATE_UNKNOWN, "NewState state can't be UNKNOWN"); + CHECK_STATE_TRANSITION_DESC(Barrier.pResource != nullptr, "pResource must not be null."); + CHECK_STATE_TRANSITION_DESC(Barrier.NewState != RESOURCE_STATE_UNKNOWN, "NewState state can't be UNKNOWN."); RESOURCE_STATE OldState = RESOURCE_STATE_UNKNOWN; @@ -255,20 +256,20 @@ bool VerifyStateTransitionDesc(const IRenderDevice* pDevice, const StateTransiti { const auto& TexDesc = pTexture->GetDesc(); - CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(Barrier.NewState, true), "invlaid new state specified for texture '", TexDesc.Name, "'"); + CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(Barrier.NewState, true), "invlaid new state specified for texture '", TexDesc.Name, "'."); OldState = Barrier.OldState != RESOURCE_STATE_UNKNOWN ? Barrier.OldState : pTexture->GetState(); CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of texture '", TexDesc.Name, - "' is unknown to the engine and is not explicitly specified in the barrier"); - CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(OldState, true), "invlaid old state specified for texture '", TexDesc.Name, "'"); + "' is unknown to the engine and is not explicitly specified in the barrier."); + CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(OldState, true), "invlaid old state specified for texture '", TexDesc.Name, "'."); CHECK_STATE_TRANSITION_DESC(Barrier.FirstMipLevel < TexDesc.MipLevels, "first mip level (", Barrier.FirstMipLevel, ") specified by the barrier is out of range. Texture '", - TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)"); + TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)."); CHECK_STATE_TRANSITION_DESC(Barrier.MipLevelsCount == REMAINING_MIP_LEVELS || Barrier.FirstMipLevel + Barrier.MipLevelsCount <= TexDesc.MipLevels, "mip level range ", Barrier.FirstMipLevel, "..", Barrier.FirstMipLevel + Barrier.MipLevelsCount - 1, " specified by the barrier is out of range. Texture '", - TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)"); + TexDesc.Name, "' has only ", TexDesc.MipLevels, " mip level(s)."); CHECK_STATE_TRANSITION_DESC(Barrier.FirstArraySlice < TexDesc.ArraySize, "first array slice (", Barrier.FirstArraySlice, ") specified by the barrier is out of range. Array size of texture '", @@ -282,36 +283,36 @@ bool VerifyStateTransitionDesc(const IRenderDevice* pDevice, const StateTransiti if (DevType != RENDER_DEVICE_TYPE_D3D12 && DevType != RENDER_DEVICE_TYPE_VULKAN) { CHECK_STATE_TRANSITION_DESC(Barrier.FirstMipLevel == 0 && (Barrier.MipLevelsCount == REMAINING_MIP_LEVELS || Barrier.MipLevelsCount == TexDesc.MipLevels), - "failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device"); + "failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device."); CHECK_STATE_TRANSITION_DESC(Barrier.FirstArraySlice == 0 && (Barrier.ArraySliceCount == REMAINING_ARRAY_SLICES || Barrier.ArraySliceCount == TexDesc.ArraySize), - "failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device"); + "failed to transition texture '", TexDesc.Name, "': only whole resources can be transitioned on this device."); } } else if (RefCntAutoPtr<IBuffer> pBuffer{Barrier.pResource, IID_Buffer}) { const auto& BuffDesc = pBuffer->GetDesc(); - CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(Barrier.NewState, false), "invlaid new state specified for buffer '", BuffDesc.Name, "'"); + CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(Barrier.NewState, false), "invlaid new state specified for buffer '", BuffDesc.Name, "'."); OldState = Barrier.OldState != RESOURCE_STATE_UNKNOWN ? Barrier.OldState : pBuffer->GetState(); - CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of buffer '", BuffDesc.Name, "' is unknown to the engine and is not explicitly specified in the barrier"); - CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(OldState, false), "invlaid old state specified for buffer '", BuffDesc.Name, "'"); + CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of buffer '", BuffDesc.Name, "' is unknown to the engine and is not explicitly specified in the barrier."); + CHECK_STATE_TRANSITION_DESC(VerifyResourceStates(OldState, false), "invlaid old state specified for buffer '", BuffDesc.Name, "'."); } else if (RefCntAutoPtr<IBottomLevelAS> pBottomLevelAS{Barrier.pResource, IID_BottomLevelAS}) { const auto& BLASDesc = pBottomLevelAS->GetDesc(); OldState = Barrier.OldState != RESOURCE_STATE_UNKNOWN ? Barrier.OldState : pBottomLevelAS->GetState(); - CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of BLAS '", BLASDesc.Name, "' is unknown to the engine and is not explicitly specified in the barrier"); + CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of BLAS '", BLASDesc.Name, "' is unknown to the engine and is not explicitly specified in the barrier."); CHECK_STATE_TRANSITION_DESC(Barrier.NewState == RESOURCE_STATE_BUILD_AS_READ || Barrier.NewState == RESOURCE_STATE_BUILD_AS_WRITE, - "invlaid new state specified for BLAS '", BLASDesc.Name, "'"); - CHECK_STATE_TRANSITION_DESC(Barrier.TransitionType != STATE_TRANSITION_TYPE_IMMEDIATE, "split barriers are not supported for BLAS"); + "invlaid new state specified for BLAS '", BLASDesc.Name, "'."); + CHECK_STATE_TRANSITION_DESC(Barrier.TransitionType != STATE_TRANSITION_TYPE_IMMEDIATE, "split barriers are not supported for BLAS."); } else if (RefCntAutoPtr<ITopLevelAS> pTopLevelAS{Barrier.pResource, IID_TopLevelAS}) { const auto& TLASDesc = pTopLevelAS->GetDesc(); OldState = Barrier.OldState != RESOURCE_STATE_UNKNOWN ? Barrier.OldState : pTopLevelAS->GetState(); - CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of TLAS '", TLASDesc.Name, "' is unknown to the engine and is not explicitly specified in the barrier"); + CHECK_STATE_TRANSITION_DESC(OldState != RESOURCE_STATE_UNKNOWN, "the state of TLAS '", TLASDesc.Name, "' is unknown to the engine and is not explicitly specified in the barrier."); CHECK_STATE_TRANSITION_DESC(Barrier.NewState == RESOURCE_STATE_BUILD_AS_READ || Barrier.NewState == RESOURCE_STATE_BUILD_AS_WRITE || Barrier.NewState == RESOURCE_STATE_RAY_TRACING, - "invlaid new state specified for TLAS '", TLASDesc.Name, "'"); - CHECK_STATE_TRANSITION_DESC(Barrier.TransitionType != STATE_TRANSITION_TYPE_IMMEDIATE, "split barriers are not supported for TLAS"); + "invlaid new state specified for TLAS '", TLASDesc.Name, "'."); + CHECK_STATE_TRANSITION_DESC(Barrier.TransitionType != STATE_TRANSITION_TYPE_IMMEDIATE, "split barriers are not supported for TLAS."); } else { @@ -320,12 +321,12 @@ bool VerifyStateTransitionDesc(const IRenderDevice* pDevice, const StateTransiti if (OldState == RESOURCE_STATE_UNORDERED_ACCESS && Barrier.NewState == RESOURCE_STATE_UNORDERED_ACCESS) { - CHECK_STATE_TRANSITION_DESC(Barrier.TransitionType == STATE_TRANSITION_TYPE_IMMEDIATE, "for UAV barriers, transition type must be STATE_TRANSITION_TYPE_IMMEDIATE"); + CHECK_STATE_TRANSITION_DESC(Barrier.TransitionType == STATE_TRANSITION_TYPE_IMMEDIATE, "for UAV barriers, transition type must be STATE_TRANSITION_TYPE_IMMEDIATE."); } if (Barrier.TransitionType == STATE_TRANSITION_TYPE_BEGIN) { - CHECK_STATE_TRANSITION_DESC(!Barrier.UpdateResourceState, "resource state can't be updated in begin-split barrier"); + CHECK_STATE_TRANSITION_DESC(!Barrier.UpdateResourceState, "resource state can't be updated in begin-split barrier."); } #undef CHECK_STATE_TRANSITION_DESC @@ -338,27 +339,27 @@ bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs) { #define CHECK_BUILD_BLAS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Build BLAS attribs are invalid: ", __VA_ARGS__) - CHECK_BUILD_BLAS_ATTRIBS(Attribs.pBLAS != nullptr, "pBLAS must not be null"); - CHECK_BUILD_BLAS_ATTRIBS(Attribs.pScratchBuffer != nullptr, "pScratchBuffer must not be null"); - CHECK_BUILD_BLAS_ATTRIBS((Attribs.pTriangleData != nullptr) ^ (Attribs.pBoxData != nullptr), "exactly one of pTriangles and pBoxes must be defined"); - CHECK_BUILD_BLAS_ATTRIBS(Attribs.pBoxData != nullptr || Attribs.BoxDataCount == 0, "pBoxData is null, but BoxDataCount is not 0"); - CHECK_BUILD_BLAS_ATTRIBS(Attribs.pTriangleData != nullptr || Attribs.TriangleDataCount == 0, "pTriangleData is null, but TriangleDataCount is not 0"); + CHECK_BUILD_BLAS_ATTRIBS(Attribs.pBLAS != nullptr, "pBLAS must not be null."); + CHECK_BUILD_BLAS_ATTRIBS(Attribs.pScratchBuffer != nullptr, "pScratchBuffer must not be null."); + CHECK_BUILD_BLAS_ATTRIBS((Attribs.BoxDataCount != 0) ^ (Attribs.TriangleDataCount != 0), "exactly one of TriangleDataCount and BoxDataCount must be non-zero."); + CHECK_BUILD_BLAS_ATTRIBS(Attribs.pBoxData != nullptr || Attribs.BoxDataCount == 0, "BoxDataCount is ", Attribs.BoxDataCount, ", but pBoxData is null."); + CHECK_BUILD_BLAS_ATTRIBS(Attribs.pTriangleData != nullptr || Attribs.TriangleDataCount == 0, "TriangleDataCount is ", Attribs.TriangleDataCount, ", but pTriangleData is null."); const auto& BLASDesc = Attribs.pBLAS->GetDesc(); - CHECK_BUILD_BLAS_ATTRIBS(Attribs.BoxDataCount <= BLASDesc.BoxCount, "BoxDataCount must be less than or equal to pBLAS->GetDesc().BoxCount"); - CHECK_BUILD_BLAS_ATTRIBS(Attribs.TriangleDataCount <= BLASDesc.TriangleCount, "TriangleDataCount must be less than or equal to pBLAS->GetDesc().TriangleCount"); + CHECK_BUILD_BLAS_ATTRIBS(Attribs.BoxDataCount <= BLASDesc.BoxCount, "BoxDataCount (", Attribs.BoxDataCount, ") must be less than or equal to pBLAS->GetDesc().BoxCount (", BLASDesc.BoxCount, ")."); + CHECK_BUILD_BLAS_ATTRIBS(Attribs.TriangleDataCount <= BLASDesc.TriangleCount, "TriangleDataCount (", Attribs.TriangleDataCount, ") must be less than or equal to pBLAS->GetDesc().TriangleCount (", BLASDesc.TriangleCount, ")."); if (Attribs.Update) { CHECK_BUILD_BLAS_ATTRIBS((BLASDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_UPDATE) == RAYTRACING_BUILD_AS_ALLOW_UPDATE, - "Update is true, but BLAS was created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag"); + "Update is true, but BLAS was created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag."); const Uint32 GeomCount = Attribs.pBLAS->GetActualGeometryCount(); CHECK_BUILD_BLAS_ATTRIBS(Attribs.BoxDataCount == 0 || Attribs.BoxDataCount == GeomCount, - "Update is true, but BoxDataCount (", Attribs.BoxDataCount, ") does not match the previous value (", GeomCount, ")"); + "Update is true, but BoxDataCount (", Attribs.BoxDataCount, ") does not match the previous value (", GeomCount, ")."); CHECK_BUILD_BLAS_ATTRIBS(Attribs.TriangleDataCount == 0 || Attribs.TriangleDataCount == GeomCount, - "Update is true, but TriangleDataCount (", Attribs.TriangleDataCount, ") does not match the previous value (", GeomCount, ")"); + "Update is true, but TriangleDataCount (", Attribs.TriangleDataCount, ") does not match the previous value (", GeomCount, ")."); } for (Uint32 i = 0; i < Attribs.TriangleDataCount; ++i) @@ -369,70 +370,70 @@ bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs) const Uint32 GeomIndex = Attribs.pBLAS->GetGeometryDescIndex(tri.GeometryName); CHECK_BUILD_BLAS_ATTRIBS(GeomIndex != INVALID_INDEX, - "pTriangleData[", i, "].GeometryName (", tri.GeometryName, ") is not found in BLAS description"); + "pTriangleData[", i, "].GeometryName (", tri.GeometryName, ") is not found in BLAS description."); const auto& TriDesc = BLASDesc.pTriangles[GeomIndex]; CHECK_BUILD_BLAS_ATTRIBS(tri.VertexValueType == VT_UNDEFINED || tri.VertexValueType == TriDesc.VertexValueType, - "pTriangleData[", i, "].VertexValueType must be undefined or match the VertexValueType in geometry description"); + "pTriangleData[", i, "].VertexValueType must be undefined or match the VertexValueType in geometry description."); CHECK_BUILD_BLAS_ATTRIBS(tri.VertexComponentCount == 0 || tri.VertexComponentCount == TriDesc.VertexComponentCount, - "pTriangleData[", i, "].VertexComponentCount (", tri.VertexComponentCount, ") must be 0 or match the VertexComponentCount (", - TriDesc.VertexComponentCount, ") in geometry description"); + "pTriangleData[", i, "].VertexComponentCount (", Uint32{tri.VertexComponentCount}, ") must be 0 or match the VertexComponentCount (", + Uint32{TriDesc.VertexComponentCount}, ") in geometry description."); CHECK_BUILD_BLAS_ATTRIBS(tri.VertexCount <= TriDesc.MaxVertexCount, - "pTriangleData[", i, "].VertexCount (", tri.VertexCount, ") must not be greater than MaxVertexCount(", TriDesc.MaxVertexCount, ")"); + "pTriangleData[", i, "].VertexCount (", tri.VertexCount, ") must not be greater than MaxVertexCount(", TriDesc.MaxVertexCount, ")."); CHECK_BUILD_BLAS_ATTRIBS(tri.VertexStride >= VertexSize, - "pTriangleData[", i, "].VertexStride (", tri.VertexStride, ") must be at least ", VertexSize, " bytes"); + "pTriangleData[", i, "].VertexStride (", tri.VertexStride, ") must be at least ", VertexSize, " bytes."); - CHECK_BUILD_BLAS_ATTRIBS(tri.pVertexBuffer != nullptr, "pTriangleData[", i, "].pVertexBuffer must not be null"); + CHECK_BUILD_BLAS_ATTRIBS(tri.pVertexBuffer != nullptr, "pTriangleData[", i, "].pVertexBuffer must not be null."); const BufferDesc& VertBufDesc = tri.pVertexBuffer->GetDesc(); CHECK_BUILD_BLAS_ATTRIBS((VertBufDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pTriangleData[", i, "].pVertexBuffer was not created with BIND_RAY_TRACING flag"); + "pTriangleData[", i, "].pVertexBuffer was not created with BIND_RAY_TRACING flag."); CHECK_BUILD_BLAS_ATTRIBS(tri.VertexOffset + VertexDataSize <= VertBufDesc.uiSizeInBytes, "pTriangleData[", i, "].pVertexBuffer is too small for the specified VertexStride (", tri.VertexStride, ") and VertexCount (", - tri.VertexCount, "): at least ", tri.VertexOffset + VertexDataSize, " bytes are required"); + tri.VertexCount, "): at least ", tri.VertexOffset + VertexDataSize, " bytes are required."); CHECK_BUILD_BLAS_ATTRIBS(tri.IndexType == VT_UNDEFINED || tri.IndexType == TriDesc.IndexType, "pTriangleData[", i, "].IndexType (", GetValueTypeString(tri.IndexType), ") must match the IndexType (", - TriDesc.IndexType, ") in geometry description"); + GetValueTypeString(TriDesc.IndexType), ") in geometry description."); CHECK_BUILD_BLAS_ATTRIBS(tri.PrimitiveCount <= TriDesc.MaxPrimitiveCount, "pTriangleData[", i, "].PrimitiveCount (", tri.PrimitiveCount, ") must not be greater than MaxPrimitiveCount (", - TriDesc.MaxPrimitiveCount, ")"); + TriDesc.MaxPrimitiveCount, ")."); if (TriDesc.IndexType != VT_UNDEFINED) { - CHECK_BUILD_BLAS_ATTRIBS(tri.pIndexBuffer != nullptr, "pTriangleData[", i, "].pIndexBuffer must not be null"); + CHECK_BUILD_BLAS_ATTRIBS(tri.pIndexBuffer != nullptr, "pTriangleData[", i, "].pIndexBuffer must not be null."); const BufferDesc& InstBufDesc = tri.pIndexBuffer->GetDesc(); const Uint32 IndexDataSize = tri.PrimitiveCount * 3 * GetValueSize(tri.IndexType); CHECK_BUILD_BLAS_ATTRIBS((InstBufDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pTriangleData[", i, "].pIndexBuffer was not created with BIND_RAY_TRACING flag"); + "pTriangleData[", i, "].pIndexBuffer was not created with BIND_RAY_TRACING flag."); CHECK_BUILD_BLAS_ATTRIBS(tri.IndexOffset + IndexDataSize <= InstBufDesc.uiSizeInBytes, "pTriangleData[", i, "].pIndexBuffer is too small for specified IndexType and IndexCount: at least", - tri.IndexOffset + IndexDataSize, " bytes are required"); + tri.IndexOffset + IndexDataSize, " bytes are required."); } else { CHECK_BUILD_BLAS_ATTRIBS(tri.VertexCount == tri.PrimitiveCount * 3, - "pTriangleData[", i, "].VertexCount (", tri.VertexCount, ") must equal to PrimitiveCount * 3 (", - tri.PrimitiveCount * 3, ")"); + "pTriangleData[", i, "].VertexCount (", tri.VertexCount, ") must be equal to PrimitiveCount * 3 (", + tri.PrimitiveCount * 3, ")."); - CHECK_BUILD_BLAS_ATTRIBS(tri.pIndexBuffer == nullptr, "pTriangleData[", i, "].pIndexBuffer must be null if IndexType is VT_UNDEFINED"); + CHECK_BUILD_BLAS_ATTRIBS(tri.pIndexBuffer == nullptr, "pTriangleData[", i, "].pIndexBuffer must be null if IndexType is VT_UNDEFINED."); } if (tri.pTransformBuffer != nullptr) { CHECK_BUILD_BLAS_ATTRIBS((tri.pTransformBuffer->GetDesc().BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pTriangleData[", i, "].pTransformBuffer was not created with BIND_RAY_TRACING flag"); + "pTriangleData[", i, "].pTransformBuffer was not created with BIND_RAY_TRACING flag."); - CHECK_BUILD_BLAS_ATTRIBS(TriDesc.AllowsTransforms, "pTriangleData[", i, "] uses transform buffer, but AllowsTransforms is false"); + CHECK_BUILD_BLAS_ATTRIBS(TriDesc.AllowsTransforms, "pTriangleData[", i, "] uses transform buffer, but AllowsTransforms is false."); } } @@ -443,42 +444,42 @@ bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs) const Uint32 GeomIndex = Attribs.pBLAS->GetGeometryDescIndex(box.GeometryName); CHECK_BUILD_BLAS_ATTRIBS(GeomIndex != INVALID_INDEX, - "pBoxData[", i, "].GeometryName (", box.GeometryName, ") is not found in BLAS description"); + "pBoxData[", i, "].GeometryName (", box.GeometryName, ") is not found in BLAS description."); const auto& BoxDesc = BLASDesc.pBoxes[GeomIndex]; CHECK_BUILD_BLAS_ATTRIBS(box.BoxCount <= BoxDesc.MaxBoxCount, - "pBoxData[", i, "].BoxCount (", box.BoxCount, ") must not be greated than MaxBoxCount (", BoxDesc.MaxBoxCount, ")"); + "pBoxData[", i, "].BoxCount (", box.BoxCount, ") must not be greated than MaxBoxCount (", BoxDesc.MaxBoxCount, ")."); CHECK_BUILD_BLAS_ATTRIBS(box.BoxStride >= BoxSize, - "pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be at least ", BoxSize, " bytes"); + "pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be at least ", BoxSize, " bytes."); CHECK_BUILD_BLAS_ATTRIBS(box.BoxStride % 8 == 0, - "pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be aligned to 8 bytes"); + "pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be aligned to 8 bytes."); - CHECK_BUILD_BLAS_ATTRIBS(box.pBoxBuffer != nullptr, "pBoxData[", i, "].pBoxBuffer must not be null"); + CHECK_BUILD_BLAS_ATTRIBS(box.pBoxBuffer != nullptr, "pBoxData[", i, "].pBoxBuffer must not be null."); CHECK_BUILD_BLAS_ATTRIBS((box.pBoxBuffer->GetDesc().BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pBoxData[", i, "].pBoxBuffer was not created with BIND_RAY_TRACING flag"); + "pBoxData[", i, "].pBoxBuffer was not created with BIND_RAY_TRACING flag."); } const auto& ScratchDesc = Attribs.pScratchBuffer->GetDesc(); CHECK_BUILD_BLAS_ATTRIBS(Attribs.ScratchBufferOffset <= ScratchDesc.uiSizeInBytes, - "ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") is greater than the buffer size (", ScratchDesc.uiSizeInBytes, ")"); + "ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") is greater than the buffer size (", ScratchDesc.uiSizeInBytes, ")."); if (Attribs.Update) { CHECK_BUILD_BLAS_ATTRIBS(ScratchDesc.uiSizeInBytes - Attribs.ScratchBufferOffset >= Attribs.pBLAS->GetScratchBufferSizes().Update, - "pScratchBuffer size is too small, use pBLAS->GetScratchBufferSizes().Update to get the required size for the scratch buffer"); + "pScratchBuffer size is too small, use pBLAS->GetScratchBufferSizes().Update to get the required size for the scratch buffer."); } else { CHECK_BUILD_BLAS_ATTRIBS(ScratchDesc.uiSizeInBytes - Attribs.ScratchBufferOffset >= Attribs.pBLAS->GetScratchBufferSizes().Build, - "pScratchBuffer size is too small, use pBLAS->GetScratchBufferSizes().Build to get the required size for the scratch buffer"); + "pScratchBuffer size is too small, use pBLAS->GetScratchBufferSizes().Build to get the required size for the scratch buffer."); } CHECK_BUILD_BLAS_ATTRIBS((ScratchDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pScratchBuffer was not created with BIND_RAY_TRACING flag"); + "pScratchBuffer was not created with BIND_RAY_TRACING flag."); #undef CHECK_BUILD_BLAS_ATTRIBS @@ -490,28 +491,28 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs) { #define CHECK_BUILD_TLAS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Build TLAS attribs are invalid: ", __VA_ARGS__) - CHECK_BUILD_TLAS_ATTRIBS(Attribs.pTLAS != nullptr, "pTLAS must not be null"); - CHECK_BUILD_TLAS_ATTRIBS(Attribs.pScratchBuffer != nullptr, "pScratchBuffer must not be null"); - CHECK_BUILD_TLAS_ATTRIBS(Attribs.pInstances != nullptr, "pInstances must not be null"); - CHECK_BUILD_TLAS_ATTRIBS(Attribs.pInstanceBuffer != nullptr, "pInstanceBuffer must not be null"); + CHECK_BUILD_TLAS_ATTRIBS(Attribs.pTLAS != nullptr, "pTLAS must not be null."); + CHECK_BUILD_TLAS_ATTRIBS(Attribs.pScratchBuffer != nullptr, "pScratchBuffer must not be null."); + CHECK_BUILD_TLAS_ATTRIBS(Attribs.pInstances != nullptr, "pInstances must not be null."); + CHECK_BUILD_TLAS_ATTRIBS(Attribs.pInstanceBuffer != nullptr, "pInstanceBuffer must not be null."); CHECK_BUILD_TLAS_ATTRIBS(Attribs.BindingMode == HIT_GROUP_BINDING_MODE_USER_DEFINED || Attribs.HitGroupStride != 0, - "HitGroupStride must be greater than 0 if BindingMode is not HIT_GROUP_BINDING_MODE_USER_DEFINED"); + "HitGroupStride must be greater than 0 if BindingMode is not HIT_GROUP_BINDING_MODE_USER_DEFINED."); const auto& TLASDesc = Attribs.pTLAS->GetDesc(); CHECK_BUILD_TLAS_ATTRIBS(Attribs.InstanceCount <= TLASDesc.MaxInstanceCount, "InstanceCount (", Attribs.InstanceCount, ") must be less than or equal to pTLAS->GetDesc().MaxInstanceCount (", - TLASDesc.MaxInstanceCount, ")"); + TLASDesc.MaxInstanceCount, ")."); if (Attribs.Update) { CHECK_BUILD_TLAS_ATTRIBS((TLASDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_UPDATE) == RAYTRACING_BUILD_AS_ALLOW_UPDATE, - "Update is true, but TLAS created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag"); + "Update is true, but TLAS created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag."); const Uint32 PrevInstanceCount = Attribs.pTLAS->GetBuildInfo().InstanceCount; CHECK_BUILD_TLAS_ATTRIBS(PrevInstanceCount == Attribs.InstanceCount, - "Update is true, but InstanceCount (", Attribs.InstanceCount, ") does not match with the previous value (", PrevInstanceCount, ")"); + "Update is true, but InstanceCount (", Attribs.InstanceCount, ") does not match the previous value (", PrevInstanceCount, ")."); } const auto& InstDesc = Attribs.pInstanceBuffer->GetDesc(); @@ -524,19 +525,19 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs) constexpr Uint32 BitMask = (1u << 24) - 1; const auto& Inst = Attribs.pInstances[i]; - VERIFY((Inst.CustomId & ~BitMask) == 0, "Only the lower 24 bits are used"); + VERIFY((Inst.CustomId & ~BitMask) == 0, "Only the lower 24 bits are used."); VERIFY(Inst.ContributionToHitGroupIndex == TLAS_INSTANCE_OFFSET_AUTO || (Inst.ContributionToHitGroupIndex & ~BitMask) == 0, - "Only the lower 24 bits are used"); + "Only the lower 24 bits are used."); - CHECK_BUILD_TLAS_ATTRIBS(Inst.InstanceName != nullptr, "pInstances[", i, "].InstanceName must not be null"); - CHECK_BUILD_TLAS_ATTRIBS(Inst.pBLAS != nullptr, "pInstances[", i, "].pBLAS must not be null"); + CHECK_BUILD_TLAS_ATTRIBS(Inst.InstanceName != nullptr, "pInstances[", i, "].InstanceName must not be null."); + CHECK_BUILD_TLAS_ATTRIBS(Inst.pBLAS != nullptr, "pInstances[", i, "].pBLAS must not be null."); if (Attribs.Update) { const TLASInstanceDesc IDesc = Attribs.pTLAS->GetInstanceDesc(Inst.InstanceName); - CHECK_BUILD_TLAS_ATTRIBS(IDesc.InstanceIndex != INVALID_INDEX, "Update is true, but pInstances[", i, "].InstanceName does not exists"); + CHECK_BUILD_TLAS_ATTRIBS(IDesc.InstanceIndex != INVALID_INDEX, "Update is true, but pInstances[", i, "].InstanceName does not exists."); } if (Inst.ContributionToHitGroupIndex == TLAS_INSTANCE_OFFSET_AUTO) @@ -545,40 +546,40 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs) CHECK_BUILD_TLAS_ATTRIBS(Attribs.BindingMode == HIT_GROUP_BINDING_MODE_USER_DEFINED || Inst.ContributionToHitGroupIndex == TLAS_INSTANCE_OFFSET_AUTO, "pInstances[", i, "].ContributionToHitGroupIndex must be TLAS_INSTANCE_OFFSET_AUTO " - "if BindingMode is not HIT_GROUP_BINDING_MODE_USER_DEFINED"); + "if BindingMode is not HIT_GROUP_BINDING_MODE_USER_DEFINED."); } CHECK_BUILD_TLAS_ATTRIBS(AutoOffsetCounter == 0 || AutoOffsetCounter == Attribs.InstanceCount, - "all pInstances[i].ContributionToHitGroupIndex must be TLAS_INSTANCE_OFFSET_AUTO, or none of them should"); + "all pInstances[i].ContributionToHitGroupIndex must be TLAS_INSTANCE_OFFSET_AUTO, or none of them should."); CHECK_BUILD_TLAS_ATTRIBS(Attribs.InstanceBufferOffset <= InstDesc.uiSizeInBytes, - "InstanceBufferOffset (", Attribs.InstanceBufferOffset, ") is greater than the buffer size (", InstDesc.uiSizeInBytes, ")"); + "InstanceBufferOffset (", Attribs.InstanceBufferOffset, ") is greater than the buffer size (", InstDesc.uiSizeInBytes, ")."); CHECK_BUILD_TLAS_ATTRIBS(InstDesc.uiSizeInBytes - Attribs.InstanceBufferOffset >= InstDataSize, "pInstanceBuffer size (", InstDesc.uiSizeInBytes, ") is too small: at least ", - InstDataSize + Attribs.InstanceBufferOffset, " bytes are required"); + InstDataSize + Attribs.InstanceBufferOffset, " bytes are required."); CHECK_BUILD_TLAS_ATTRIBS((InstDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pInstanceBuffer was not created with BIND_RAY_TRACING flag"); + "pInstanceBuffer was not created with BIND_RAY_TRACING flag."); const auto& ScratchDesc = Attribs.pScratchBuffer->GetDesc(); CHECK_BUILD_TLAS_ATTRIBS(Attribs.ScratchBufferOffset <= ScratchDesc.uiSizeInBytes, - "ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") is greater than the buffer size (", ScratchDesc.uiSizeInBytes, ")"); + "ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") is greater than the buffer size (", ScratchDesc.uiSizeInBytes, ")."); if (Attribs.Update) { CHECK_BUILD_TLAS_ATTRIBS(ScratchDesc.uiSizeInBytes - Attribs.ScratchBufferOffset >= Attribs.pTLAS->GetScratchBufferSizes().Update, - "pScratchBuffer size is too small, use pTLAS->GetScratchBufferSizes().Update to get the required size for scratch buffer"); + "pScratchBuffer size is too small, use pTLAS->GetScratchBufferSizes().Update to get the required size for scratch buffer."); } else { CHECK_BUILD_TLAS_ATTRIBS(ScratchDesc.uiSizeInBytes - Attribs.ScratchBufferOffset >= Attribs.pTLAS->GetScratchBufferSizes().Build, - "pScratchBuffer size is too small, use pTLAS->GetScratchBufferSizes().Build to get the required size for scratch buffer"); + "pScratchBuffer size is too small, use pTLAS->GetScratchBufferSizes().Build to get the required size for scratch buffer."); } CHECK_BUILD_TLAS_ATTRIBS((ScratchDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, - "pScratchBuffer was not created with BIND_RAY_TRACING flag"); + "pScratchBuffer was not created with BIND_RAY_TRACING flag."); #undef CHECK_BUILD_TLAS_ATTRIBS return true; @@ -589,8 +590,8 @@ bool VerifyCopyBLASAttribs(const IRenderDevice* pDevice, const CopyBLASAttribs& { #define CHECK_COPY_BLAS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Copy BLAS attribs are invalid: ", __VA_ARGS__) - CHECK_COPY_BLAS_ATTRIBS(Attribs.pSrc != nullptr, "pSrc must not be null"); - CHECK_COPY_BLAS_ATTRIBS(Attribs.pDst != nullptr, "pDst must not be null"); + CHECK_COPY_BLAS_ATTRIBS(Attribs.pSrc != nullptr, "pSrc must not be null."); + CHECK_COPY_BLAS_ATTRIBS(Attribs.pDst != nullptr, "pDst must not be null."); if (Attribs.Mode == COPY_AS_MODE_CLONE) { @@ -600,40 +601,40 @@ bool VerifyCopyBLASAttribs(const IRenderDevice* pDevice, const CopyBLASAttribs& auto& DstDesc = Attribs.pDst->GetDesc(); CHECK_COPY_BLAS_ATTRIBS(SrcDesc.TriangleCount == DstDesc.TriangleCount, - "Src BLAS triangle count (", SrcDesc.TriangleCount, ") must be equal to the dst BLAS triangle count (", DstDesc.TriangleCount, ")"); + "Src BLAS triangle count (", SrcDesc.TriangleCount, ") must be equal to the dst BLAS triangle count (", DstDesc.TriangleCount, ")."); CHECK_COPY_BLAS_ATTRIBS(SrcDesc.BoxCount == DstDesc.BoxCount, - "Src BLAS box count (", SrcDesc.BoxCount, ") must be equal to the dst BLAS box count (", DstDesc.BoxCount, ")"); + "Src BLAS box count (", SrcDesc.BoxCount, ") must be equal to the dst BLAS box count (", DstDesc.BoxCount, ")."); CHECK_COPY_BLAS_ATTRIBS(SrcDesc.Flags == DstDesc.Flags, - "Source and destination BLASes must have been created with the same flags"); + "Source and destination BLASes must have been created with the same flags."); for (Uint32 i = 0; i < SrcDesc.TriangleCount; ++i) { const BLASTriangleDesc& SrcTri = SrcDesc.pTriangles[i]; const Uint32 Index = Attribs.pDst->GetGeometryDescIndex(SrcTri.GeometryName); CHECK_COPY_BLAS_ATTRIBS(Index != INVALID_INDEX, - "Src GeometryName ('", SrcTri.GeometryName, "') at index ", i, " is not found in pDst"); + "Src GeometryName ('", SrcTri.GeometryName, "') at index ", i, " is not found in pDst."); const BLASTriangleDesc& DstTri = DstDesc.pTriangles[Index]; CHECK_COPY_BLAS_ATTRIBS(SrcTri.MaxVertexCount == DstTri.MaxVertexCount, "MaxVertexCount value (", SrcTri.MaxVertexCount, ") in source triangle description at index ", i, - " does not match MaxVertexCount value (", DstTri.MaxVertexCount, ") in the destination description"); + " does not match MaxVertexCount value (", DstTri.MaxVertexCount, ") in the destination description."); CHECK_COPY_BLAS_ATTRIBS(SrcTri.VertexValueType == DstTri.VertexValueType, "VertexValueType value (", GetValueTypeString(SrcTri.VertexValueType), ") in source triangle description at index ", i, - " does not match VertexValueType value (", GetValueTypeString(DstTri.VertexValueType), ") in destination description"); + " does not match VertexValueType value (", GetValueTypeString(DstTri.VertexValueType), ") in destination description."); CHECK_COPY_BLAS_ATTRIBS(SrcTri.VertexComponentCount == DstTri.VertexComponentCount, "VertexComponentCount value (", Uint32{SrcTri.VertexComponentCount}, ") in source triangle description at index ", i, - " does not match VertexComponentCount value (", Uint32{DstTri.VertexComponentCount}, ") in destination description"); + " does not match VertexComponentCount value (", Uint32{DstTri.VertexComponentCount}, ") in destination description."); CHECK_COPY_BLAS_ATTRIBS(SrcTri.MaxPrimitiveCount == DstTri.MaxPrimitiveCount, "MaxPrimitiveCount value (", SrcTri.MaxPrimitiveCount, ") in source triangle description at index ", i, - " does not match MaxPrimitiveCount value (", DstTri.MaxPrimitiveCount, ") in destination description"); + " does not match MaxPrimitiveCount value (", DstTri.MaxPrimitiveCount, ") in destination description."); CHECK_COPY_BLAS_ATTRIBS(SrcTri.IndexType == DstTri.IndexType, "IndexType value (", GetValueTypeString(SrcTri.IndexType), ") in source triangle description at index ", i, - " does not match IndexType value (", GetValueTypeString(DstTri.IndexType), ") in destination description"); + " does not match IndexType value (", GetValueTypeString(DstTri.IndexType), ") in destination description."); CHECK_COPY_BLAS_ATTRIBS(SrcTri.AllowsTransforms == DstTri.AllowsTransforms, "AllowsTransforms value (", (SrcTri.AllowsTransforms ? "true" : "false"), ") in source triangle description at index ", i, - " does not match AllowsTransforms value (", (DstTri.AllowsTransforms ? "true" : "false"), ") in destination description"); + " does not match AllowsTransforms value (", (DstTri.AllowsTransforms ? "true" : "false"), ") in destination description."); } for (Uint32 i = 0; i < SrcDesc.BoxCount; ++i) @@ -642,14 +643,14 @@ bool VerifyCopyBLASAttribs(const IRenderDevice* pDevice, const CopyBLASAttribs& const Uint32 Index = Attribs.pDst->GetGeometryDescIndex(SrcBox.GeometryName); if (Index == INVALID_INDEX) { - LOG_ERROR_MESSAGE("Copy BLAS attribs are invalid: pSrc->GetDesc().pBoxes[", i, "].GeometryName ('", SrcBox.GeometryName, "') is not found in pDst"); + LOG_ERROR_MESSAGE("Copy BLAS attribs are invalid: pSrc->GetDesc().pBoxes[", i, "].GeometryName ('", SrcBox.GeometryName, "') is not found in pDst."); return false; } const BLASBoundingBoxDesc& DstBox = DstDesc.pBoxes[Index]; CHECK_COPY_BLAS_ATTRIBS(SrcBox.MaxBoxCount == DstBox.MaxBoxCount, "MaxBoxCountt value (", SrcBox.MaxBoxCount, ") in source box description at index ", i, - " does not match MaxBoxCount value (", DstBox.MaxBoxCount, ") in destination description"); + " does not match MaxBoxCount value (", DstBox.MaxBoxCount, ") in destination description."); } } } @@ -658,12 +659,12 @@ bool VerifyCopyBLASAttribs(const IRenderDevice* pDevice, const CopyBLASAttribs& auto& SrcDesc = Attribs.pSrc->GetDesc(); auto& DstDesc = Attribs.pDst->GetDesc(); - CHECK_COPY_BLAS_ATTRIBS((SrcDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_COMPACTION) == RAYTRACING_BUILD_AS_ALLOW_COMPACTION, "must be have been create with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag"); - CHECK_COPY_BLAS_ATTRIBS(DstDesc.CompactedSize != 0, "pDst must have been create with non-zero CompactedSize"); + CHECK_COPY_BLAS_ATTRIBS((SrcDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_COMPACTION) == RAYTRACING_BUILD_AS_ALLOW_COMPACTION, "must be have been create with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag."); + CHECK_COPY_BLAS_ATTRIBS(DstDesc.CompactedSize != 0, "pDst must have been create with non-zero CompactedSize."); } else { - LOG_ERROR_MESSAGE("IDeviceContext::CopyBLAS: unknown Mode"); + LOG_ERROR_MESSAGE("IDeviceContext::CopyBLAS: unknown Mode."); return false; } @@ -677,8 +678,8 @@ bool VerifyCopyTLASAttribs(const CopyTLASAttribs& Attribs) { #define CHECK_COPY_TLAS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Copy TLAS attribs are invalid: ", __VA_ARGS__) - CHECK_COPY_TLAS_ATTRIBS(Attribs.pSrc != nullptr, "pSrc must not be null"); - CHECK_COPY_TLAS_ATTRIBS(Attribs.pDst != nullptr, "pDst must not be null"); + CHECK_COPY_TLAS_ATTRIBS(Attribs.pSrc != nullptr, "pSrc must not be null."); + CHECK_COPY_TLAS_ATTRIBS(Attribs.pDst != nullptr, "pDst must not be null."); if (Attribs.Mode == COPY_AS_MODE_CLONE) { @@ -686,19 +687,19 @@ bool VerifyCopyTLASAttribs(const CopyTLASAttribs& Attribs) auto& DstDesc = Attribs.pDst->GetDesc(); CHECK_COPY_TLAS_ATTRIBS(SrcDesc.MaxInstanceCount == DstDesc.MaxInstanceCount && SrcDesc.Flags == DstDesc.Flags, - "pDst must have been created with the same parameters as pSrc"); + "pDst must have been created with the same parameters as pSrc."); } else if (Attribs.Mode == COPY_AS_MODE_COMPACT) { auto& SrcDesc = Attribs.pSrc->GetDesc(); auto& DstDesc = Attribs.pDst->GetDesc(); - CHECK_COPY_TLAS_ATTRIBS((SrcDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_COMPACTION) == RAYTRACING_BUILD_AS_ALLOW_COMPACTION, "pSrc was not created with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag"); - CHECK_COPY_TLAS_ATTRIBS(DstDesc.CompactedSize != 0, "pDst must have been create with non-zero CompactedSize"); + CHECK_COPY_TLAS_ATTRIBS((SrcDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_COMPACTION) == RAYTRACING_BUILD_AS_ALLOW_COMPACTION, "pSrc was not created with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag."); + CHECK_COPY_TLAS_ATTRIBS(DstDesc.CompactedSize != 0, "pDst must have been create with non-zero CompactedSize."); } else { - LOG_ERROR_MESSAGE("IDeviceContext::CopyTLAS: unknown Mode"); + LOG_ERROR_MESSAGE("IDeviceContext::CopyTLAS: unknown Mode."); return false; } #undef CHECK_COPY_TLAS_ATTRIBS @@ -710,19 +711,19 @@ bool VerifyWriteBLASCompactedSizeAttribs(const IRenderDevice* pDevice, const Wri { #define CHECK_WRITE_BLAS_SIZE_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Write compacted BLAS size attribs are invalid: ", __VA_ARGS__) - CHECK_WRITE_BLAS_SIZE_ATTRIBS(Attribs.pBLAS != nullptr, "pBLAS must not be null"); + CHECK_WRITE_BLAS_SIZE_ATTRIBS(Attribs.pBLAS != nullptr, "pBLAS must not be null."); CHECK_WRITE_BLAS_SIZE_ATTRIBS((Attribs.pBLAS->GetDesc().Flags & RAYTRACING_BUILD_AS_ALLOW_COMPACTION) == RAYTRACING_BUILD_AS_ALLOW_COMPACTION, - "pBLAS was not created with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag"); + "pBLAS was not created with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag."); - CHECK_WRITE_BLAS_SIZE_ATTRIBS(Attribs.pDestBuffer != nullptr, "pDestBuffer must not be null"); + CHECK_WRITE_BLAS_SIZE_ATTRIBS(Attribs.pDestBuffer != nullptr, "pDestBuffer must not be null."); const BufferDesc& DstDesc = Attribs.pDestBuffer->GetDesc(); - CHECK_WRITE_BLAS_SIZE_ATTRIBS(Attribs.DestBufferOffset + sizeof(Uint64) <= DstDesc.uiSizeInBytes, "pDestBuffer is too small"); + CHECK_WRITE_BLAS_SIZE_ATTRIBS(Attribs.DestBufferOffset + sizeof(Uint64) <= DstDesc.uiSizeInBytes, "pDestBuffer is too small."); if (pDevice->GetDeviceCaps().DevType == RENDER_DEVICE_TYPE_D3D12) { CHECK_WRITE_BLAS_SIZE_ATTRIBS((DstDesc.BindFlags & BIND_UNORDERED_ACCESS) == BIND_UNORDERED_ACCESS, - "pDestBuffer must have been created with BIND_UNORDERED_ACCESS flag in Direct3D12"); + "pDestBuffer must have been created with BIND_UNORDERED_ACCESS flag in Direct3D12."); } #undef CHECK_WRITE_BLAS_SIZE_ATTRIBS @@ -734,19 +735,19 @@ bool VerifyWriteTLASCompactedSizeAttribs(const IRenderDevice* pDevice, const Wri { #define CHECK_WRITE_TLAS_SIZE_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Write compacted TLAS size attribs are invalid: ", __VA_ARGS__) - CHECK_WRITE_TLAS_SIZE_ATTRIBS(Attribs.pTLAS != nullptr, "pTLAS must not be null"); + CHECK_WRITE_TLAS_SIZE_ATTRIBS(Attribs.pTLAS != nullptr, "pTLAS must not be null."); CHECK_WRITE_TLAS_SIZE_ATTRIBS((Attribs.pTLAS->GetDesc().Flags & RAYTRACING_BUILD_AS_ALLOW_COMPACTION) == RAYTRACING_BUILD_AS_ALLOW_COMPACTION, - "pTLAS was not created with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag"); + "pTLAS was not created with RAYTRACING_BUILD_AS_ALLOW_COMPACTION flag."); - CHECK_WRITE_TLAS_SIZE_ATTRIBS(Attribs.pDestBuffer != nullptr, "pDestBuffer must not be null"); + CHECK_WRITE_TLAS_SIZE_ATTRIBS(Attribs.pDestBuffer != nullptr, "pDestBuffer must not be null."); const BufferDesc& DstDesc = Attribs.pDestBuffer->GetDesc(); - CHECK_WRITE_TLAS_SIZE_ATTRIBS(Attribs.DestBufferOffset + sizeof(Uint64) <= DstDesc.uiSizeInBytes, "pDestBuffer is too small"); + CHECK_WRITE_TLAS_SIZE_ATTRIBS(Attribs.DestBufferOffset + sizeof(Uint64) <= DstDesc.uiSizeInBytes, "pDestBuffer is too small."); if (pDevice->GetDeviceCaps().DevType == RENDER_DEVICE_TYPE_D3D12) { CHECK_WRITE_TLAS_SIZE_ATTRIBS((DstDesc.BindFlags & BIND_UNORDERED_ACCESS) == BIND_UNORDERED_ACCESS, - "pDestBuffer must have been created with BIND_UNORDERED_ACCESS flag"); + "pDestBuffer must have been created with BIND_UNORDERED_ACCESS flag."); } #undef CHECK_WRITE_TLAS_SIZE_ATTRIBS @@ -757,11 +758,11 @@ bool VerifyWriteTLASCompactedSizeAttribs(const IRenderDevice* pDevice, const Wri bool VerifyTraceRaysAttribs(const TraceRaysAttribs& Attribs) { #define CHECK_TRACE_RAYS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Trace rays attribs are invalid: ", __VA_ARGS__) - CHECK_TRACE_RAYS_ATTRIBS(Attribs.pSBT != nullptr, "pSBT must not be null"); + CHECK_TRACE_RAYS_ATTRIBS(Attribs.pSBT != nullptr, "pSBT must not be null."); #ifdef DILIGENT_DEVELOPMENT CHECK_TRACE_RAYS_ATTRIBS(Attribs.pSBT->Verify(SHADER_BINDING_VALIDATION_SHADER_ONLY | SHADER_BINDING_VALIDATION_TLAS), - "not all shaders in SBT are bound or instance to shader mapping is incorrect"); + "not all shaders in SBT are bound or instance to shader mapping is incorrect."); #endif // DILIGENT_DEVELOPMENT CHECK_TRACE_RAYS_ATTRIBS(Attribs.DimensionX != 0, "DimensionX must not be zero."); diff --git a/Graphics/GraphicsEngine/src/PipelineStateBase.cpp b/Graphics/GraphicsEngine/src/PipelineStateBase.cpp index 5adc101d..8a24ea32 100644 --- a/Graphics/GraphicsEngine/src/PipelineStateBase.cpp +++ b/Graphics/GraphicsEngine/src/PipelineStateBase.cpp @@ -39,29 +39,29 @@ void ValidateRasterizerStateDesc(const PipelineStateDesc& PSODesc, const Graphic { const auto& RSDesc = GraphicsPipeline.RasterizerDesc; if (RSDesc.FillMode == FILL_MODE_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("RasterizerDesc.FillMode must not be FILL_MODE_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("RasterizerDesc.FillMode must not be FILL_MODE_UNDEFINED."); if (RSDesc.CullMode == CULL_MODE_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("RasterizerDesc.CullMode must not be CULL_MODE_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("RasterizerDesc.CullMode must not be CULL_MODE_UNDEFINED."); } void ValidateDepthStencilDesc(const PipelineStateDesc& PSODesc, const GraphicsPipelineDesc& GraphicsPipeline) noexcept(false) { const auto& DSSDesc = GraphicsPipeline.DepthStencilDesc; if (DSSDesc.DepthEnable && DSSDesc.DepthFunc == COMPARISON_FUNC_UNKNOWN) - LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.DepthFunc must not be COMPARISON_FUNC_UNKNOWN when depth is enabled"); + LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.DepthFunc must not be COMPARISON_FUNC_UNKNOWN when depth is enabled."); auto CheckStencilOpDesc = [&](const StencilOpDesc& OpDesc, const char* FaceName) // { if (DSSDesc.StencilEnable) { if (OpDesc.StencilFailOp == STENCIL_OP_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilFailOp must not be STENCIL_OP_UNDEFINED when stencil is enabled"); + LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilFailOp must not be STENCIL_OP_UNDEFINED when stencil is enabled."); if (OpDesc.StencilDepthFailOp == STENCIL_OP_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilDepthFailOp must not be STENCIL_OP_UNDEFINED when stencil is enabled"); + LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilDepthFailOp must not be STENCIL_OP_UNDEFINED when stencil is enabled."); if (OpDesc.StencilPassOp == STENCIL_OP_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilPassOp must not be STENCIL_OP_UNDEFINED when stencil is enabled"); + LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilPassOp must not be STENCIL_OP_UNDEFINED when stencil is enabled."); if (OpDesc.StencilFunc == COMPARISON_FUNC_UNKNOWN) - LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilFunc must not be COMPARISON_FUNC_UNKNOWN when stencil is enabled"); + LOG_PSO_ERROR_AND_THROW("DepthStencilDesc.", FaceName, ".StencilFunc must not be COMPARISON_FUNC_UNKNOWN when stencil is enabled."); } }; CheckStencilOpDesc(DSSDesc.FrontFace, "FrontFace"); @@ -103,18 +103,18 @@ void ValidateBlendStateDesc(const PipelineStateDesc& PSODesc, const GraphicsPipe if (BlendEnable) { if (RTDesc.SrcBlend == BLEND_FACTOR_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].SrcBlend must not be BLEND_FACTOR_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].SrcBlend must not be BLEND_FACTOR_UNDEFINED."); if (RTDesc.DestBlend == BLEND_FACTOR_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].DestBlend must not be BLEND_FACTOR_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].DestBlend must not be BLEND_FACTOR_UNDEFINED."); if (RTDesc.BlendOp == BLEND_OPERATION_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].BlendOp must not be BLEND_OPERATION_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].BlendOp must not be BLEND_OPERATION_UNDEFINED."); if (RTDesc.SrcBlendAlpha == BLEND_FACTOR_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].SrcBlendAlpha must not be BLEND_FACTOR_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].SrcBlendAlpha must not be BLEND_FACTOR_UNDEFINED."); if (RTDesc.DestBlendAlpha == BLEND_FACTOR_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].DestBlendAlpha must not be BLEND_FACTOR_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].DestBlendAlpha must not be BLEND_FACTOR_UNDEFINED."); if (RTDesc.BlendOpAlpha == BLEND_OPERATION_UNDEFINED) - LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].BlendOpAlpha must not be BLEND_OPERATION_UNDEFINED"); + LOG_PSO_ERROR_AND_THROW("BlendDesc.RenderTargets[", rt, "].BlendOpAlpha must not be BLEND_OPERATION_UNDEFINED."); } } } @@ -163,7 +163,7 @@ void ValidateGraphicsPipelineCreateInfo(const GraphicsPipelineStateCreateInfo& C { const auto& PSODesc = CreateInfo.PSODesc; if (PSODesc.PipelineType != PIPELINE_TYPE_GRAPHICS && PSODesc.PipelineType != PIPELINE_TYPE_MESH) - LOG_PSO_ERROR_AND_THROW("Pipeline type must be GRAPHICS or MESH"); + LOG_PSO_ERROR_AND_THROW("Pipeline type must be GRAPHICS or MESH."); const auto& GraphicsPipeline = CreateInfo.GraphicsPipeline; @@ -175,21 +175,21 @@ void ValidateGraphicsPipelineCreateInfo(const GraphicsPipelineStateCreateInfo& C if (PSODesc.PipelineType == PIPELINE_TYPE_GRAPHICS) { if (CreateInfo.pVS == nullptr) - LOG_ERROR_AND_THROW("Vertex shader must not be null"); + LOG_ERROR_AND_THROW("Vertex shader must not be null."); - DEV_CHECK_ERR(CreateInfo.pAS == nullptr && CreateInfo.pMS == nullptr, "Mesh shaders are not supported in graphics pipeline"); + DEV_CHECK_ERR(CreateInfo.pAS == nullptr && CreateInfo.pMS == nullptr, "Mesh shaders are not supported in graphics pipeline."); } else if (PSODesc.PipelineType == PIPELINE_TYPE_MESH) { if (CreateInfo.pMS == nullptr) - LOG_ERROR_AND_THROW("Mesh shader must not be null"); + LOG_ERROR_AND_THROW("Mesh shader must not be null."); DEV_CHECK_ERR(CreateInfo.pVS == nullptr && CreateInfo.pGS == nullptr && CreateInfo.pDS == nullptr && CreateInfo.pHS == nullptr, - "Vertex, geometry and tessellation shaders are not supported in a mesh pipeline"); - DEV_CHECK_ERR(GraphicsPipeline.InputLayout.NumElements == 0, "Input layout is ignored in a mesh pipeline"); + "Vertex, geometry and tessellation shaders are not supported in a mesh pipeline."); + DEV_CHECK_ERR(GraphicsPipeline.InputLayout.NumElements == 0, "Input layout is ignored in a mesh pipeline."); DEV_CHECK_ERR(GraphicsPipeline.PrimitiveTopology == PRIMITIVE_TOPOLOGY_TRIANGLE_LIST || GraphicsPipeline.PrimitiveTopology == PRIMITIVE_TOPOLOGY_UNDEFINED, - "Primitive topology is ignored in a mesh pipeline, set it to undefined or keep default value (triangle list)"); + "Primitive topology is ignored in a mesh pipeline, set it to undefined or keep default value (triangle list)."); } @@ -205,19 +205,19 @@ void ValidateGraphicsPipelineCreateInfo(const GraphicsPipelineStateCreateInfo& C if (GraphicsPipeline.pRenderPass != nullptr) { if (GraphicsPipeline.NumRenderTargets != 0) - LOG_PSO_ERROR_AND_THROW("NumRenderTargets must be 0 when explicit render pass is used"); + LOG_PSO_ERROR_AND_THROW("NumRenderTargets must be 0 when explicit render pass is used."); if (GraphicsPipeline.DSVFormat != TEX_FORMAT_UNKNOWN) - LOG_PSO_ERROR_AND_THROW("DSVFormat must be TEX_FORMAT_UNKNOWN when explicit render pass is used"); + LOG_PSO_ERROR_AND_THROW("DSVFormat must be TEX_FORMAT_UNKNOWN when explicit render pass is used."); for (Uint32 rt = 0; rt < MAX_RENDER_TARGETS; ++rt) { if (GraphicsPipeline.RTVFormats[rt] != TEX_FORMAT_UNKNOWN) - LOG_PSO_ERROR_AND_THROW("RTVFormats[", rt, "] must be TEX_FORMAT_UNKNOWN when explicit render pass is used"); + LOG_PSO_ERROR_AND_THROW("RTVFormats[", rt, "] must be TEX_FORMAT_UNKNOWN when explicit render pass is used."); } const auto& RPDesc = GraphicsPipeline.pRenderPass->GetDesc(); if (GraphicsPipeline.SubpassIndex >= RPDesc.SubpassCount) - LOG_PSO_ERROR_AND_THROW("Subpass index (", Uint32{GraphicsPipeline.SubpassIndex}, ") exceeds the number of subpasses (", Uint32{RPDesc.SubpassCount}, ") in render pass '", RPDesc.Name, "'"); + LOG_PSO_ERROR_AND_THROW("Subpass index (", Uint32{GraphicsPipeline.SubpassIndex}, ") exceeds the number of subpasses (", Uint32{RPDesc.SubpassCount}, ") in render pass '", RPDesc.Name, "'."); } else { @@ -227,12 +227,12 @@ void ValidateGraphicsPipelineCreateInfo(const GraphicsPipelineStateCreateInfo& C if (RTVFmt != TEX_FORMAT_UNKNOWN) { LOG_ERROR_MESSAGE("Render target format (", GetTextureFormatAttribs(RTVFmt).Name, ") of unused slot ", rt, - " must be set to TEX_FORMAT_UNKNOWN"); + " must be set to TEX_FORMAT_UNKNOWN."); } } if (GraphicsPipeline.SubpassIndex != 0) - LOG_PSO_ERROR_AND_THROW("Subpass index (", Uint32{GraphicsPipeline.SubpassIndex}, ") must be 0 when explicit render pass is not used"); + LOG_PSO_ERROR_AND_THROW("Subpass index (", Uint32{GraphicsPipeline.SubpassIndex}, ") must be 0 when explicit render pass is not used."); } } @@ -240,10 +240,10 @@ void ValidateComputePipelineCreateInfo(const ComputePipelineStateCreateInfo& Cre { const auto& PSODesc = CreateInfo.PSODesc; if (PSODesc.PipelineType != PIPELINE_TYPE_COMPUTE) - LOG_PSO_ERROR_AND_THROW("Pipeline type must be COMPUTE"); + LOG_PSO_ERROR_AND_THROW("Pipeline type must be COMPUTE."); if (CreateInfo.pCS == nullptr) - LOG_ERROR_AND_THROW("Compute shader must not be null"); + LOG_ERROR_AND_THROW("Compute shader must not be null."); VALIDATE_SHADER_TYPE(CreateInfo.pCS, SHADER_TYPE_COMPUTE, "compute"); } @@ -252,12 +252,12 @@ void ValidateRayTracingPipelineCreateInfo(IRenderDevice* pDevice, Uint32 MaxRecu { const auto& PSODesc = CreateInfo.PSODesc; if (PSODesc.PipelineType != PIPELINE_TYPE_RAY_TRACING) - LOG_PSO_ERROR_AND_THROW("Pipeline type must be RAY_TRACING"); + LOG_PSO_ERROR_AND_THROW("Pipeline type must be RAY_TRACING."); if (pDevice->GetDeviceCaps().DevType == RENDER_DEVICE_TYPE_D3D12) { if ((CreateInfo.pShaderRecordName != nullptr) != (CreateInfo.RayTracingPipeline.ShaderRecordSize > 0)) - LOG_PSO_ERROR_AND_THROW("pShaderRecordName must not be null if RayTracingPipeline.ShaderRecordSize is not zero"); + LOG_PSO_ERROR_AND_THROW("pShaderRecordName must not be null if RayTracingPipeline.ShaderRecordSize is not zero."); } if (CreateInfo.RayTracingPipeline.MaxRecursionDepth > MaxRecursion) @@ -269,9 +269,9 @@ void ValidateRayTracingPipelineCreateInfo(IRenderDevice* pDevice, Uint32 MaxRecu { const auto& Group = CreateInfo.pGeneralShaders[i]; if (Group.pShader == nullptr) - LOG_PSO_ERROR_AND_THROW("pGeneralShaders[", i, "].pShader must not be null"); + LOG_PSO_ERROR_AND_THROW("pGeneralShaders[", i, "].pShader must not be null."); if (Group.Name == nullptr) - LOG_PSO_ERROR_AND_THROW("pGeneralShaders[", i, "].Name must not be null"); + LOG_PSO_ERROR_AND_THROW("pGeneralShaders[", i, "].Name must not be null."); switch (Group.pShader->GetDesc().ShaderType) { @@ -279,7 +279,7 @@ void ValidateRayTracingPipelineCreateInfo(IRenderDevice* pDevice, Uint32 MaxRecu case SHADER_TYPE_RAY_MISS: case SHADER_TYPE_RAY_CLOSEST_HIT: break; default: - LOG_ERROR_AND_THROW(GetShaderTypeLiteralName(Group.pShader->GetDesc().ShaderType), " is not a valid type for ray tracing general shader"); + LOG_ERROR_AND_THROW(GetShaderTypeLiteralName(Group.pShader->GetDesc().ShaderType), " is not a valid type for ray tracing general shader."); } } @@ -287,30 +287,30 @@ void ValidateRayTracingPipelineCreateInfo(IRenderDevice* pDevice, Uint32 MaxRecu { const auto& Group = CreateInfo.pTriangleHitShaders[i]; if (Group.pClosestHitShader == nullptr) - LOG_PSO_ERROR_AND_THROW("pTriangleHitShaders[", i, "].pClosestHitShader must not be null"); + LOG_PSO_ERROR_AND_THROW("pTriangleHitShaders[", i, "].pClosestHitShader must not be null."); if (Group.Name == nullptr) - LOG_PSO_ERROR_AND_THROW("pTriangleHitShaders[", i, "].Name must not be null"); + LOG_PSO_ERROR_AND_THROW("pTriangleHitShaders[", i, "].Name must not be null."); - VALIDATE_SHADER_TYPE(Group.pClosestHitShader, SHADER_TYPE_RAY_CLOSEST_HIT, "ray tracing triangle closest hit"); + VALIDATE_SHADER_TYPE(Group.pClosestHitShader, SHADER_TYPE_RAY_CLOSEST_HIT, "ray tracing triangle closest hit."); if (Group.pAnyHitShader != nullptr) - VALIDATE_SHADER_TYPE(Group.pAnyHitShader, SHADER_TYPE_RAY_ANY_HIT, "ray tracing triangle any hit"); + VALIDATE_SHADER_TYPE(Group.pAnyHitShader, SHADER_TYPE_RAY_ANY_HIT, "ray tracing triangle any hit."); } for (Uint32 i = 0; i < CreateInfo.ProceduralHitShaderCount; ++i) { const auto& Group = CreateInfo.pProceduralHitShaders[i]; if (Group.pIntersectionShader == nullptr) - LOG_PSO_ERROR_AND_THROW("pProceduralHitShaders[", i, "].pIntersectionShader must not be null"); + LOG_PSO_ERROR_AND_THROW("pProceduralHitShaders[", i, "].pIntersectionShader must not be null."); if (Group.Name == nullptr) - LOG_PSO_ERROR_AND_THROW("pProceduralHitShaders[", i, "].Name must not be null"); + LOG_PSO_ERROR_AND_THROW("pProceduralHitShaders[", i, "].Name must not be null."); - VALIDATE_SHADER_TYPE(Group.pIntersectionShader, SHADER_TYPE_RAY_INTERSECTION, "ray tracing procedural intersection"); + VALIDATE_SHADER_TYPE(Group.pIntersectionShader, SHADER_TYPE_RAY_INTERSECTION, "ray tracing procedural intersection."); if (Group.pClosestHitShader != nullptr) - VALIDATE_SHADER_TYPE(Group.pClosestHitShader, SHADER_TYPE_RAY_CLOSEST_HIT, "ray tracing procedural closest hit"); + VALIDATE_SHADER_TYPE(Group.pClosestHitShader, SHADER_TYPE_RAY_CLOSEST_HIT, "ray tracing procedural closest hit."); if (Group.pAnyHitShader != nullptr) - VALIDATE_SHADER_TYPE(Group.pAnyHitShader, SHADER_TYPE_RAY_ANY_HIT, "ray tracing procedural any hit"); + VALIDATE_SHADER_TYPE(Group.pAnyHitShader, SHADER_TYPE_RAY_ANY_HIT, "ray tracing procedural any hit."); } } @@ -323,21 +323,24 @@ void CopyRayTracingShaderGroups(std::unordered_map<HashMapStringKey, Uint32, Has for (Uint32 i = 0; i < CreateInfo.GeneralShaderCount; ++i) { - bool IsUniqueName = NameToGroupIndex.emplace(HashMapStringKey{MemPool.CopyString(CreateInfo.pGeneralShaders[i].Name)}, GroupIndex++).second; + const auto* Name = CreateInfo.pGeneralShaders[i].Name; + const bool IsUniqueName = NameToGroupIndex.emplace(HashMapStringKey{MemPool.CopyString(Name)}, GroupIndex++).second; if (!IsUniqueName) - LOG_PSO_ERROR_AND_THROW("pGeneralShaders[", i, "].Name must be unique"); + LOG_PSO_ERROR_AND_THROW("pGeneralShaders[", i, "].Name ('", Name, "') must be unique."); } for (Uint32 i = 0; i < CreateInfo.TriangleHitShaderCount; ++i) { - bool IsUniqueName = NameToGroupIndex.emplace(HashMapStringKey{MemPool.CopyString(CreateInfo.pTriangleHitShaders[i].Name)}, GroupIndex++).second; + const auto* Name = CreateInfo.pTriangleHitShaders[i].Name; + const bool IsUniqueName = NameToGroupIndex.emplace(HashMapStringKey{MemPool.CopyString(Name)}, GroupIndex++).second; if (!IsUniqueName) - LOG_PSO_ERROR_AND_THROW("pTriangleHitShaders[", i, "].Name must be unique"); + LOG_PSO_ERROR_AND_THROW("pTriangleHitShaders[", i, "].Name ('", Name, "') must be unique."); } for (Uint32 i = 0; i < CreateInfo.ProceduralHitShaderCount; ++i) { - bool IsUniqueName = NameToGroupIndex.emplace(HashMapStringKey{MemPool.CopyString(CreateInfo.pProceduralHitShaders[i].Name)}, GroupIndex++).second; + const auto* Name = CreateInfo.pProceduralHitShaders[i].Name; + const bool IsUniqueName = NameToGroupIndex.emplace(HashMapStringKey{MemPool.CopyString(Name)}, GroupIndex++).second; if (!IsUniqueName) - LOG_PSO_ERROR_AND_THROW("pProceduralHitShaders[", i, "].Name must be unique"); + LOG_PSO_ERROR_AND_THROW("pProceduralHitShaders[", i, "].Name ('", Name, "') must be unique."); } VERIFY_EXPR(Uint32{CreateInfo.GeneralShaderCount} + Uint32{CreateInfo.TriangleHitShaderCount} + Uint32{CreateInfo.ProceduralHitShaderCount} == GroupIndex); diff --git a/Graphics/GraphicsEngine/src/RenderPassBase.cpp b/Graphics/GraphicsEngine/src/RenderPassBase.cpp index d20ff071..eff4545a 100644 --- a/Graphics/GraphicsEngine/src/RenderPassBase.cpp +++ b/Graphics/GraphicsEngine/src/RenderPassBase.cpp @@ -26,6 +26,7 @@ */ #include "RenderPassBase.hpp" + #include "GraphicsAccessories.hpp" #include "Align.hpp" diff --git a/Graphics/GraphicsEngine/src/ShaderBindingTableBase.cpp b/Graphics/GraphicsEngine/src/ShaderBindingTableBase.cpp index e0cb3461..c783ecfc 100644 --- a/Graphics/GraphicsEngine/src/ShaderBindingTableBase.cpp +++ b/Graphics/GraphicsEngine/src/ShaderBindingTableBase.cpp @@ -36,12 +36,12 @@ void ValidateShaderBindingTableDesc(const ShaderBindingTableDesc& Desc, Uint32 S if (Desc.pPSO == nullptr) { - LOG_SBT_ERROR_AND_THROW("pPSO must not be null"); + LOG_SBT_ERROR_AND_THROW("pPSO must not be null."); } if (Desc.pPSO->GetDesc().PipelineType != PIPELINE_TYPE_RAY_TRACING) { - LOG_SBT_ERROR_AND_THROW("pPSO must be ray tracing pipeline"); + LOG_SBT_ERROR_AND_THROW("pPSO must be ray tracing pipeline."); } diff --git a/Graphics/GraphicsEngine/src/TextureBase.cpp b/Graphics/GraphicsEngine/src/TextureBase.cpp index 323e56ea..064846e3 100644 --- a/Graphics/GraphicsEngine/src/TextureBase.cpp +++ b/Graphics/GraphicsEngine/src/TextureBase.cpp @@ -43,17 +43,17 @@ void ValidateTextureDesc(const TextureDesc& Desc) noexcept(false) if (Desc.Type == RESOURCE_DIM_UNDEFINED) { - LOG_TEXTURE_ERROR_AND_THROW("Resource dimension is undefined"); + LOG_TEXTURE_ERROR_AND_THROW("Resource dimension is undefined."); } if (!(Desc.Type >= RESOURCE_DIM_TEX_1D && Desc.Type <= RESOURCE_DIM_TEX_CUBE_ARRAY)) { - LOG_TEXTURE_ERROR_AND_THROW("Unexpected resource dimension"); + LOG_TEXTURE_ERROR_AND_THROW("Unexpected resource dimension."); } if (Desc.Width == 0) { - LOG_TEXTURE_ERROR_AND_THROW("Texture width cannot be zero"); + LOG_TEXTURE_ERROR_AND_THROW("Texture width cannot be zero."); } // Perform some parameter correctness check @@ -63,25 +63,25 @@ void ValidateTextureDesc(const TextureDesc& Desc) noexcept(false) { if (FmtAttribs.BlockHeight == 1) { - LOG_TEXTURE_ERROR_AND_THROW("Height (", Desc.Height, ") of a Texture 1D/Texture 1D Array must be 1"); + LOG_TEXTURE_ERROR_AND_THROW("Height (", Desc.Height, ") of a Texture 1D/Texture 1D Array must be 1."); } else { LOG_TEXTURE_ERROR_AND_THROW("For block-compressed formats, the height (", Desc.Height, ") of a Texture 1D/Texture 1D Array must be equal to the compressed block height (", - Uint32{FmtAttribs.BlockHeight}, ")"); + Uint32{FmtAttribs.BlockHeight}, ")."); } } } else { if (Desc.Height == 0) - LOG_TEXTURE_ERROR_AND_THROW("Texture height cannot be zero"); + LOG_TEXTURE_ERROR_AND_THROW("Texture height cannot be zero."); } if (Desc.Type == RESOURCE_DIM_TEX_3D && Desc.Depth == 0) { - LOG_TEXTURE_ERROR_AND_THROW("3D texture depth cannot be zero"); + LOG_TEXTURE_ERROR_AND_THROW("3D texture depth cannot be zero."); } if (Desc.Type == RESOURCE_DIM_TEX_1D || Desc.Type == RESOURCE_DIM_TEX_2D) @@ -93,7 +93,7 @@ void ValidateTextureDesc(const TextureDesc& Desc) noexcept(false) if (Desc.Type == RESOURCE_DIM_TEX_CUBE || Desc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) { if (Desc.Width != Desc.Height) - LOG_TEXTURE_ERROR_AND_THROW("For cube map textures, texture width (", Desc.Width, " provided) must match texture height (", Desc.Height, " provided)"); + LOG_TEXTURE_ERROR_AND_THROW("For cube map textures, texture width (", Desc.Width, " provided) must match texture height (", Desc.Height, " provided)."); if (Desc.ArraySize < 6) LOG_TEXTURE_ERROR_AND_THROW("Texture cube/cube array must have at least 6 slices (", Desc.ArraySize, " provided)."); @@ -106,7 +106,7 @@ void ValidateTextureDesc(const TextureDesc& Desc) noexcept(false) MaxDim = std::max(Desc.Width, Desc.Height); else if (Desc.Type == RESOURCE_DIM_TEX_3D) MaxDim = std::max(std::max(Desc.Width, Desc.Height), Desc.Depth); - VERIFY(MaxDim >= (1U << (Desc.MipLevels - 1)), "Texture '", Desc.Name ? Desc.Name : "", "': Incorrect number of Mip levels (", Desc.MipLevels, ")"); + VERIFY(MaxDim >= (1U << (Desc.MipLevels - 1)), "Texture '", Desc.Name ? Desc.Name : "", "': Incorrect number of Mip levels (", Desc.MipLevels, ")."); if (Desc.SampleCount > 1) { @@ -114,7 +114,7 @@ void ValidateTextureDesc(const TextureDesc& Desc) noexcept(false) LOG_TEXTURE_ERROR_AND_THROW("Only Texture 2D/Texture 2D Array can be multisampled"); if (Desc.MipLevels != 1) - LOG_TEXTURE_ERROR_AND_THROW("Multisampled textures must have one mip level (", Desc.MipLevels, " levels specified)"); + LOG_TEXTURE_ERROR_AND_THROW("Multisampled textures must have one mip level (", Desc.MipLevels, " levels specified)."); if (Desc.BindFlags & BIND_UNORDERED_ACCESS) LOG_TEXTURE_ERROR_AND_THROW("UAVs are not allowed for multisampled resources"); @@ -133,20 +133,20 @@ void ValidateTextureDesc(const TextureDesc& Desc) noexcept(false) if (Desc.Usage == USAGE_STAGING) { if (Desc.BindFlags != 0) - LOG_TEXTURE_ERROR_AND_THROW("Staging textures cannot be bound to any GPU pipeline stage"); + LOG_TEXTURE_ERROR_AND_THROW("Staging textures cannot be bound to any GPU pipeline stage."); if (Desc.MiscFlags & MISC_TEXTURE_FLAG_GENERATE_MIPS) - LOG_TEXTURE_ERROR_AND_THROW("Mipmaps cannot be autogenerated for staging textures"); + LOG_TEXTURE_ERROR_AND_THROW("Mipmaps cannot be autogenerated for staging textures."); if (Desc.CPUAccessFlags == 0) - LOG_TEXTURE_ERROR_AND_THROW("Staging textures must specify CPU access flags"); + LOG_TEXTURE_ERROR_AND_THROW("Staging textures must specify CPU access flags."); if ((Desc.CPUAccessFlags & (CPU_ACCESS_READ | CPU_ACCESS_WRITE)) == (CPU_ACCESS_READ | CPU_ACCESS_WRITE)) - LOG_TEXTURE_ERROR_AND_THROW("Staging textures must use exactly one of ACESS_READ or ACCESS_WRITE flags"); + LOG_TEXTURE_ERROR_AND_THROW("Staging textures must use exactly one of ACESS_READ or ACCESS_WRITE flags."); } else if (Desc.Usage == USAGE_UNIFIED) { - LOG_TEXTURE_ERROR_AND_THROW("USAGE_UNIFIED textures are currently not supported"); + LOG_TEXTURE_ERROR_AND_THROW("USAGE_UNIFIED textures are currently not supported."); } } @@ -173,11 +173,11 @@ void ValidateTextureRegion(const TextureDesc& TexDesc, Uint32 MipLevel, Uint32 S TexDesc.Type == RESOURCE_DIM_TEX_CUBE || TexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) { - VERIFY_TEX_PARAMS(Slice < TexDesc.ArraySize, "Array slice (", Slice, ") is out of range [0,", TexDesc.ArraySize - 1, "]"); + VERIFY_TEX_PARAMS(Slice < TexDesc.ArraySize, "Array slice (", Slice, ") is out of range [0,", TexDesc.ArraySize - 1, "]."); } else { - VERIFY_TEX_PARAMS(Slice == 0, "Array slice (", Slice, ") must be 0 for non-array textures"); + VERIFY_TEX_PARAMS(Slice == 0, "Array slice (", Slice, ") must be 0 for non-array textures."); } const auto& FmtAttribs = GetTextureFormatAttribs(TexDesc.Format); @@ -187,12 +187,12 @@ void ValidateTextureRegion(const TextureDesc& TexDesc, Uint32 MipLevel, Uint32 S { VERIFY_EXPR((FmtAttribs.BlockWidth & (FmtAttribs.BlockWidth - 1)) == 0); Uint32 BlockAlignedMipWidth = (MipWidth + (FmtAttribs.BlockWidth - 1)) & ~(FmtAttribs.BlockWidth - 1); - VERIFY_TEX_PARAMS(Box.MaxX <= BlockAlignedMipWidth, "Region max X coordinate (", Box.MaxX, ") is out of allowed range [0, ", BlockAlignedMipWidth, "]"); - VERIFY_TEX_PARAMS((Box.MinX % FmtAttribs.BlockWidth) == 0, "For compressed formats, the region min X coordinate (", Box.MinX, ") must be a multiple of block width (", Uint32{FmtAttribs.BlockWidth}, ")"); - VERIFY_TEX_PARAMS((Box.MaxX % FmtAttribs.BlockWidth) == 0 || Box.MaxX == MipWidth, "For compressed formats, the region max X coordinate (", Box.MaxX, ") must be a multiple of block width (", Uint32{FmtAttribs.BlockWidth}, ") or equal the mip level width (", MipWidth, ")"); + VERIFY_TEX_PARAMS(Box.MaxX <= BlockAlignedMipWidth, "Region max X coordinate (", Box.MaxX, ") is out of allowed range [0, ", BlockAlignedMipWidth, "]."); + VERIFY_TEX_PARAMS((Box.MinX % FmtAttribs.BlockWidth) == 0, "For compressed formats, the region min X coordinate (", Box.MinX, ") must be a multiple of block width (", Uint32{FmtAttribs.BlockWidth}, ")."); + VERIFY_TEX_PARAMS((Box.MaxX % FmtAttribs.BlockWidth) == 0 || Box.MaxX == MipWidth, "For compressed formats, the region max X coordinate (", Box.MaxX, ") must be a multiple of block width (", Uint32{FmtAttribs.BlockWidth}, ") or equal the mip level width (", MipWidth, ")."); } else - VERIFY_TEX_PARAMS(Box.MaxX <= MipWidth, "Region max X coordinate (", Box.MaxX, ") is out of allowed range [0, ", MipWidth, "]"); + VERIFY_TEX_PARAMS(Box.MaxX <= MipWidth, "Region max X coordinate (", Box.MaxX, ") is out of allowed range [0, ", MipWidth, "]."); if (TexDesc.Type != RESOURCE_DIM_TEX_1D && TexDesc.Type != RESOURCE_DIM_TEX_1D_ARRAY) @@ -202,36 +202,36 @@ void ValidateTextureRegion(const TextureDesc& TexDesc, Uint32 MipLevel, Uint32 S { VERIFY_EXPR((FmtAttribs.BlockHeight & (FmtAttribs.BlockHeight - 1)) == 0); Uint32 BlockAlignedMipHeight = (MipHeight + (FmtAttribs.BlockHeight - 1)) & ~(FmtAttribs.BlockHeight - 1); - VERIFY_TEX_PARAMS(Box.MaxY <= BlockAlignedMipHeight, "Region max Y coordinate (", Box.MaxY, ") is out of allowed range [0, ", BlockAlignedMipHeight, "]"); - VERIFY_TEX_PARAMS((Box.MinY % FmtAttribs.BlockHeight) == 0, "For compressed formats, the region min Y coordinate (", Box.MinY, ") must be a multiple of block height (", Uint32{FmtAttribs.BlockHeight}, ")"); - VERIFY_TEX_PARAMS((Box.MaxY % FmtAttribs.BlockHeight) == 0 || Box.MaxY == MipHeight, "For compressed formats, the region max Y coordinate (", Box.MaxY, ") must be a multiple of block height (", Uint32{FmtAttribs.BlockHeight}, ") or equal the mip level height (", MipHeight, ")"); + VERIFY_TEX_PARAMS(Box.MaxY <= BlockAlignedMipHeight, "Region max Y coordinate (", Box.MaxY, ") is out of allowed range [0, ", BlockAlignedMipHeight, "]."); + VERIFY_TEX_PARAMS((Box.MinY % FmtAttribs.BlockHeight) == 0, "For compressed formats, the region min Y coordinate (", Box.MinY, ") must be a multiple of block height (", Uint32{FmtAttribs.BlockHeight}, ")."); + VERIFY_TEX_PARAMS((Box.MaxY % FmtAttribs.BlockHeight) == 0 || Box.MaxY == MipHeight, "For compressed formats, the region max Y coordinate (", Box.MaxY, ") must be a multiple of block height (", Uint32{FmtAttribs.BlockHeight}, ") or equal the mip level height (", MipHeight, ")."); } else - VERIFY_TEX_PARAMS(Box.MaxY <= MipHeight, "Region max Y coordinate (", Box.MaxY, ") is out of allowed range [0, ", MipHeight, "]"); + VERIFY_TEX_PARAMS(Box.MaxY <= MipHeight, "Region max Y coordinate (", Box.MaxY, ") is out of allowed range [0, ", MipHeight, "]."); } if (TexDesc.Type == RESOURCE_DIM_TEX_3D) { Uint32 MipDepth = std::max(TexDesc.Depth >> MipLevel, 1U); - VERIFY_TEX_PARAMS(Box.MaxZ <= MipDepth, "Region max Z coordinate (", Box.MaxZ, ") is out of allowed range [0, ", MipDepth, "]"); + VERIFY_TEX_PARAMS(Box.MaxZ <= MipDepth, "Region max Z coordinate (", Box.MaxZ, ") is out of allowed range [0, ", MipDepth, "]."); } else { - VERIFY_TEX_PARAMS(Box.MinZ == 0, "Region min Z (", Box.MinZ, ") must be 0 for all but 3D textures"); - VERIFY_TEX_PARAMS(Box.MaxZ == 1, "Region max Z (", Box.MaxZ, ") must be 1 for all but 3D textures"); + VERIFY_TEX_PARAMS(Box.MinZ == 0, "Region min Z (", Box.MinZ, ") must be 0 for all but 3D textures."); + VERIFY_TEX_PARAMS(Box.MaxZ == 1, "Region max Z (", Box.MaxZ, ") must be 1 for all but 3D textures."); } #endif } void ValidateUpdateTextureParams(const TextureDesc& TexDesc, Uint32 MipLevel, Uint32 Slice, const Box& DstBox, const TextureSubResData& SubresData) { - VERIFY((SubresData.pData != nullptr) ^ (SubresData.pSrcBuffer != nullptr), "Either CPU data pointer (pData) or GPU buffer (pSrcBuffer) must not be null, but not both"); + 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 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"); + 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."); auto UpdateRegionWidth = DstBox.MaxX - DstBox.MinX; auto UpdateRegionHeight = DstBox.MaxY - DstBox.MinY; @@ -255,9 +255,9 @@ void ValidateUpdateTextureParams(const TextureDesc& TexDesc, Uint32 MipLevel, Ui RowSize = UpdateRegionWidth * Uint32{FmtAttribs.ComponentSize} * Uint32{FmtAttribs.NumComponents}; RowCount = UpdateRegionHeight; } - DEV_CHECK_ERR(SubresData.Stride >= RowSize, "Source data stride (", SubresData.Stride, ") is below the image row size (", RowSize, ")"); + DEV_CHECK_ERR(SubresData.Stride >= RowSize, "Source data stride (", SubresData.Stride, ") is below the image row size (", RowSize, ")."); const Uint32 PlaneSize = SubresData.Stride * RowCount; - DEV_CHECK_ERR(UpdateRegionDepth == 1 || SubresData.DepthStride >= PlaneSize, "Source data depth stride (", SubresData.DepthStride, ") is below the image plane size (", PlaneSize, ")"); + DEV_CHECK_ERR(UpdateRegionDepth == 1 || SubresData.DepthStride >= PlaneSize, "Source data depth stride (", SubresData.DepthStride, ") is below the image plane size (", PlaneSize, ")."); #endif } @@ -295,17 +295,17 @@ void ValidateMapTextureParams(const TextureDesc& TexDesc, Uint32 MapFlags, const Box* pMapRegion) { - VERIFY_TEX_PARAMS(MipLevel < TexDesc.MipLevels, "Mip level (", MipLevel, ") is out of allowed range [0, ", TexDesc.MipLevels - 1, "]"); + VERIFY_TEX_PARAMS(MipLevel < TexDesc.MipLevels, "Mip level (", MipLevel, ") is out of allowed range [0, ", TexDesc.MipLevels - 1, "]."); if (TexDesc.Type == RESOURCE_DIM_TEX_1D_ARRAY || TexDesc.Type == RESOURCE_DIM_TEX_2D_ARRAY || TexDesc.Type == RESOURCE_DIM_TEX_CUBE || TexDesc.Type == RESOURCE_DIM_TEX_CUBE_ARRAY) { - VERIFY_TEX_PARAMS(ArraySlice < TexDesc.ArraySize, "Array slice (", ArraySlice, ") is out of range [0,", TexDesc.ArraySize - 1, "]"); + VERIFY_TEX_PARAMS(ArraySlice < TexDesc.ArraySize, "Array slice (", ArraySlice, ") is out of range [0,", TexDesc.ArraySize - 1, "]."); } else { - VERIFY_TEX_PARAMS(ArraySlice == 0, "Array slice (", ArraySlice, ") must be 0 for non-array textures"); + VERIFY_TEX_PARAMS(ArraySlice == 0, "Array slice (", ArraySlice, ") must be 0 for non-array textures."); } if (pMapRegion != nullptr) @@ -319,7 +319,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD #define TEX_VIEW_VALIDATION_ERROR(...) LOG_ERROR_AND_THROW("\n Failed to create texture view '", (ViewDesc.Name ? ViewDesc.Name : ""), "' for texture '", TexDesc.Name, "': ", ##__VA_ARGS__) if (!(ViewDesc.ViewType > TEXTURE_VIEW_UNDEFINED && ViewDesc.ViewType < TEXTURE_VIEW_NUM_VIEWS)) - TEX_VIEW_VALIDATION_ERROR("Texture view type is not specified"); + TEX_VIEW_VALIDATION_ERROR("Texture view type is not specified."); if (ViewDesc.MostDetailedMip >= TexDesc.MipLevels) TEX_VIEW_VALIDATION_ERROR("Most detailed mip (", ViewDesc.MostDetailedMip, ") is out of range. The texture has only ", TexDesc.MipLevels, " mip ", (TexDesc.MipLevels > 1 ? "levels." : "level.")); @@ -360,7 +360,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD case RESOURCE_DIM_TEX_1D: if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_1D) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 1D view: only Texture 1D is allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 1D view: only Texture 1D is allowed."); } break; @@ -368,7 +368,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_1D_ARRAY && ViewDesc.TextureDim != RESOURCE_DIM_TEX_1D) { - TEX_VIEW_VALIDATION_ERROR("Incorrect view type for Texture 1D Array: only Texture 1D or Texture 1D Array are allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect view type for Texture 1D Array: only Texture 1D or Texture 1D Array are allowed."); } break; @@ -376,7 +376,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY && ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 2D view: only Texture 2D or Texture 2D Array are allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 2D view: only Texture 2D or Texture 2D Array are allowed."); } break; @@ -384,14 +384,14 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY && ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 2D Array view: only Texture 2D or Texture 2D Array are allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 2D Array view: only Texture 2D or Texture 2D Array are allowed."); } break; case RESOURCE_DIM_TEX_3D: if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_3D) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 3D view: only Texture 3D is allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture 3D view: only Texture 3D is allowed."); } break; @@ -402,7 +402,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY && ViewDesc.TextureDim != RESOURCE_DIM_TEX_CUBE) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube SRV: Texture 2D, Texture 2D array or Texture Cube is allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube SRV: Texture 2D, Texture 2D array or Texture Cube is allowed."); } } else @@ -410,7 +410,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D && ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube non-shader resource view: Texture 2D or Texture 2D array is allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube non-shader resource view: Texture 2D or Texture 2D array is allowed."); } } break; @@ -423,7 +423,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD ViewDesc.TextureDim != RESOURCE_DIM_TEX_CUBE && ViewDesc.TextureDim != RESOURCE_DIM_TEX_CUBE_ARRAY) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube array SRV: Texture 2D, Texture 2D array, Texture Cube or Texture Cube Array is allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube array SRV: Texture 2D, Texture 2D array, Texture Cube or Texture Cube Array is allowed."); } } else @@ -431,7 +431,7 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D && ViewDesc.TextureDim != RESOURCE_DIM_TEX_2D_ARRAY) { - TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube array non-shader resource view: Texture 2D or Texture 2D array is allowed"); + TEX_VIEW_VALIDATION_ERROR("Incorrect texture type for Texture cube array non-shader resource view: Texture 2D or Texture 2D array is allowed."); } } break; @@ -444,16 +444,16 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE) { if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE) - TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected"); + TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected."); if (ViewDesc.NumArraySlices != 6 && ViewDesc.NumArraySlices != 0 && ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES) - TEX_VIEW_VALIDATION_ERROR("Texture cube SRV is expected to have 6 array slices, while ", ViewDesc.NumArraySlices, " is provided"); + TEX_VIEW_VALIDATION_ERROR("Texture cube SRV is expected to have 6 array slices, while ", ViewDesc.NumArraySlices, " is provided."); if (ViewDesc.FirstArraySlice != 0) - TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture cube SRV"); + TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture cube SRV."); } if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE_ARRAY) { if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE) - TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected"); + TEX_VIEW_VALIDATION_ERROR("Unexpected view type: SRV is expected."); if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && (ViewDesc.NumArraySlices % 6) != 0) TEX_VIEW_VALIDATION_ERROR("Number of slices in texture cube array SRV is expected to be multiple of 6. ", ViewDesc.NumArraySlices, " slices is provided."); } @@ -462,10 +462,10 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D) { if (ViewDesc.FirstArraySlice != 0) - TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture 1D/2D views"); + TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") must be 0 for non-array texture 1D/2D views."); if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && ViewDesc.NumArraySlices > 1) - TEX_VIEW_VALIDATION_ERROR("Number of slices in the view (", ViewDesc.NumArraySlices, ") must be 1 (or 0) for non-array texture 1D/2D views"); + TEX_VIEW_VALIDATION_ERROR("Number of slices in the view (", ViewDesc.NumArraySlices, ") must be 1 (or 0) for non-array texture 1D/2D views."); } else if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_1D_ARRAY || ViewDesc.TextureDim == RESOURCE_DIM_TEX_2D_ARRAY || @@ -473,16 +473,16 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD ViewDesc.TextureDim == RESOURCE_DIM_TEX_CUBE_ARRAY) { if (ViewDesc.FirstArraySlice >= TexDesc.ArraySize) - TEX_VIEW_VALIDATION_ERROR("First array slice (", ViewDesc.FirstArraySlice, ") exceeds the number of slices in the texture array (", TexDesc.ArraySize, ")"); + TEX_VIEW_VALIDATION_ERROR("First array slice (", ViewDesc.FirstArraySlice, ") exceeds the number of slices in the texture array (", TexDesc.ArraySize, ")."); if (ViewDesc.NumArraySlices != REMAINING_ARRAY_SLICES && ViewDesc.FirstArraySlice + ViewDesc.NumArraySlices > TexDesc.ArraySize) - TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") and number of slices in the view (", ViewDesc.NumArraySlices, ") specify more slices than target texture has (", TexDesc.ArraySize, ")"); + TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstArraySlice, ") and number of slices in the view (", ViewDesc.NumArraySlices, ") specify more slices than target texture has (", TexDesc.ArraySize, ")."); } else if (ViewDesc.TextureDim == RESOURCE_DIM_TEX_3D) { auto MipDepth = TexDesc.Depth >> ViewDesc.MostDetailedMip; if (ViewDesc.FirstDepthSlice + ViewDesc.NumDepthSlices > MipDepth) - TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstDepthSlice, ") and number of slices in the view (", ViewDesc.NumDepthSlices, ") specify more slices than target 3D texture mip level has (", MipDepth, ")"); + TEX_VIEW_VALIDATION_ERROR("First slice (", ViewDesc.FirstDepthSlice, ") and number of slices in the view (", ViewDesc.NumDepthSlices, ") specify more slices than target 3D texture mip level has (", MipDepth, ")."); } else { @@ -491,16 +491,16 @@ void ValidatedAndCorrectTextureViewDesc(const TextureDesc& TexDesc, TextureViewD if (GetTextureFormatAttribs(ViewDesc.Format).IsTypeless) { - TEX_VIEW_VALIDATION_ERROR("Texture view format (", GetTextureFormatAttribs(ViewDesc.Format).Name, ") cannot be typeless"); + TEX_VIEW_VALIDATION_ERROR("Texture view format (", GetTextureFormatAttribs(ViewDesc.Format).Name, ") cannot be typeless."); } if ((ViewDesc.Flags & TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION) != 0) { if ((TexDesc.MiscFlags & MISC_TEXTURE_FLAG_GENERATE_MIPS) == 0) - TEX_VIEW_VALIDATION_ERROR("TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION flag can only set if the texture was created with MISC_TEXTURE_FLAG_GENERATE_MIPS flag"); + TEX_VIEW_VALIDATION_ERROR("TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION flag can only set if the texture was created with MISC_TEXTURE_FLAG_GENERATE_MIPS flag."); if (ViewDesc.ViewType != TEXTURE_VIEW_SHADER_RESOURCE) - TEX_VIEW_VALIDATION_ERROR("TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION flag can only be used with TEXTURE_VIEW_SHADER_RESOURCE view type"); + TEX_VIEW_VALIDATION_ERROR("TEXTURE_VIEW_FLAG_ALLOW_MIP_MAP_GENERATION flag can only be used with TEXTURE_VIEW_SHADER_RESOURCE view type."); } #undef TEX_VIEW_VALIDATION_ERROR diff --git a/Graphics/GraphicsEngine/src/TopLevelASBase.cpp b/Graphics/GraphicsEngine/src/TopLevelASBase.cpp index 5ccc51c4..f24540bd 100644 --- a/Graphics/GraphicsEngine/src/TopLevelASBase.cpp +++ b/Graphics/GraphicsEngine/src/TopLevelASBase.cpp @@ -38,24 +38,24 @@ void ValidateTopLevelASDesc(const TopLevelASDesc& Desc) noexcept(false) { if (Desc.MaxInstanceCount != 0) { - LOG_TLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, MaxInstanceCount must be zero"); + LOG_TLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, MaxInstanceCount must be zero."); } if (Desc.Flags != RAYTRACING_BUILD_AS_NONE) { - LOG_TLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, Flags must be RAYTRACING_BUILD_AS_NONE"); + LOG_TLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, Flags must be RAYTRACING_BUILD_AS_NONE."); } } else { if (Desc.MaxInstanceCount == 0) { - LOG_TLAS_ERROR_AND_THROW("MaxInstanceCount must not be zero"); + LOG_TLAS_ERROR_AND_THROW("MaxInstanceCount must not be zero."); } if ((Desc.Flags & RAYTRACING_BUILD_AS_PREFER_FAST_TRACE) != 0 && (Desc.Flags & RAYTRACING_BUILD_AS_PREFER_FAST_BUILD) != 0) { - LOG_TLAS_ERROR_AND_THROW("RAYTRACING_BUILD_AS_PREFER_FAST_TRACE and RAYTRACING_BUILD_AS_PREFER_FAST_BUILD flags are mutually exclusive"); + LOG_TLAS_ERROR_AND_THROW("RAYTRACING_BUILD_AS_PREFER_FAST_TRACE and RAYTRACING_BUILD_AS_PREFER_FAST_BUILD flags are mutually exclusive."); } } |
