summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-12-17 06:08:08 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-12-17 06:08:08 +0000
commit44a39af925d570f790e0727ee67ca3124a08a97d (patch)
treea97d1e9282ba418eaeeb2495247079faa033c69b /Graphics/GraphicsEngine
parentFixed validation errors for ray tracing. (diff)
downloadDiligentCore-44a39af925d570f790e0727ee67ca3124a08a97d.tar.gz
DiligentCore-44a39af925d570f790e0727ee67ca3124a08a97d.zip
A bunch of minor updates (comments, parameter validation, etc.)
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/BottomLevelASBase.hpp57
-rw-r--r--Graphics/GraphicsEngine/include/BufferBase.hpp22
-rw-r--r--Graphics/GraphicsEngine/include/BufferViewBase.hpp16
-rw-r--r--Graphics/GraphicsEngine/include/CommandListBase.hpp14
-rw-r--r--Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h4
-rw-r--r--Graphics/GraphicsEngine/include/Defines.h2
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.hpp80
-rw-r--r--Graphics/GraphicsEngine/include/DeviceObjectBase.hpp2
-rw-r--r--Graphics/GraphicsEngine/src/BottomLevelASBase.cpp38
-rw-r--r--Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp1
10 files changed, 123 insertions, 113 deletions
diff --git a/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp b/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp
index 4e061c4c..79802f8d 100644
--- a/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp
+++ b/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp
@@ -44,19 +44,22 @@ namespace Diligent
struct BLASGeomIndex
{
- Uint32 IndexInDesc = INVALID_INDEX; // geometry index in description
- Uint32 ActualIndex = INVALID_INDEX; // geometry index in build operation
+ Uint32 IndexInDesc = INVALID_INDEX; // Geometry index in BottomLevelASDesc
+ Uint32 ActualIndex = INVALID_INDEX; // Geometry index in build operation
BLASGeomIndex() {}
- BLASGeomIndex(Uint32 _IndexInDesc, Uint32 _ActualIndex) :
- IndexInDesc{_IndexInDesc}, ActualIndex{_ActualIndex} {}
+ BLASGeomIndex(Uint32 _IndexInDesc,
+ Uint32 _ActualIndex) :
+ IndexInDesc{_IndexInDesc},
+ ActualIndex{_ActualIndex}
+ {}
};
using BLASNameToIndex = std::unordered_map<HashMapStringKey, BLASGeomIndex, HashMapStringKey::Hasher>;
-/// Validates bottom-level AS description and throws and exception in case of an error.
+/// Validates bottom-level AS description and throws an exception in case of an error.
void ValidateBottomLevelASDesc(const BottomLevelASDesc& Desc) noexcept(false);
-/// Copies bottom-level AS geometry description using MemPool to allocate required dynamic space.
+/// Copies bottom-level AS geometry description using MemPool to allocate required space.
void CopyBLASGeometryDesc(const BottomLevelASDesc& SrcDesc,
BottomLevelASDesc& DstDesc,
FixedLinearAllocator& MemPool,
@@ -64,11 +67,11 @@ void CopyBLASGeometryDesc(const BottomLevelASDesc& SrcDesc,
BLASNameToIndex& DstNameToIndex) noexcept(false);
-/// Template class implementing base functionality for a bottom-level acceleration structure object.
+/// Template class implementing base functionality of the bottom-level acceleration structure object.
-/// \tparam BaseInterface - base interface that this class will inheret
+/// \tparam BaseInterface - Base interface that this class will inheret
/// (Diligent::IBottomLevelASD3D12 or Diligent::IBottomLevelASVk).
-/// \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 RenderDeviceImplType>
class BottomLevelASBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType, BottomLevelASDesc>
@@ -76,10 +79,10 @@ class BottomLevelASBase : public DeviceObjectBase<BaseInterface, RenderDeviceImp
public:
using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, BottomLevelASDesc>;
- /// \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 - BLAS 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.
BottomLevelASBase(IReferenceCounters* pRefCounters,
RenderDeviceImplType* pDevice,
@@ -105,11 +108,11 @@ public:
IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BottomLevelAS, TDeviceObjectBase)
- // Maps geometry that was used in build operation to geometry description.
+ // Maps geometry that was used in a build operation to the geometry description.
// Returns the geometry index in geometry description.
Uint32 UpdateGeometryIndex(const char* Name, Uint32& ActualIndex, bool OnUpdate)
{
- VERIFY_EXPR(Name != nullptr && Name[0] != '\0');
+ DEV_CHECK_ERR(Name != nullptr && Name[0] != '\0', "Geometry name must not be empty");
auto iter = m_NameToIndex.find(Name);
if (iter != m_NameToIndex.end())
@@ -124,9 +127,10 @@ public:
return INVALID_INDEX;
}
+ /// Implementation of IBottomLevelAS::GetGeometryDescIndex()
virtual Uint32 DILIGENT_CALL_TYPE GetGeometryDescIndex(const char* Name) const override final
{
- VERIFY_EXPR(Name != nullptr && Name[0] != '\0');
+ DEV_CHECK_ERR(Name != nullptr && Name[0] != '\0', "Geometry name must not be empty");
auto iter = m_NameToIndex.find(Name);
if (iter != m_NameToIndex.end())
@@ -136,27 +140,30 @@ public:
return INVALID_INDEX;
}
+ /// Implementation of IBottomLevelAS::GetGeometryIndex()
virtual Uint32 DILIGENT_CALL_TYPE GetGeometryIndex(const char* Name) const override final
{
- VERIFY_EXPR(Name != nullptr && Name[0] != '\0');
+ DEV_CHECK_ERR(Name != nullptr && Name[0] != '\0', "Geometry name must not be emtpy");
auto iter = m_NameToIndex.find(Name);
if (iter != m_NameToIndex.end())
{
- VERIFY(iter->second.ActualIndex != INVALID_INDEX, "Geometry with name '", Name, "', exists but was not enabled during last build");
+ VERIFY(iter->second.ActualIndex != INVALID_INDEX, "Geometry with name '", Name, "', exists, but was not enabled in the last build");
return iter->second.ActualIndex;
}
LOG_ERROR_MESSAGE("Can't find geometry with name '", Name, '\'');
return INVALID_INDEX;
}
+ /// Implementation of IBottomLevelAS::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,
- "Unsupported state for a bottom-level acceleration structure");
+ DEV_CHECK_ERR(State == RESOURCE_STATE_UNKNOWN || State == RESOURCE_STATE_BUILD_AS_READ || State == RESOURCE_STATE_BUILD_AS_WRITE,
+ "Unsupported state for a bottom-level acceleration structure");
this->m_State = State;
}
+ /// Implementation of IBottomLevelAS::GetState()
virtual RESOURCE_STATE DILIGENT_CALL_TYPE GetState() const override final
{
return this->m_State;
@@ -175,20 +182,20 @@ public:
bool CheckState(RESOURCE_STATE State) const
{
- VERIFY((State & (State - 1)) == 0, "Single state is expected");
- VERIFY(IsInKnownState(), "BLAS state is unknown");
+ DEV_CHECK_ERR((State & (State - 1)) == 0, "Single state is expected");
+ DEV_CHECK_ERR(IsInKnownState(), "BLAS state is unknown");
return (this->m_State & State) == State;
}
#ifdef DILIGENT_DEVELOPMENT
void UpdateVersion()
{
- this->m_DbgVersion.fetch_add(1);
+ this->m_DvpVersion.fetch_add(1);
}
Uint32 GetVersion() const
{
- return this->m_DbgVersion.load();
+ return this->m_DvpVersion.load();
}
#endif // DILIGENT_DEVELOPMENT
@@ -238,7 +245,7 @@ private:
this->m_Desc.pBoxes = nullptr;
this->m_Desc.BoxCount = 0;
- m_NameToIndex.clear();
+ m_NameToIndex = decltype(m_NameToIndex){};
}
protected:
@@ -249,7 +256,7 @@ protected:
ScratchBufferSizes m_ScratchSize;
#ifdef DILIGENT_DEVELOPMENT
- std::atomic<Uint32> m_DbgVersion{0};
+ std::atomic<Uint32> m_DvpVersion{0};
#endif
};
diff --git a/Graphics/GraphicsEngine/include/BufferBase.hpp b/Graphics/GraphicsEngine/include/BufferBase.hpp
index f09e8fc5..f7251c42 100644
--- a/Graphics/GraphicsEngine/include/BufferBase.hpp
+++ b/Graphics/GraphicsEngine/include/BufferBase.hpp
@@ -52,15 +52,15 @@ void ValidateBufferInitData(const BufferDesc& Desc, const BufferData* pBuffData)
void ValidateAndCorrectBufferViewDesc(const BufferDesc& BuffDesc, BufferViewDesc& ViewDesc) noexcept(false);
-/// Template class implementing base functionality for a buffer object
+/// Template class implementing base functionality of the buffer object
-/// \tparam BaseInterface - base interface that this class will inheret
+/// \tparam BaseInterface - Base interface that this class will inheret
/// (Diligent::IBufferD3D11, Diligent::IBufferD3D12,
/// Diligent::IBufferGL or Diligent::IBufferVk).
-/// \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)
-/// \tparam BufferViewImplType - type of the buffer view implementation
+/// \tparam BufferViewImplType - Type of the buffer view implementation
/// (Diligent::BufferViewD3D11Impl, Diligent::BufferViewD3D12Impl,
/// Diligent::BufferViewGLImpl or Diligent::BufferViewVkImpl)
/// \tparam TBuffViewObjAllocator - type of the allocator that is used to allocate memory for the buffer view object instances
@@ -70,12 +70,12 @@ class BufferBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplType,
public:
using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, BufferDesc>;
- /// \param pRefCounters - reference counters object that controls the lifetime of this buffer.
- /// \param BuffViewObjAllocator - allocator that is used to allocate memory for the buffer view instances.
+ /// \param pRefCounters - Reference counters object that controls the lifetime of this buffer.
+ /// \param BuffViewObjAllocator - Allocator that is used to allocate memory for the buffer view instances.
/// This parameter is only used for debug purposes.
- /// \param pDevice - pointer to the device.
- /// \param BuffDesc - buffer description.
- /// \param bIsDeviceInternal - flag indicating if the buffer is an internal device object and
+ /// \param pDevice - Pointer to the device.
+ /// \param BuffDesc - Buffer description.
+ /// \param bIsDeviceInternal - Flag indicating if the buffer is an internal device object and
/// must not keep a strong reference to the device.
BufferBase(IReferenceCounters* pRefCounters,
TBuffViewObjAllocator& BuffViewObjAllocator,
@@ -198,8 +198,8 @@ public:
bool CheckState(RESOURCE_STATE State) const
{
- VERIFY((State & (State - 1)) == 0, "Single state is expected");
- VERIFY(IsInKnownState(), "Buffer state is unknown");
+ DEV_CHECK_ERR((State & (State - 1)) == 0, "Single state is expected");
+ DEV_CHECK_ERR(IsInKnownState(), "Buffer state is unknown");
return (this->m_State & State) == State;
}
diff --git a/Graphics/GraphicsEngine/include/BufferViewBase.hpp b/Graphics/GraphicsEngine/include/BufferViewBase.hpp
index a48d6ed7..7530a6cb 100644
--- a/Graphics/GraphicsEngine/include/BufferViewBase.hpp
+++ b/Graphics/GraphicsEngine/include/BufferViewBase.hpp
@@ -38,12 +38,12 @@
namespace Diligent
{
-/// Template class implementing base functionality for a buffer view object
+/// Template class implementing base functionality of the buffer view object
-/// \tparam BaseInterface - base interface that this class will inheret
+/// \tparam BaseInterface - Base interface that this class will inheret
/// (Diligent::IBufferViewD3D11, Diligent::IBufferViewD3D12,
/// Diligent::IBufferViewGL or Diligent::IBufferViewVk).
-/// \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>
@@ -52,11 +52,11 @@ class BufferViewBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplTy
public:
using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, BufferViewDesc>;
- /// \param pRefCounters - reference counters object that controls the lifetime of this buffer view.
- /// \param pDevice - pointer to the render device.
- /// \param ViewDesc - buffer view description.
- /// \param pBuffer - pointer to the buffer 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 buffer view.
+ /// \param pDevice - Pointer to the render device.
+ /// \param ViewDesc - Buffer view description.
+ /// \param pBuffer - Pointer to the buffer that the view is to be created for.
+ /// \param bIsDefaultView - Flag indicating if the view is a default view, and is thus
/// part of the buffer object. In this case the view will attach
/// to the buffer's reference counters.
BufferViewBase(IReferenceCounters* pRefCounters,
diff --git a/Graphics/GraphicsEngine/include/CommandListBase.hpp b/Graphics/GraphicsEngine/include/CommandListBase.hpp
index 051eb737..3a04e7b3 100644
--- a/Graphics/GraphicsEngine/include/CommandListBase.hpp
+++ b/Graphics/GraphicsEngine/include/CommandListBase.hpp
@@ -41,11 +41,11 @@ struct CommandListDesc : public DeviceObjectAttribs
{
};
-/// Template class implementing base functionality for a command list object.
+/// Template class implementing base functionality of the command list object.
-/// \tparam BaseInterface - base interface that this class will inheret
+/// \tparam BaseInterface - Base interface that this class will inheret
/// (Diligent::ICommandListD3D11, Diligent::ICommandListD3D12 or Diligent::ICommandListVk).
-/// \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,12 +54,12 @@ class CommandListBase : public DeviceObjectBase<BaseInterface, RenderDeviceImplT
public:
using TDeviceObjectBase = DeviceObjectBase<BaseInterface, RenderDeviceImplType, CommandListDesc>;
- /// \param pRefCounters - reference counters object that controls the lifetime of this command list.
- /// \param pDevice - pointer to the device.
- /// \param bIsDeviceInternal - flag indicating if the CommandList is an internal device object and
+ /// \param pRefCounters - Reference counters object that controls the lifetime of this command list.
+ /// \param pDevice - Pointer to the device.
+ /// \param bIsDeviceInternal - Flag indicating if the CommandList is an internal device object and
/// must not keep a strong reference to the device.
CommandListBase(IReferenceCounters* pRefCounters, RenderDeviceImplType* pDevice, bool bIsDeviceInternal = false) :
- TDeviceObjectBase{pRefCounters, pDevice, CommandListDesc(), bIsDeviceInternal}
+ TDeviceObjectBase{pRefCounters, pDevice, CommandListDesc{}, bIsDeviceInternal}
{}
~CommandListBase()
diff --git a/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h b/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
index eb441c97..3b5e25d4 100644
--- a/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
+++ b/Graphics/GraphicsEngine/include/DefaultShaderSourceStreamFactory.h
@@ -32,9 +32,9 @@
DILIGENT_BEGIN_NAMESPACE(Diligent)
-/// Creates default shader source stream factory
+/// Creates a default shader source stream factory
/// \param [in] SearchDirectories - Semicolon-seprated list of search directories.
-/// \param [out] ppShaderSourceStreamFactory - Memory address where pointer to the shader source stream factory will be written.
+/// \param [out] ppShaderSourceStreamFactory - Memory address where the pointer to the shader source stream factory will be written.
void CreateDefaultShaderSourceStreamFactory(const Char* SearchDirectories,
IShaderSourceInputStreamFactory** ppShaderSourceStreamFactory);
diff --git a/Graphics/GraphicsEngine/include/Defines.h b/Graphics/GraphicsEngine/include/Defines.h
index be44e098..967974d6 100644
--- a/Graphics/GraphicsEngine/include/Defines.h
+++ b/Graphics/GraphicsEngine/include/Defines.h
@@ -28,5 +28,5 @@
#pragma once
#if !D3D11_SUPPORTED && !D3D12_SUPPORTED && !GL_SUPPORTED && !GLES_SUPPORTED && !VULKAN_SUPPORTED && !METAL_SUPPORTED
-# error No API is supported on this platform. At least one of D3D11_SUPPORTED, D3D12_SUPPORTED, GL_SUPPORTED, GLES_SUPPORTED, VULKAN_SUPPORTED, or METAL_SUPPORTED macros must be defined as 1.
+# error No API is supported on this platform: one of D3D11_SUPPORTED, D3D12_SUPPORTED, GL_SUPPORTED, GLES_SUPPORTED, VULKAN_SUPPORTED, or METAL_SUPPORTED macros must be defined as 1.
#endif
diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp
index e57b8c8c..ba028dd3 100644
--- a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp
+++ b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp
@@ -90,8 +90,8 @@ struct VertexStreamInfo
/// Base implementation of the device context.
-/// \tparam BaseInterface - base interface that this class will inheret.
-/// \tparam ImplementationTraits - implementation traits that define specific implementation details
+/// \tparam BaseInterface - Base interface that this class will inheret.
+/// \tparam ImplementationTraits - Implementation traits that define specific implementation details
/// (texture implemenation type, buffer implementation type, etc.)
/// \remarks Device context keeps strong references to all objects currently bound to
/// the pipeline: buffers, tetxures, states, SRBs, etc.
@@ -113,9 +113,9 @@ public:
using BottomLevelASType = typename ImplementationTraits::BottomLevelASType;
using TopLevelASType = typename ImplementationTraits::TopLevelASType;
- /// \param pRefCounters - reference counters object that controls the lifetime of this device context.
- /// \param pRenderDevice - render device.
- /// \param bIsDeferred - flag indicating if this instance is a deferred context
+ /// \param pRefCounters - Reference counters object that controls the lifetime of this device context.
+ /// \param pRenderDevice - Render device.
+ /// \param bIsDeferred - Flag indicating if this instance is a deferred context
DeviceContextBase(IReferenceCounters* pRefCounters, DeviceImplType* pRenderDevice, bool bIsDeferred) :
// clang-format off
TObjectBase {pRefCounters },
@@ -491,9 +491,9 @@ inline bool DeviceContextBase<BaseInterface, ImplementationTraits>::CommitShader
int)
{
#ifdef DILIGENT_DEVELOPMENT
- VERIFY(!(m_pActiveRenderPass != nullptr && StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION),
- "Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. "
- "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first.");
+ DEV_CHECK_ERR(!(m_pActiveRenderPass != nullptr && StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION),
+ "Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. "
+ "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first.");
if (!m_pPipelineState)
{
@@ -532,9 +532,9 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::SetIndexBuff
m_pIndexBuffer = ValidatedCast<BufferImplType>(pIndexBuffer);
m_IndexDataStartOffset = ByteOffset;
#ifdef DILIGENT_DEVELOPMENT
- VERIFY(!(m_pActiveRenderPass != nullptr && StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION),
- "Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. "
- "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first.");
+ DEV_CHECK_ERR(!(m_pActiveRenderPass != nullptr && StateTransitionMode == RESOURCE_STATE_TRANSITION_MODE_TRANSITION),
+ "Resource state transitons are not allowed inside a render pass and may result in an undefined behavior. "
+ "Do not use RESOURCE_STATE_TRANSITION_MODE_TRANSITION or end the render pass first.");
if (m_pIndexBuffer)
{
@@ -551,8 +551,8 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::SetIndexBuff
template <typename BaseInterface, typename ImplementationTraits>
inline void DeviceContextBase<BaseInterface, ImplementationTraits>::GetPipelineState(IPipelineState** ppPSO, float* BlendFactors, Uint32& StencilRef)
{
- VERIFY(ppPSO != nullptr, "Null pointer provided null");
- VERIFY(*ppPSO == nullptr, "Memory address contains a pointer to a non-null blend state");
+ DEV_CHECK_ERR(ppPSO != nullptr, "Null pointer provided null");
+ DEV_CHECK_ERR(*ppPSO == nullptr, "Memory address contains a pointer to a non-null blend state");
if (m_pPipelineState)
{
m_pPipelineState->QueryInterface(IID_PipelineState, reinterpret_cast<IObject**>(ppPSO));
@@ -604,7 +604,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::SetViewports
RTHeight = m_FramebufferHeight;
}
- VERIFY(NumViewports < MAX_VIEWPORTS, "Number of viewports (", NumViewports, ") exceeds the limit (", MAX_VIEWPORTS, ")");
+ DEV_CHECK_ERR(NumViewports < MAX_VIEWPORTS, "Number of viewports (", NumViewports, ") exceeds the limit (", MAX_VIEWPORTS, ")");
m_NumViewports = std::min(MAX_VIEWPORTS, NumViewports);
Viewport DefaultVP(0, 0, static_cast<float>(RTWidth), static_cast<float>(RTHeight));
@@ -617,9 +617,9 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::SetViewports
for (Uint32 vp = 0; vp < m_NumViewports; ++vp)
{
m_Viewports[vp] = pViewports[vp];
- VERIFY(m_Viewports[vp].Width >= 0, "Incorrect viewport width (", m_Viewports[vp].Width, ")");
- VERIFY(m_Viewports[vp].Height >= 0, "Incorrect viewport height (", m_Viewports[vp].Height, ")");
- VERIFY(m_Viewports[vp].MaxDepth >= m_Viewports[vp].MinDepth, "Incorrect viewport depth range [", m_Viewports[vp].MinDepth, ", ", m_Viewports[vp].MaxDepth, "]");
+ DEV_CHECK_ERR(m_Viewports[vp].Width >= 0, "Incorrect viewport width (", m_Viewports[vp].Width, ")");
+ DEV_CHECK_ERR(m_Viewports[vp].Height >= 0, "Incorrect viewport height (", m_Viewports[vp].Height, ")");
+ DEV_CHECK_ERR(m_Viewports[vp].MaxDepth >= m_Viewports[vp].MinDepth, "Incorrect viewport depth range [", m_Viewports[vp].MinDepth, ", ", m_Viewports[vp].MaxDepth, "]");
}
}
@@ -647,14 +647,14 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::SetScissorRe
RTHeight = m_FramebufferHeight;
}
- VERIFY(NumRects < MAX_VIEWPORTS, "Number of scissor rects (", NumRects, ") exceeds the limit (", MAX_VIEWPORTS, ")");
+ DEV_CHECK_ERR(NumRects < MAX_VIEWPORTS, "Number of scissor rects (", NumRects, ") exceeds the limit (", MAX_VIEWPORTS, ")");
m_NumScissorRects = std::min(MAX_VIEWPORTS, NumRects);
for (Uint32 sr = 0; sr < m_NumScissorRects; ++sr)
{
m_ScissorRects[sr] = pRects[sr];
- VERIFY(m_ScissorRects[sr].left <= m_ScissorRects[sr].right, "Incorrect horizontal bounds for a scissor rect [", m_ScissorRects[sr].left, ", ", m_ScissorRects[sr].right, ")");
- VERIFY(m_ScissorRects[sr].top <= m_ScissorRects[sr].bottom, "Incorrect vertical bounds for a scissor rect [", m_ScissorRects[sr].top, ", ", m_ScissorRects[sr].bottom, ")");
+ DEV_CHECK_ERR(m_ScissorRects[sr].left <= m_ScissorRects[sr].right, "Incorrect horizontal bounds for a scissor rect [", m_ScissorRects[sr].left, ", ", m_ScissorRects[sr].right, ")");
+ DEV_CHECK_ERR(m_ScissorRects[sr].top <= m_ScissorRects[sr].bottom, "Incorrect vertical bounds for a scissor rect [", m_ScissorRects[sr].top, ", ", m_ScissorRects[sr].bottom, ")");
}
}
@@ -1288,8 +1288,8 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::UpdateBuffer
const void* pData,
RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)
{
- VERIFY(pBuffer != nullptr, "Buffer must not be null");
- VERIFY(m_pActiveRenderPass == nullptr, "UpdateBuffer command must be used outside of render pass.");
+ DEV_CHECK_ERR(pBuffer != nullptr, "Buffer must not be null");
+ DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "UpdateBuffer command must be used outside of render pass.");
#ifdef DILIGENT_DEVELOPMENT
{
const auto& BuffDesc = ValidatedCast<BufferImplType>(pBuffer)->GetDesc();
@@ -1310,9 +1310,9 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::CopyBuffer(
Uint32 Size,
RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode)
{
- VERIFY(pSrcBuffer != nullptr, "Source buffer must not be null");
- VERIFY(pDstBuffer != nullptr, "Destination buffer must not be null");
- VERIFY(m_pActiveRenderPass == nullptr, "CopyBuffer command must be used outside of render pass.");
+ DEV_CHECK_ERR(pSrcBuffer != nullptr, "Source buffer must not be null");
+ DEV_CHECK_ERR(pDstBuffer != nullptr, "Destination buffer must not be null");
+ DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "CopyBuffer command must be used outside of render pass.");
#ifdef DILIGENT_DEVELOPMENT
{
const auto& SrcBufferDesc = ValidatedCast<BufferImplType>(pSrcBuffer)->GetDesc();
@@ -1330,7 +1330,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::MapBuffer(
MAP_FLAGS MapFlags,
PVoid& pMappedData)
{
- VERIFY(pBuffer, "pBuffer must not be null");
+ DEV_CHECK_ERR(pBuffer, "pBuffer must not be null");
const auto& BuffDesc = pBuffer->GetDesc();
@@ -1406,8 +1406,8 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::UpdateTextur
RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode,
RESOURCE_STATE_TRANSITION_MODE TextureTransitionMode)
{
- VERIFY(pTexture != nullptr, "pTexture must not be null");
- VERIFY(m_pActiveRenderPass == nullptr, "UpdateTexture command must be used outside of render pass.");
+ DEV_CHECK_ERR(pTexture != nullptr, "pTexture must not be null");
+ DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "UpdateTexture command must be used outside of render pass.");
ValidateUpdateTextureParams(pTexture->GetDesc(), MipLevel, Slice, DstBox, SubresData);
}
@@ -1415,9 +1415,9 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::UpdateTextur
template <typename BaseInterface, typename ImplementationTraits>
inline void DeviceContextBase<BaseInterface, ImplementationTraits>::CopyTexture(const CopyTextureAttribs& CopyAttribs)
{
- VERIFY(CopyAttribs.pSrcTexture, "Src texture must not be null");
- VERIFY(CopyAttribs.pDstTexture, "Dst texture must not be null");
- VERIFY(m_pActiveRenderPass == nullptr, "CopyTexture command must be used outside of render pass.");
+ DEV_CHECK_ERR(CopyAttribs.pSrcTexture, "Src texture must not be null");
+ DEV_CHECK_ERR(CopyAttribs.pDstTexture, "Dst texture must not be null");
+ DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "CopyTexture command must be used outside of render pass.");
ValidateCopyTextureParams(CopyAttribs);
}
@@ -1432,7 +1432,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::MapTextureSu
const Box* pMapRegion,
MappedTextureSubresource& MappedData)
{
- VERIFY(pTexture, "pTexture must not be null");
+ DEV_CHECK_ERR(pTexture, "pTexture must not be null");
ValidateMapTextureParams(pTexture->GetDesc(), MipLevel, ArraySlice, MapType, MapFlags, pMapRegion);
}
@@ -1442,7 +1442,7 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::UnmapTexture
Uint32 MipLevel,
Uint32 ArraySlice)
{
- VERIFY(pTexture, "pTexture must not be null");
+ DEV_CHECK_ERR(pTexture, "pTexture must not be null");
DEV_CHECK_ERR(MipLevel < pTexture->GetDesc().MipLevels, "Mip level is out of range");
DEV_CHECK_ERR(ArraySlice < pTexture->GetDesc().ArraySize, "Array slice is out of range");
}
@@ -1450,8 +1450,8 @@ inline void DeviceContextBase<BaseInterface, ImplementationTraits>::UnmapTexture
template <typename BaseInterface, typename ImplementationTraits>
inline void DeviceContextBase<BaseInterface, ImplementationTraits>::GenerateMips(ITextureView* pTexView)
{
- VERIFY(pTexView != nullptr, "pTexView must not be null");
- VERIFY(m_pActiveRenderPass == nullptr, "GenerateMips command must be used outside of render pass.");
+ DEV_CHECK_ERR(pTexView != nullptr, "pTexView must not be null");
+ DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "GenerateMips command must be used outside of render pass.");
#ifdef DILIGENT_DEVELOPMENT
{
const auto& ViewDesc = pTexView->GetDesc();
@@ -1471,9 +1471,9 @@ void DeviceContextBase<BaseInterface, ImplementationTraits>::ResolveTextureSubre
const ResolveTextureSubresourceAttribs& ResolveAttribs)
{
#ifdef DILIGENT_DEVELOPMENT
- VERIFY(m_pActiveRenderPass == nullptr, "ResolveTextureSubresource command must be used outside of render pass.");
+ DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "ResolveTextureSubresource command must be used outside of render pass.");
- VERIFY_EXPR(pSrcTexture != nullptr && pDstTexture != nullptr);
+ DEV_CHECK_ERR(pSrcTexture != nullptr && pDstTexture != nullptr, "Src and Dst textures must not be null");
const auto& SrcTexDesc = pSrcTexture->GetDesc();
const auto& DstTexDesc = pDstTexture->GetDesc();
@@ -1657,10 +1657,10 @@ bool DeviceContextBase<BaseInterface, ImplementationTraits>::TraceRays(const Tra
if (!VerifyTraceRaysAttribs(Attribs))
return false;
- if (m_pPipelineState.RawPtr() != Attribs.pSBT->GetDesc().pPSO)
+ if (!PipelineStateImplType::IsSameObject(m_pPipelineState, ValidatedCast<PipelineStateImplType>(Attribs.pSBT->GetDesc().pPSO)))
{
- LOG_ERROR_MESSAGE("IDeviceContext::TraceRays command arguments are invalid: currently bound pipeline ", m_pPipelineState->GetDesc().Name,
- "doesn't match the pipeline ", Attribs.pSBT->GetDesc().pPSO->GetDesc().Name, " that was used in ShaderBindingTable");
+ LOG_ERROR_MESSAGE("IDeviceContext::TraceRays command arguments are invalid: currently bound pipeline '", m_pPipelineState->GetDesc().Name,
+ "' doesn't match the pipeline '", Attribs.pSBT->GetDesc().pPSO->GetDesc().Name, "' that was used in ShaderBindingTable");
return false;
}
diff --git a/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp b/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp
index 59720c10..edad49c7 100644
--- a/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp
+++ b/Graphics/GraphicsEngine/include/DeviceObjectBase.hpp
@@ -153,7 +153,7 @@ public:
return m_UniqueID.GetID();
}
- static bool IsSameObject(DeviceObjectBase* pObj1, DeviceObjectBase* pObj2)
+ static bool IsSameObject(const DeviceObjectBase* pObj1, const DeviceObjectBase* pObj2)
{
UniqueIdentifier Id1 = (pObj1 != nullptr) ? pObj1->GetUniqueID() : 0;
UniqueIdentifier Id2 = (pObj2 != nullptr) ? pObj2->GetUniqueID() : 0;
diff --git a/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp b/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp
index 3d6e4fbc..11cdae7d 100644
--- a/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp
+++ b/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp
@@ -37,54 +37,56 @@ void ValidateBottomLevelASDesc(const BottomLevelASDesc& Desc) noexcept(false)
if (Desc.CompactedSize > 0)
{
if (Desc.pTriangles != nullptr || Desc.pBoxes != nullptr)
- LOG_BLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, pTriangles and pBoxes must both be null");
+ LOG_BLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, pTriangles and pBoxes must both be null.");
if (Desc.Flags != RAYTRACING_BUILD_AS_NONE)
- LOG_BLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, Flags must be RAYTRACING_BUILD_AS_NONE");
+ LOG_BLAS_ERROR_AND_THROW("If non-zero CompactedSize is specified, Flags must be RAYTRACING_BUILD_AS_NONE.");
}
else
{
- if (!((Desc.pBoxes != nullptr) ^ (Desc.pTriangles != nullptr)))
- LOG_BLAS_ERROR_AND_THROW("Exactly one of pTriangles and pBoxes must be defined");
+ if (!((Desc.BoxCount != 0) ^ (Desc.TriangleCount != 0)))
+ LOG_BLAS_ERROR_AND_THROW("Exactly one of BoxCount (", Desc.BoxCount, ") and TriangleCount (", Desc.TriangleCount, ") must be non-zero.");
if (Desc.pBoxes == nullptr && Desc.BoxCount > 0)
- LOG_BLAS_ERROR_AND_THROW("pBoxes is null, but BoxCount is not 0");
+ LOG_BLAS_ERROR_AND_THROW("BoxCount is ", Desc.BoxCount, ", but pBoxes is null.");
if (Desc.pTriangles == nullptr && Desc.TriangleCount > 0)
- LOG_BLAS_ERROR_AND_THROW("pTriangles is null, but TriangleCount is not 0");
+ LOG_BLAS_ERROR_AND_THROW("TriangleCount is ", Desc.TriangleCount, ", but pTriangles is null.");
if ((Desc.Flags & RAYTRACING_BUILD_AS_PREFER_FAST_TRACE) != 0 && (Desc.Flags & RAYTRACING_BUILD_AS_PREFER_FAST_BUILD) != 0)
- LOG_BLAS_ERROR_AND_THROW("RAYTRACING_BUILD_AS_PREFER_FAST_TRACE and RAYTRACING_BUILD_AS_PREFER_FAST_BUILD flags are mutually exclusive");
+ LOG_BLAS_ERROR_AND_THROW("RAYTRACING_BUILD_AS_PREFER_FAST_TRACE and RAYTRACING_BUILD_AS_PREFER_FAST_BUILD flags are mutually exclusive.");
for (Uint32 i = 0; i < Desc.TriangleCount; ++i)
{
const auto& tri = Desc.pTriangles[i];
if (tri.GeometryName == nullptr)
- LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].GeometryName must not be null");
+ LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].GeometryName must not be null.");
if (tri.VertexValueType != VT_FLOAT32 && tri.VertexValueType != VT_FLOAT16 && tri.VertexValueType != VT_INT16)
LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].VertexValueType (", GetValueTypeString(tri.VertexValueType),
- ") is invalid. Only the following values are allowed: VT_FLOAT32, VT_FLOAT16, VT_INT16");
+ ") is invalid. Only the following values are allowed: VT_FLOAT32, VT_FLOAT16, VT_INT16.");
if (tri.VertexComponentCount != 2 && tri.VertexComponentCount != 3)
- LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].VertexComponentCount (", tri.VertexComponentCount, ") is invalid. Only 2 or 3 are allowed.");
+ LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].VertexComponentCount (", Uint32{tri.VertexComponentCount}, ") is invalid. Only 2 or 3 are allowed.");
if (tri.MaxVertexCount == 0)
- LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxVertexCount must be greater than 0");
+ LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxVertexCount must be greater than 0.");
if (tri.MaxPrimitiveCount == 0)
- LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxPrimitiveCount must be greater than 0");
+ LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxPrimitiveCount must be greater than 0.");
if (tri.IndexType == VT_UNDEFINED)
{
if (tri.MaxVertexCount != tri.MaxPrimitiveCount * 3)
- LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxVertexCount must equal to (MaxPrimitiveCount * 3)");
+ LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxVertexCount (", tri.MaxVertexCount,
+ ") must be equal to MaxPrimitiveCount * 3 (", tri.MaxPrimitiveCount * 3, ").");
}
else
{
if (tri.IndexType != VT_UINT32 && tri.IndexType != VT_UINT16)
- LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].IndexType must be VT_UINT16 or VT_UINT32");
+ LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].IndexType (", GetValueTypeString(tri.VertexValueType),
+ ") must be VT_UINT16 or VT_UINT32.");
}
}
@@ -93,10 +95,10 @@ void ValidateBottomLevelASDesc(const BottomLevelASDesc& Desc) noexcept(false)
const auto& box = Desc.pBoxes[i];
if (box.GeometryName == nullptr)
- LOG_BLAS_ERROR_AND_THROW("pBoxes[", i, "].GeometryName must not be null");
+ LOG_BLAS_ERROR_AND_THROW("pBoxes[", i, "].GeometryName must not be null.");
if (box.MaxBoxCount == 0)
- LOG_BLAS_ERROR_AND_THROW("pBoxes[", i, "].MaxBoxCount must be greater than 0");
+ LOG_BLAS_ERROR_AND_THROW("pBoxes[", i, "].MaxBoxCount must be greater than 0.");
}
}
@@ -125,8 +127,8 @@ void CopyBLASGeometryDesc(const BottomLevelASDesc& SrcDesc,
{
const auto* SrcGeoName = SrcDesc.pTriangles[i].GeometryName;
pTriangles[i].GeometryName = MemPool.CopyString(SrcGeoName);
- Uint32 ActualIndex = INVALID_INDEX;
+ Uint32 ActualIndex = INVALID_INDEX;
if (pSrcNameToIndex)
{
auto iter = pSrcNameToIndex->find(SrcGeoName);
@@ -160,8 +162,8 @@ void CopyBLASGeometryDesc(const BottomLevelASDesc& SrcDesc,
{
const auto* SrcGeoName = SrcDesc.pBoxes[i].GeometryName;
pBoxes[i].GeometryName = MemPool.CopyString(SrcGeoName);
- Uint32 ActualIndex = INVALID_INDEX;
+ Uint32 ActualIndex = INVALID_INDEX;
if (pSrcNameToIndex)
{
auto iter = pSrcNameToIndex->find(SrcGeoName);
diff --git a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
index d9ab87ea..13ea9211 100644
--- a/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
+++ b/Graphics/GraphicsEngine/src/DefaultShaderSourceStreamFactory.cpp
@@ -26,6 +26,7 @@
*/
#include "DefaultShaderSourceStreamFactory.h"
+
#include "ObjectBase.hpp"
#include "RefCntAutoPtr.hpp"
#include "EngineMemory.h"