From 5888241b0f6127c82b64caebb9cb61b933ba4535 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 9 Nov 2020 21:24:46 -0800 Subject: A bunch of minor updates --- .../GraphicsEngine/include/BottomLevelASBase.hpp | 8 +-- .../include/ShaderBindingTableBase.hpp | 10 +-- Graphics/GraphicsEngine/include/TopLevelASBase.hpp | 2 +- Graphics/GraphicsEngine/interface/BottomLevelAS.h | 16 ++--- Graphics/GraphicsEngine/interface/DeviceContext.h | 34 +++++----- .../GraphicsEngine/interface/ShaderBindingTable.h | 78 +++++++++++----------- Graphics/GraphicsEngine/interface/TopLevelAS.h | 2 +- Graphics/GraphicsEngine/src/DeviceContextBase.cpp | 22 ++++-- 8 files changed, 90 insertions(+), 82 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp b/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp index 8f180004..4c09607b 100644 --- a/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp +++ b/Graphics/GraphicsEngine/include/BottomLevelASBase.hpp @@ -105,8 +105,8 @@ public: IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BottomLevelAS, TDeviceObjectBase) - // Map geometry that used in build operation to geometry description. - // Returns geometry index in geometry description. + // Maps geometry that was used in build operation to 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'); @@ -143,7 +143,7 @@ public: auto iter = m_NameToIndex.find(Name); if (iter != m_NameToIndex.end()) { - VERIFY(iter->second.ActualIndex != INVALID_INDEX, "Geometry exists but not enabled during last build"); + VERIFY(iter->second.ActualIndex != INVALID_INDEX, "Geometry with name '", Name, "', exists but was not enabled during last build"); return iter->second.ActualIndex; } LOG_ERROR_MESSAGE("Can't find geometry with name '", Name, '\''); @@ -232,7 +232,7 @@ private: this->m_pRawPtr = nullptr; } - // keep Name, Flags, CompactedSize, CommandQueueMask + // Keep Name, Flags, CompactedSize, CommandQueueMask this->m_Desc.pTriangles = nullptr; this->m_Desc.TriangleCount = 0; this->m_Desc.pBoxes = nullptr; diff --git a/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp b/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp index 41983aa8..d21d0094 100644 --- a/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp +++ b/Graphics/GraphicsEngine/include/ShaderBindingTableBase.hpp @@ -171,15 +171,15 @@ public: VERIFY_EXPR((pData == nullptr) || (DataSize == this->m_ShaderRecordSize)); VERIFY_EXPR(pTLAS != nullptr); - auto* pTLASImpl = ValidatedCast(pTLAS); - const auto Desc = pTLASImpl->GetInstanceDesc(pInstanceName); + auto* const pTLASImpl = ValidatedCast(pTLAS); + const auto& Desc = pTLASImpl->GetInstanceDesc(pInstanceName); VERIFY_EXPR(pTLASImpl->GetBindingMode() == SHADER_BINDING_MODE_PER_GEOMETRY); VERIFY_EXPR(RayOffsetInHitGroupIndex < pTLASImpl->GetHitShadersPerInstance()); VERIFY_EXPR(Desc.ContributionToHitGroupIndex != INVALID_INDEX); if (Desc.pBLAS == nullptr) - return; // this is disabled instance + return; // this is a disabled instance const Uint32 InstanceIndex = Desc.ContributionToHitGroupIndex; const Uint32 GeometryIndex = Desc.pBLAS->GetGeometryIndex(pGeometryName); @@ -212,8 +212,8 @@ public: VERIFY_EXPR((pData == nullptr) == (DataSize == 0)); VERIFY_EXPR(pTLAS != nullptr); - auto* pTLASImpl = ValidatedCast(pTLAS); - const auto Desc = pTLASImpl->GetInstanceDesc(pInstanceName); + auto* const pTLASImpl = ValidatedCast(pTLAS); + const auto& Desc = pTLASImpl->GetInstanceDesc(pInstanceName); VERIFY_EXPR(pTLASImpl->GetBindingMode() == SHADER_BINDING_MODE_PER_GEOMETRY || pTLASImpl->GetBindingMode() == SHADER_BINDING_MODE_PER_INSTANCE); diff --git a/Graphics/GraphicsEngine/include/TopLevelASBase.hpp b/Graphics/GraphicsEngine/include/TopLevelASBase.hpp index bfc89dd2..92182b60 100644 --- a/Graphics/GraphicsEngine/include/TopLevelASBase.hpp +++ b/Graphics/GraphicsEngine/include/TopLevelASBase.hpp @@ -169,7 +169,7 @@ public: if (Iter == this->m_Instances.end()) { - UNEXPECTED("Failed to find instance with name '", Inst.InstanceName, "' in instances from previous build"); + UNEXPECTED("Failed to find instance with name '", Inst.InstanceName, "' in instances from the previous build"); return false; } diff --git a/Graphics/GraphicsEngine/interface/BottomLevelAS.h b/Graphics/GraphicsEngine/interface/BottomLevelAS.h index 4aafefb9..00c759e4 100644 --- a/Graphics/GraphicsEngine/interface/BottomLevelAS.h +++ b/Graphics/GraphicsEngine/interface/BottomLevelAS.h @@ -114,10 +114,10 @@ typedef struct BLASBoundingBoxDesc BLASBoundingBoxDesc; DILIGENT_TYPED_ENUM(RAYTRACING_BUILD_AS_FLAGS, Uint8) { RAYTRACING_BUILD_AS_NONE = 0, - + /// Indicates that the specified acceleration structure can be updated /// via IDeviceContext::BuildBLAS() or IDeviceContext::BuildTLAS(). - /// With this flag acculeration structure may allocate more memory and take more time on build. + /// With this flag, the acceleration structure may allocate more memory and take more time to build. RAYTRACING_BUILD_AS_ALLOW_UPDATE = 0x01, /// Indicates that the specified acceleration structure can act as the source for @@ -178,13 +178,13 @@ struct ScratchBufferSizes { /// Scratch buffer size for acceleration structure building, /// see IDeviceContext::BuildBLAS(), IDeviceContext::BuildTLAS(). - /// May be zero if acceleration structure created with non-zero CompactedSize. + /// May be zero if the structure was created with non-zero CompactedSize. Uint32 Build DEFAULT_INITIALIZER(0); /// Scratch buffer size for acceleration structure updating, /// see IDeviceContext::BuildBLAS(), IDeviceContext::BuildTLAS(). - /// May be zero if acceleration structure created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag. - /// May be zero if acceleration structure created with non-zero CompactedSize. + /// May be zero if acceleration structure was created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag. + /// May be zero if acceleration structure was created with non-zero CompactedSize. Uint32 Update DEFAULT_INITIALIZER(0); #if DILIGENT_CPP_INTERFACE @@ -212,14 +212,14 @@ DILIGENT_BEGIN_INTERFACE(IBottomLevelAS, IDeviceObject) #endif /// Returns the geometry description index in BottomLevelASDesc::pTriangles or BottomLevelASDesc::pBoxes. - + /// \param [in] Name - Geometry name that is specified in BLASTriangleDesc or BLASBoundingBoxDesc. /// \return Geometry index or INVALID_INDEX if geometry does not exist. /// /// \note Access to the BLAS must be externally synchronized. VIRTUAL Uint32 METHOD(GetGeometryDescIndex)(THIS_ const char* Name) CONST PURE; - + /// Returns the geometry index that can be used in a shader binding table. @@ -233,7 +233,7 @@ DILIGENT_BEGIN_INTERFACE(IBottomLevelAS, IDeviceObject) /// Returns the geometry count that was used to build AS. /// Same as BuildBLASAttribs::TriangleDataCount or BuildBLASAttribs::BoxDataCount. - + /// \return The number of geometries that was used to build AS. /// /// \note Access to the BLAS must be externally synchronized. diff --git a/Graphics/GraphicsEngine/interface/DeviceContext.h b/Graphics/GraphicsEngine/interface/DeviceContext.h index 83b67e70..b8d95244 100644 --- a/Graphics/GraphicsEngine/interface/DeviceContext.h +++ b/Graphics/GraphicsEngine/interface/DeviceContext.h @@ -884,25 +884,25 @@ struct BuildBLASAttribs /// Target bottom-level AS. /// Access to the BLAS must be externally synchronized. IBottomLevelAS* pBLAS DEFAULT_INITIALIZER(nullptr); - + /// Bottom-level AS state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE). RESOURCE_STATE_TRANSITION_MODE BLASTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE); - + /// Geometry data source buffers state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE). RESOURCE_STATE_TRANSITION_MODE GeometryTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE); /// A pointer to an array of TriangleDataCount BLASBuildTriangleData structures that contains triangle geometry data. /// If Update is true: /// - Only vertex positions (in pVertexBuffer) and transformation (in pTransformBuffer) can be changed. - /// - All other content in BLASBuildTriangleData and buffers must be same as used to build BLAS. - /// - To disable geometry make all triangles inactive, see BLASBuildTriangleData::pVertexBuffer description. + /// - All other content in BLASBuildTriangleData and buffers must be the same as what was used to build BLAS. + /// - To disable geometry, make all triangles inactive, see BLASBuildTriangleData::pVertexBuffer description. BLASBuildTriangleData const* pTriangleData DEFAULT_INITIALIZER(nullptr); - + /// The number of triangle grometries. /// Must be less than or equal to BottomLevelASDesc::TriangleCount. - /// If Update is true then count must be the same as used to build BLAS. + /// If Update is true then the count must be the same as the one used to build BLAS. Uint32 TriangleDataCount DEFAULT_INITIALIZER(0); - + /// A pointer to an array of BoxDataCount BLASBuildBoundingBoxData structures that contain AABB geometry data. /// If Update is true: /// - AABB coordinates (in pBoxBuffer) can be changed. @@ -912,7 +912,7 @@ struct BuildBLASAttribs /// The number of AABB geometries. /// Must be less than or equal to BottomLevelASDesc::BoxCount. - /// If Update is true then count must be the same as used to build BLAS. + /// If Update is true then the count must be the same as the one used to build BLAS. Uint32 BoxDataCount DEFAULT_INITIALIZER(0); /// The buffer that is used for acceleration structure building. @@ -1019,7 +1019,7 @@ struct TLASBuildInstanceData Uint8 Mask DEFAULT_INITIALIZER(0xFF); /// The index used to calculate the hit group location in the shader binding table. - /// Must be TLAS_INSTANCE_OFFSET_AUTO if BuildTLASAttribs::BindingMode that is not a SHADER_BINDING_USER_DEFINED. + /// Must be TLAS_INSTANCE_OFFSET_AUTO if BuildTLASAttribs::BindingMode is not SHADER_BINDING_USER_DEFINED. /// Only the lower 24 bits are used. Uint32 ContributionToHitGroupIndex DEFAULT_INITIALIZER(TLAS_INSTANCE_OFFSET_AUTO); @@ -1045,7 +1045,7 @@ DILIGENT_TYPED_ENUM(SHADER_BINDING_MODE, Uint8) /// Each instance can have a unique hit shader. In this mode SBT buffer will use less memory. /// See IShaderBindingTable::BindHitGroups(). SHADER_BINDING_MODE_PER_INSTANCE, - + /// Single hit shader for top-level acceleration structure. /// See IShaderBindingTable::BindHitGroupForAll(). SHADER_BINDING_MODE_PER_ACCEL_STRUCT, @@ -1073,7 +1073,7 @@ struct BuildTLASAttribs /// A pointer to an array of InstanceCount TLASBuildInstanceData structures that contain instance data. /// If Update is true: /// - Any instance data can be changed. - /// - To disable instance set pBLAS to null. + /// - To disable an instance, set pBLAS to null. TLASBuildInstanceData const* pInstances DEFAULT_INITIALIZER(nullptr); /// The number of instances. @@ -1092,17 +1092,17 @@ struct BuildTLASAttribs /// Instance buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE). RESOURCE_STATE_TRANSITION_MODE InstanceBufferTransitionMode DEFAULT_INITIALIZER(RESOURCE_STATE_TRANSITION_MODE_NONE); - /// The number of hit shaders that can be binded for single geometry or instance (depend on BindingMode). - /// Used to calculate TLASBuildInstanceData::ContributionToHitGroupIndex. - /// Ignored if BindingMode is SHADER_BINDING_USER_DEFINED. - /// You should use the same value in shader: + /// The number of hit shaders that can be bound for a single geometry or an instance (depends on BindingMode). + /// - Used to calculate TLASBuildInstanceData::ContributionToHitGroupIndex. + /// - Ignored if BindingMode is SHADER_BINDING_USER_DEFINED. + /// You should use the same value in a shader: /// 'MultiplierForGeometryContributionToHitGroupIndex' argument in TraceRay() in HLSL, 'sbtRecordStride' argument in traceRay() in GLSL. Uint32 HitShadersPerInstance DEFAULT_INITIALIZER(1); /// Base offset for hit group location. /// Can be used to bind hit shaders for multiple acceleration structures, see IShaderBindingTable::BindHitGroup(). - /// Used to calculate TLASBuildInstanceData::ContributionToHitGroupIndex. - /// Ignored if BindingMode is SHADER_BINDING_USER_DEFINED. + /// - Used to calculate TLASBuildInstanceData::ContributionToHitGroupIndex. + /// - Ignored if BindingMode is SHADER_BINDING_USER_DEFINED. Uint32 BaseContributionToHitGroupIndex DEFAULT_INITIALIZER(0); /// Hit shader binding mode, see Diligent::SHADER_BINDING_MODE. diff --git a/Graphics/GraphicsEngine/interface/ShaderBindingTable.h b/Graphics/GraphicsEngine/interface/ShaderBindingTable.h index 56455989..6ec8e210 100644 --- a/Graphics/GraphicsEngine/interface/ShaderBindingTable.h +++ b/Graphics/GraphicsEngine/interface/ShaderBindingTable.h @@ -62,12 +62,12 @@ typedef struct ShaderBindingTableDesc ShaderBindingTableDesc; /// Defines shader binding table validation flags, see IShaderBindingTable::Verify(). DILIGENT_TYPED_ENUM(SHADER_BINDING_VALIDATION_FLAGS, Uint8) { - /// Checks that all shaders are binded or inactive. + /// Checks that all shaders are bound or inactive. SHADER_BINDING_VALIDATION_SHADER_ONLY = 0x1, /// AZ TODO SHADER_BINDING_VALIDATION_SHADER_RECORD = 0x2, - + /// AZ TODO SHADER_BINDING_VALIDATION_TLAS = 0x4, @@ -127,25 +127,25 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) virtual const ShaderBindingTableDesc& DILIGENT_CALL_TYPE GetDesc() const override = 0; #endif - /// Check that all shaders are binded, instances and geometries are not changed, shader record data are initialized. + /// Check that all shaders are bound, instances and geometries are not changed, shader record data are initialized. - /// \param [in] Flags - Flags that used for validation. - /// \return True if SBT content are valid. + /// \param [in] Flags - Flags used for validation. + /// \return True if SBT content is valid. /// /// \note Access to the SBT must be externally synchronized. VIRTUAL Bool METHOD(Verify)(THIS_ SHADER_BINDING_VALIDATION_FLAGS Flags) CONST PURE; - /// Reset SBT with new pipeline state. This is more effectively than creating new SBT. + /// Reset SBT with the new pipeline state. This is more effecient than creating a new SBT. /// \note Access to the SBT must be externally synchronized. VIRTUAL void METHOD(Reset)(THIS_ IPipelineState* pPSO) PURE; - /// When TLAS or BLAS was rebuilded or updated, hit group shader bindings may become invalid, - /// you can reset only hit groups and keep ray-gen, miss and callable shader bindings. + /// When TLAS or BLAS was rebuilt or updated, hit group shader bindings may have become invalid, + /// you can reset only hit groups and keep ray-gen, miss and callable shader bindings intact. /// \note Access to the SBT must be externally synchronized. VIRTUAL void METHOD(ResetHitGroups)(THIS) PURE; @@ -153,9 +153,9 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) /// Bind ray-generation shader. - /// \param [in] pShaderGroupName - ray-generation shader name that specified in RayTracingGeneralShaderGroup::Name. - /// \param [in] pData - shader record data, can be null. - /// \param [in] DataSize - shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. + /// \param [in] pShaderGroupName - Ray-generation shader name that was specified in RayTracingGeneralShaderGroup::Name. + /// \param [in] pData - Shader record data, can be null. + /// \param [in] DataSize - Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize. /// /// \note Access to the SBT must be externally synchronized. VIRTUAL void METHOD(BindRayGenShader)(THIS_ @@ -166,12 +166,12 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) /// Bind ray-miss shader. - /// \param [in] pShaderGroupName - ray-miss shader name that specified in RayTracingGeneralShaderGroup::Name, + /// \param [in] pShaderGroupName - Ray-miss shader name that was specified in RayTracingGeneralShaderGroup::Name, /// can be null to make shader inactive. - /// \param [in] MissIndex - miss shader offset in shader binding table, use the same value as in shader: + /// \param [in] MissIndex - Miss shader offset in shader binding table, use the same value as in the shader: /// 'MissShaderIndex' argument in TraceRay() in HLSL, 'missIndex' in traceRay() in GLSL. - /// \param [in] pData - shader record data, can be null. - /// \param [in] DataSize - shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. + /// \param [in] pData - Shader record data, can be null. + /// \param [in] DataSize - Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize. /// /// \note Access to the SBT must be externally synchronized. VIRTUAL void METHOD(BindMissShader)(THIS_ @@ -181,18 +181,18 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) Uint32 DataSize DEFAULT_INITIALIZER(0)) PURE; - /// Bind hit group for specified geometry in instance. + /// Bind hit group for the specified geometry in instance. - /// \param [in] pTLAS - top-level AS, used to calculate offset for instance. - /// \param [in] pInstanceName - instance name, see TLASBuildInstanceData::InstanceName. - /// \param [in] pGeometryName - geometry name, see BLASBuildTriangleData::GeometryName and BLASBuildBoundingBoxData::GeometryName. - /// \param [in] RayOffsetInHitGroupIndex - ray offset in shader binding table, use the same value as in shader: + /// \param [in] pTLAS - Top-level AS, used to calculate offset for instance. + /// \param [in] pInstanceName - Instance name, see TLASBuildInstanceData::InstanceName. + /// \param [in] pGeometryName - Geometry name, see BLASBuildTriangleData::GeometryName and BLASBuildBoundingBoxData::GeometryName. + /// \param [in] RayOffsetInHitGroupIndex - Ray offset in shader binding table, use the same value as in the shader: /// 'RayContributionToHitGroupIndex' argument in TraceRay() in HLSL, 'sbtRecordOffset' argument in traceRay() in GLSL. /// Must be less than HitShadersPerInstance. - /// \param [in] pShaderGroupName - hit group name that specified in RayTracingTriangleHitShaderGroup::Name and RayTracingProceduralHitShaderGroup::Name, - /// can be null to make shader inactive. - /// \param [in] pData - shader record data, can be null. - /// \param [in] DataSize - shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. + /// \param [in] pShaderGroupName - Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name and RayTracingProceduralHitShaderGroup::Name, + /// can be null to make the shader inactive. + /// \param [in] pData - Shader record data, can be null. + /// \param [in] DataSize - Shader record data size, should be equal to RayTracingPipelineDesc::ShaderRecordSize. /// /// \note Access to the SBT must be externally synchronized. /// Access to the TLAS must be externally synchronized. @@ -209,15 +209,15 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) /// Bind hit group for each geometries in specified instance. - /// \param [in] pTLAS - top-level AS, used to calculate offset for instance. - /// \param [in] pInstanceName - instance name, see TLASBuildInstanceData::InstanceName. - /// \param [in] RayOffsetInHitGroupIndex - ray offset in shader binding table, use the same value as in shader: + /// \param [in] pTLAS - Top-level AS, used to calculate offset for instance. + /// \param [in] pInstanceName - Instance name, see TLASBuildInstanceData::InstanceName. + /// \param [in] RayOffsetInHitGroupIndex - Ray offset in shader binding table, use the same value as in the shader: /// 'RayContributionToHitGroupIndex' argument in TraceRay() in HLSL, 'sbtRecordOffset' argument in traceRay() in GLSL. /// Must be less than HitShadersPerInstance. - /// \param [in] pShaderGroupName - hit group name that specified in RayTracingTriangleHitShaderGroup::Name and RayTracingProceduralHitShaderGroup::Name, + /// \param [in] pShaderGroupName - Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name and RayTracingProceduralHitShaderGroup::Name, /// can be null to make shader inactive. - /// \param [in] pData - shader record data, can be null. - /// \param [in] DataSize - shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. + /// \param [in] pData - Shader record data, can be null. + /// \param [in] DataSize - Shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. /// /// \note Access to the SBT must be externally synchronized. /// Access to the TLAS must be externally synchronized. @@ -232,14 +232,14 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) /// Bind hit group for each instances in top-level AS. - /// \param [in] pTLAS - top-level AS, used to calculate offset for instance. - /// \param [in] RayOffsetInHitGroupIndex - ray offset in shader binding table, use the same value as in shader: + /// \param [in] pTLAS - Top-level AS, used to calculate offset for instance. + /// \param [in] RayOffsetInHitGroupIndex - Ray offset in shader binding table, use the same value as in the shader: /// 'RayContributionToHitGroupIndex' argument in TraceRay() in HLSL, 'sbtRecordOffset' argument in traceRay() in GLSL. /// Must be less than HitShadersPerInstance. - /// \param [in] pShaderGroupName - hit group name that specified in RayTracingTriangleHitShaderGroup::Name and RayTracingProceduralHitShaderGroup::Name, + /// \param [in] pShaderGroupName - Hit group name that was specified in RayTracingTriangleHitShaderGroup::Name and RayTracingProceduralHitShaderGroup::Name, /// can be null to make shader inactive. - /// \param [in] pData - shader record data, can be null. - /// \param [in] DataSize - shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. + /// \param [in] pData - Shader record data, can be null. + /// \param [in] DataSize - Shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. /// /// \note Access to the SBT must be externally synchronized. /// Access to the TLAS must be externally synchronized. @@ -253,12 +253,12 @@ DILIGENT_BEGIN_INTERFACE(IShaderBindingTable, IDeviceObject) /// Bind callable shader. - /// \param [in] pShaderGroupName - callable shader name that specified in RayTracingGeneralShaderGroup::Name, + /// \param [in] pShaderGroupName - Callable shader name that specified in RayTracingGeneralShaderGroup::Name, /// can be null to make shader inactive. - /// \param [in] CallableIndex - callable shader offset in shader binding table, use the same value as in shader: + /// \param [in] CallableIndex - Callable shader offset in shader binding table, use the same value as in the shader: /// 'ShaderIndex' argument in CallShader() in HLSL, 'callable' argument in executeCallable() in GLSL. - /// \param [in] pData - shader record data, can be null. - /// \param [in] DataSize - shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. + /// \param [in] pData - Shader record data, can be null. + /// \param [in] DataSize - Shader record data size, should equal to RayTracingPipelineDesc::ShaderRecordSize. /// /// \note Access to the SBT must be externally synchronized. VIRTUAL void METHOD(BindCallableShader)(THIS_ diff --git a/Graphics/GraphicsEngine/interface/TopLevelAS.h b/Graphics/GraphicsEngine/interface/TopLevelAS.h index 6eaee93b..802c2777 100644 --- a/Graphics/GraphicsEngine/interface/TopLevelAS.h +++ b/Graphics/GraphicsEngine/interface/TopLevelAS.h @@ -110,7 +110,7 @@ DILIGENT_BEGIN_INTERFACE(ITopLevelAS, IDeviceObject) /// \param [in] Name - Instance name that is specified in TLASBuildInstanceData::InstanceName. /// \return TLASInstanceDesc object, see Diligent::TLASInstanceDesc. /// If instance does not exist then TLASInstanceDesc::ContributionToHitGroupIndex - /// and TLASInstanceDesc::InstanceIndex set to INVALID_INDEX. + /// and TLASInstanceDesc::InstanceIndex are set to INVALID_INDEX. /// /// \note Access to the TLAS must be externally synchronized. VIRTUAL TLASInstanceDesc METHOD(GetInstanceDesc)(THIS_ diff --git a/Graphics/GraphicsEngine/src/DeviceContextBase.cpp b/Graphics/GraphicsEngine/src/DeviceContextBase.cpp index beb02e00..c1ae6cf7 100644 --- a/Graphics/GraphicsEngine/src/DeviceContextBase.cpp +++ b/Graphics/GraphicsEngine/src/DeviceContextBase.cpp @@ -352,13 +352,13 @@ bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs) if (Attribs.Update) { CHECK_BUILD_BLAS_ATTRIBS((BLASDesc.Flags & RAYTRACING_BUILD_AS_ALLOW_UPDATE) == RAYTRACING_BUILD_AS_ALLOW_UPDATE, - "Update is true, but BLAS 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 does not match with a 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 does not match with a 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) @@ -465,11 +465,15 @@ bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs) "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"); + } 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"); + } CHECK_BUILD_BLAS_ATTRIBS((ScratchDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, "pScratchBuffer was not created with BIND_RAY_TRACING flag"); @@ -490,7 +494,7 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs, Uint32 PrevInstance CHECK_BUILD_TLAS_ATTRIBS(Attribs.pInstanceBuffer != nullptr, "pInstanceBuffer must not be null"); CHECK_BUILD_TLAS_ATTRIBS(Attribs.BindingMode == SHADER_BINDING_USER_DEFINED || Attribs.HitShadersPerInstance != 0, - "HitShadersPerInstance must be greater than 0 if BindingMode is not SHADER_BINDING_USER_DEFINED"); + "HitShadersPerInstance must be greater than 0, if BindingMode is not SHADER_BINDING_USER_DEFINED"); const auto& TLASDesc = Attribs.pTLAS->GetDesc(); @@ -501,9 +505,9 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs, Uint32 PrevInstance 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 was created without RAYTRACING_BUILD_AS_ALLOW_UPDATE flag"); 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(); @@ -562,11 +566,15 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs, Uint32 PrevInstance "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"); + } 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"); + } CHECK_BUILD_TLAS_ATTRIBS((ScratchDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING, "pScratchBuffer was not created with BIND_RAY_TRACING flag"); @@ -752,7 +760,7 @@ bool VerifyTraceRaysAttribs(const TraceRaysAttribs& Attribs) #ifdef DILIGENT_DEVELOPMENT CHECK_TRACE_RAYS_ATTRIBS(Attribs.pSBT->Verify(SHADER_BINDING_VALIDATION_SHADER_ONLY | SHADER_BINDING_VALIDATION_TLAS), - "pSBT not all shaders are binded or instance to shader mapping are 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."); -- cgit v1.2.3