Skip to content

Commit 5afffa1

Browse files
Updated documentation for Buffer, BufferView, BLAS, Dearchiver and BlendState
1 parent 78d36ed commit 5afffa1

File tree

9 files changed

+102
-94
lines changed

9 files changed

+102
-94
lines changed

Graphics/GraphicsEngine/include/DearchiverBase.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -255,8 +255,8 @@ RefCntAutoPtr<IPipelineResourceSignature> DearchiverBase::UnpackResourceSignatur
255255

256256
PRS.Desc.SRBAllocationGranularity = DeArchiveInfo.SRBAllocationGranularity;
257257

258-
const auto DevType = GetArchiveDeviceType(DeArchiveInfo.pDevice);
259-
const auto& Data = pObjArchive->GetDeviceSpecificData(PRSData::ArchiveResType, DeArchiveInfo.Name, DevType);
258+
const DeviceType DevType = GetArchiveDeviceType(DeArchiveInfo.pDevice);
259+
const SerializedData& Data = pObjArchive->GetDeviceSpecificData(PRSData::ArchiveResType, DeArchiveInfo.Name, DevType);
260260
if (!Data)
261261
return {};
262262

@@ -272,7 +272,7 @@ RefCntAutoPtr<IPipelineResourceSignature> DearchiverBase::UnpackResourceSignatur
272272
if (SpecialDesc)
273273
{
274274
// The signature uses a special description that differs from the common
275-
const auto* Name = PRS.Desc.Name;
275+
const Char* Name = PRS.Desc.Name;
276276
PRS.Desc = {};
277277
if (!PRS.Deserialize(Name, Ser))
278278
{
@@ -289,7 +289,7 @@ RefCntAutoPtr<IPipelineResourceSignature> DearchiverBase::UnpackResourceSignatur
289289
}
290290
VERIFY_EXPR(Ser.IsEnded());
291291

292-
auto* pRenderDevice = ClassPtrCast<RenderDeviceImplType>(DeArchiveInfo.pDevice);
292+
RenderDeviceImplType* pRenderDevice = ClassPtrCast<RenderDeviceImplType>(DeArchiveInfo.pDevice);
293293
pRenderDevice->CreatePipelineResourceSignature(PRS.Desc, InternalData, &pSignature);
294294

295295
if (!IsImplicit)

Graphics/GraphicsEngine/interface/BlendState.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -413,12 +413,13 @@ struct BlendStateDesc
413413

414414
/// \param [in] RHS - reference to the structure to perform comparison with
415415
/// \return
416-
/// - True if all members are of the two structures equal.
417-
/// \note The operator performs *bitwise comparison* of the two structures.
418-
/// That is if for instance both structures have IndependentBlendEnable set to False,
419-
/// but differ in render target other than 0, the operator will return False
420-
/// even though the two blend states created from these structures will be identical.
421-
/// - False otherwise
416+
/// - `True` if all members are of the two structures equal.
417+
/// - `False` otherwise.
418+
///
419+
/// \note The operator performs *bitwise comparison* of the two structures.
420+
/// That is if for instance both structures have IndependentBlendEnable set to False,
421+
/// but differ in render target other than 0, the operator will return False
422+
/// even though the two blend states created from these structures will be identical.
422423
constexpr bool operator==(const BlendStateDesc& RHS) const
423424
{
424425
bool bRTsEqual = true;

Graphics/GraphicsEngine/interface/BottomLevelAS.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -54,29 +54,33 @@ static DILIGENT_CONSTEXPR Uint32 INVALID_INDEX = DILIGENT_INVALID_INDEX;
5454
struct BLASTriangleDesc
5555
{
5656
/// Geometry name.
57+
5758
/// The name is used to map triangle data (BLASBuildTriangleData) to this geometry.
5859
const Char* GeometryName DEFAULT_INITIALIZER(nullptr);
5960

6061
/// The maximum vertex count in this geometry.
62+
6163
/// Current number of vertices is defined in BLASBuildTriangleData::VertexCount.
6264
Uint32 MaxVertexCount DEFAULT_INITIALIZER(0);
6365

6466
/// The type of vertices in this geometry, see Diligent::VALUE_TYPE.
65-
///
67+
6668
/// \remarks Only the following values are allowed: VT_FLOAT32, VT_FLOAT16, VT_INT16.
6769
/// VT_INT16 defines 16-bit signed normalized vertex components.
6870
VALUE_TYPE VertexValueType DEFAULT_INITIALIZER(VT_UNDEFINED);
6971

7072
/// The number of components in the vertex.
71-
///
73+
7274
/// \remarks Only 2 or 3 are allowed values. For 2-component formats, the third component is assumed 0.
7375
Uint8 VertexComponentCount DEFAULT_INITIALIZER(0);
7476

7577
/// The maximum primitive count in this geometry.
78+
7679
/// The current number of primitives is defined in BLASBuildTriangleData::PrimitiveCount.
7780
Uint32 MaxPrimitiveCount DEFAULT_INITIALIZER(0);
7881

7982
/// Index type of this geometry, see Diligent::VALUE_TYPE.
83+
8084
/// Must be VT_UINT16, VT_UINT32 or VT_UNDEFINED.
8185
/// If not defined then vertex array is used instead of indexed vertices.
8286
VALUE_TYPE IndexType DEFAULT_INITIALIZER(VT_UNDEFINED);
@@ -208,8 +212,8 @@ struct BottomLevelASDesc DILIGENT_DERIVE(DeviceObjectAttribs)
208212

209213
/// \param [in] RHS - reference to the structure to compare with.
210214
///
211-
/// \return true if all members of the two structures *except for the Name* are equal,
212-
/// and false otherwise.
215+
/// \return `true` if all members of the two structures *except for the Name* are equal,
216+
/// and `false` otherwise.
213217
///
214218
/// \note The operator ignores the Name field as it is used for debug purposes and
215219
/// doesn't affect the BLAS properties.

Graphics/GraphicsEngine/interface/Buffer.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -73,7 +73,8 @@ DILIGENT_TYPED_ENUM(BUFFER_MODE, Uint8)
7373
/// Miscellaneous buffer flags.
7474
DILIGENT_TYPED_ENUM(MISC_BUFFER_FLAGS, Uint8)
7575
{
76-
MISC_BUFFER_FLAG_NONE = 0,
76+
/// No special flags are set.
77+
MISC_BUFFER_FLAG_NONE = 0,
7778

7879
/// For a sparse buffer, allow binding the same memory region in different buffer ranges
7980
/// or in different sparse buffers.
@@ -99,8 +100,7 @@ struct BufferDesc DILIGENT_DERIVE(DeviceObjectAttribs)
99100
/// Buffer usage, see Diligent::USAGE for details
100101
USAGE Usage DEFAULT_INITIALIZER(USAGE_DEFAULT);
101102

102-
/// CPU access flags or 0 if no CPU access is allowed,
103-
/// see Diligent::CPU_ACCESS_FLAGS for details.
103+
/// CPU access flags or 0 if no CPU access is allowed, see Diligent::CPU_ACCESS_FLAGS for details.
104104
CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER(CPU_ACCESS_NONE);
105105

106106
/// Buffer mode, see Diligent::BUFFER_MODE
@@ -221,7 +221,7 @@ struct SparseBufferProperties
221221
Uint64 AddressSpaceSize DEFAULT_INITIALIZER(0);
222222

223223
/// The size of the sparse memory block.
224-
///
224+
225225
/// \note Offset in the buffer, memory offset and memory size that are used in sparse resource
226226
/// binding command, must be multiples of the block size.
227227
/// In Direct3D11 and Direct3D12, the block size is always 64Kb.
@@ -320,8 +320,8 @@ DILIGENT_BEGIN_INTERFACE(IBuffer, IDeviceObject)
320320
///
321321
/// \note This method must never be used for USAGE_DYNAMIC buffers.
322322
///
323-
/// When a mapped buffer is unmapped it is automatically flushed by
324-
/// the engine if necessary.
323+
/// When a mapped buffer is unmapped it is automatically flushed by
324+
/// the engine if necessary.
325325
VIRTUAL void METHOD(FlushMappedRange)(THIS_
326326
Uint64 StartOffset,
327327
Uint64 Size) PURE;
@@ -341,8 +341,8 @@ DILIGENT_BEGIN_INTERFACE(IBuffer, IDeviceObject)
341341
///
342342
/// \note This method must never be used for USAGE_DYNAMIC buffers.
343343
///
344-
/// When a mapped buffer is unmapped it is automatically invalidated by
345-
/// the engine if necessary.
344+
/// When a mapped buffer is unmapped, it is automatically invalidated by
345+
/// the engine if necessary.
346346
VIRTUAL void METHOD(InvalidateMappedRange)(THIS_
347347
Uint64 StartOffset,
348348
Uint64 Size) PURE;

Graphics/GraphicsEngine/interface/BufferView.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -47,6 +47,7 @@ struct BufferFormat
4747
VALUE_TYPE ValueType DEFAULT_INITIALIZER(VT_UNDEFINED);
4848

4949
/// Number of components. Allowed values: 1, 2, 3, 4.
50+
5051
/// For a formatted buffer, this value cannot be 0
5152
Uint8 NumComponents DEFAULT_INITIALIZER(0);
5253

@@ -96,10 +97,10 @@ struct BufferViewDesc DILIGENT_DERIVE(DeviceObjectAttribs)
9697
struct BufferFormat Format;
9798

9899
/// Offset in bytes from the beginning of the buffer to the start of the
99-
/// buffer region referenced by the view
100+
/// buffer region referenced by the view.
100101
Uint64 ByteOffset DEFAULT_INITIALIZER(0);
101102

102-
/// Size in bytes of the referenced buffer region
103+
/// Size in bytes of the referenced buffer region.
103104
Uint64 ByteWidth DEFAULT_INITIALIZER(0);
104105

105106

@@ -164,7 +165,7 @@ DILIGENT_BEGIN_INTERFACE(IBufferView, IDeviceObject)
164165
/// Returns pointer to the referenced buffer object.
165166

166167
/// The method does *NOT* increment the reference counter of the returned object,
167-
/// so Release() must not be called.
168+
/// so Release() **must not** be called.
168169
VIRTUAL struct IBuffer* METHOD(GetBuffer)(THIS) CONST PURE;
169170
};
170171
DILIGENT_END_INTERFACE

Graphics/GraphicsEngine/interface/Dearchiver.h

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2023 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -77,6 +77,7 @@ typedef struct ResourceSignatureUnpackInfo ResourceSignatureUnpackInfo;
7777
/// Pipeline state archive flags
7878
DILIGENT_TYPED_ENUM(PSO_ARCHIVE_FLAGS, Uint32)
7979
{
80+
/// No flags are set
8081
PSO_ARCHIVE_FLAG_NONE = 0u,
8182

8283
/// By default, shader reflection information will be preserved
@@ -101,6 +102,7 @@ DEFINE_FLAG_ENUM_OPERATORS(PSO_ARCHIVE_FLAGS)
101102
/// Pipeline state unpack flags
102103
DILIGENT_TYPED_ENUM(PSO_UNPACK_FLAGS, Uint32)
103104
{
105+
/// No flags are set
104106
PSO_UNPACK_FLAG_NONE = 0u,
105107

106108
/// Do not perform validation when unpacking the pipeline state.
@@ -149,26 +151,25 @@ struct PipelineStateUnpackInfo
149151
/// Optional PSO cache.
150152
IPipelineStateCache* pCache DEFAULT_INITIALIZER(nullptr);
151153

152-
/// An optional function to be called by the dearchiver to let the application modify
153-
/// the pipeline state create info.
154-
///
155-
/// \remarks An application should check the pipeline type (PipelineCI.Desc.PipelineType) and cast
156-
/// the reference to the appropriate PSO create info struct, e.g. for PIPELINE_TYPE_GRAPHICS:
154+
/// An optional function to be called by the dearchiver to let the application modify the pipeline state create info.
155+
156+
/// An application should check the pipeline type (PipelineCI.Desc.PipelineType) and cast
157+
/// the reference to the appropriate PSO create info struct, e.g. for PIPELINE_TYPE_GRAPHICS:
157158
///
158-
/// auto& GraphicsPipelineCI = static_cast<GraphicsPipelineStateCreateInfo>(PipelineCI);
159+
/// auto& GraphicsPipelineCI = static_cast<GraphicsPipelineStateCreateInfo>(PipelineCI);
159160
///
160-
/// Modifying graphics pipeline states (e.g. rasterizer, depth-stencil, blend, render
161-
/// target formats, etc.) is the most expected usage of the callback.
161+
/// Modifying graphics pipeline states (e.g. rasterizer, depth-stencil, blend, render
162+
/// target formats, etc.) is the most expected usage of the callback.
162163
///
163-
/// The following members of the structure must not be modified:
164-
/// - PipelineCI.PSODesc.PipelineType
165-
/// - PipelineCI.PSODesc.ResourceLayout
166-
/// - PipelineCI.ppResourceSignatures
167-
/// - PipelineCI.ResourceSignaturesCount
164+
/// The following members of the structure must not be modified:
165+
/// - `PipelineCI.PSODesc.PipelineType`
166+
/// - `PipelineCI.PSODesc.ResourceLayout`
167+
/// - `PipelineCI.ppResourceSignatures`
168+
/// - `PipelineCI.ResourceSignaturesCount`
168169
///
169-
/// An application may modify shader pointers (e.g. GraphicsPipelineCI.pVS), but it must
170-
/// ensure that the shader layout is compatible with the pipeline state, otherwise hard-to-debug
171-
/// errors will occur.
170+
/// An application may modify shader pointers (e.g. GraphicsPipelineCI.pVS), but it must
171+
/// ensure that the shader layout is compatible with the pipeline state, otherwise hard-to-debug
172+
/// errors will occur.
172173
void (*ModifyPipelineStateCreateInfo)(PipelineStateCreateInfo REF PipelineCI, void* pUserData) DEFAULT_INITIALIZER(nullptr);
173174

174175
/// A pointer to the user data to pass to the ModifyPipelineStateCreateInfo function.
@@ -266,7 +267,7 @@ DILIGENT_BEGIN_INTERFACE(IDearchiver, IObject)
266267
///
267268
/// \note Resource signatures used by the PSO will be unpacked from the same archive.
268269
///
269-
/// This method is thread-safe.
270+
/// \note This method is thread-safe.
270271
VIRTUAL void METHOD(UnpackPipelineState)(THIS_
271272
const PipelineStateUnpackInfo REF UnpackInfo,
272273
IPipelineState** ppPSO) PURE;

Graphics/GraphicsEngine/src/BottomLevelASBase.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2022 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -58,7 +58,7 @@ void ValidateBottomLevelASDesc(const BottomLevelASDesc& Desc) noexcept(false)
5858

5959
for (Uint32 i = 0; i < Desc.TriangleCount; ++i)
6060
{
61-
const auto& tri = Desc.pTriangles[i];
61+
const BLASTriangleDesc& tri = Desc.pTriangles[i];
6262

6363
if (tri.GeometryName == nullptr)
6464
LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].GeometryName must not be null.");
@@ -92,7 +92,7 @@ void ValidateBottomLevelASDesc(const BottomLevelASDesc& Desc) noexcept(false)
9292

9393
for (Uint32 i = 0; i < Desc.BoxCount; ++i)
9494
{
95-
const auto& box = Desc.pBoxes[i];
95+
const BLASBoundingBoxDesc& box = Desc.pBoxes[i];
9696

9797
if (box.GeometryName == nullptr)
9898
LOG_BLAS_ERROR_AND_THROW("pBoxes[", i, "].GeometryName must not be null.");
@@ -120,12 +120,12 @@ void CopyBLASGeometryDesc(const BottomLevelASDesc& SrcDesc,
120120

121121
MemPool.Reserve();
122122

123-
auto* pTriangles = MemPool.CopyArray(SrcDesc.pTriangles, SrcDesc.TriangleCount);
123+
BLASTriangleDesc* pTriangles = MemPool.CopyArray(SrcDesc.pTriangles, SrcDesc.TriangleCount);
124124

125125
// Copy strings
126126
for (Uint32 i = 0; i < SrcDesc.TriangleCount; ++i)
127127
{
128-
const auto* GeoName = MemPool.CopyString(SrcDesc.pTriangles[i].GeometryName);
128+
const char* GeoName = MemPool.CopyString(SrcDesc.pTriangles[i].GeometryName);
129129
pTriangles[i].GeometryName = GeoName;
130130

131131
Uint32 ActualIndex = INVALID_INDEX;
@@ -155,12 +155,12 @@ void CopyBLASGeometryDesc(const BottomLevelASDesc& SrcDesc,
155155

156156
MemPool.Reserve();
157157

158-
auto* pBoxes = MemPool.CopyArray(SrcDesc.pBoxes, SrcDesc.BoxCount);
158+
BLASBoundingBoxDesc* pBoxes = MemPool.CopyArray(SrcDesc.pBoxes, SrcDesc.BoxCount);
159159

160160
// Copy strings
161161
for (Uint32 i = 0; i < SrcDesc.BoxCount; ++i)
162162
{
163-
const auto* GeoName = MemPool.CopyString(SrcDesc.pBoxes[i].GeometryName);
163+
const char* GeoName = MemPool.CopyString(SrcDesc.pBoxes[i].GeometryName);
164164
pBoxes[i].GeometryName = GeoName;
165165

166166
Uint32 ActualIndex = INVALID_INDEX;

Graphics/GraphicsEngine/src/BufferBase.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2019-2024 Diligent Graphics LLC
2+
* Copyright 2019-2025 Diligent Graphics LLC
33
* Copyright 2015-2019 Egor Yusov
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -45,8 +45,8 @@ namespace Diligent
4545

4646
void ValidateBufferDesc(const BufferDesc& Desc, const IRenderDevice* pDevice) noexcept(false)
4747
{
48-
const auto& MemoryInfo = pDevice->GetAdapterInfo().Memory;
49-
const auto& Features = pDevice->GetDeviceInfo().Features;
48+
const AdapterMemoryInfo& MemoryInfo = pDevice->GetAdapterInfo().Memory;
49+
const DeviceFeatures& Features = pDevice->GetDeviceInfo().Features;
5050

5151
static_assert(BIND_FLAG_LAST == 0x800L, "Please update this function to handle the new bind flags");
5252

@@ -128,7 +128,7 @@ void ValidateBufferDesc(const BufferDesc& Desc, const IRenderDevice* pDevice) no
128128

129129
case USAGE_SPARSE:
130130
{
131-
const auto& SparseRes = pDevice->GetAdapterInfo().SparseResources;
131+
const SparseResourceProperties& SparseRes = pDevice->GetAdapterInfo().SparseResources;
132132
VERIFY_BUFFER(Features.SparseResources, "sparse buffer requires SparseResources feature");
133133
VERIFY_BUFFER(Desc.CPUAccessFlags == CPU_ACCESS_NONE, "sparse buffers can't have any CPU access flags set.");
134134
VERIFY_BUFFER(Desc.Size <= SparseRes.ResourceSpaceSize, "sparse buffer size (", Desc.Size, ") must not exceed the ResourceSpaceSize (", SparseRes.ResourceSpaceSize, ")");
@@ -196,7 +196,7 @@ void ValidateBufferInitData(const BufferDesc& Desc, const BufferData* pBuffData)
196196

197197
if (pBuffData != nullptr && pBuffData->pContext != nullptr)
198198
{
199-
const auto& CtxDesc = pBuffData->pContext->GetDesc();
199+
const DeviceContextDesc& CtxDesc = pBuffData->pContext->GetDesc();
200200
if (CtxDesc.IsDeferred)
201201
LOG_BUFFER_ERROR_AND_THROW("Deferred contexts can't be used to initialize resources");
202202
if ((Desc.ImmediateContextMask & (Uint64{1} << CtxDesc.ContextId)) == 0)
@@ -251,7 +251,7 @@ void ValidateAndCorrectBufferViewDesc(const BufferDesc& BuffDesc,
251251
LOG_ERROR_AND_THROW("Incorrect number of components (", Uint32{ViewDesc.Format.NumComponents}, "). 1, 2, 3, or 4 are allowed values");
252252
if (ViewDesc.Format.ValueType == VT_FLOAT32 || ViewDesc.Format.ValueType == VT_FLOAT16)
253253
ViewDesc.Format.IsNormalized = false;
254-
auto ViewElementStride = GetValueSize(ViewDesc.Format.ValueType) * Uint32{ViewDesc.Format.NumComponents};
254+
Uint32 ViewElementStride = GetValueSize(ViewDesc.Format.ValueType) * Uint32{ViewDesc.Format.NumComponents};
255255
if (BuffDesc.Mode == BUFFER_MODE_RAW && BuffDesc.ElementByteStride == 0)
256256
LOG_ERROR_AND_THROW("To enable formatted views of a raw buffer, element byte must be specified during buffer initialization");
257257
if (ViewElementStride != BuffDesc.ElementByteStride)

0 commit comments

Comments
 (0)