Skip to content

Commit cfbe8a3

Browse files
Updated documentation for IArchiver and related structs
1 parent bafc489 commit cfbe8a3

File tree

4 files changed

+48
-37
lines changed

4 files changed

+48
-37
lines changed

Graphics/Archiver/interface/Archiver.h

Lines changed: 15 additions & 12 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
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,7 +94,7 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
9494
/// \param [out] ppBlob - memory location where a pointer to the data blob will be stored.
9595

9696
/// \note
97-
/// The method is *not* thread-safe and must not be called from multiple threads simultaneously.
97+
/// The method is *not* thread-safe and **must not** be called from multiple threads simultaneously.
9898
VIRTUAL Bool METHOD(SerializeToBlob)(THIS_
9999
Uint32 ContentVersion,
100100
IDataBlob** ppBlob) PURE;
@@ -105,7 +105,7 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
105105
/// \param [out] pStream - a pointer to the stream to write the archive to.
106106

107107
/// \note
108-
/// The method is *not* thread-safe and must not be called from multiple threads simultaneously.
108+
/// The method is *not* thread-safe and **must not** be called from multiple threads simultaneously.
109109
VIRTUAL Bool METHOD(SerializeToStream)(THIS_
110110
Uint32 ContentVersion,
111111
IFileStream* pStream) PURE;
@@ -114,11 +114,12 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
114114

115115
/// \param [in] pShader - a pointer to the shader to add to the archive.
116116
///
117-
/// \return true if the shader was added successfully, and false otherwise.
117+
/// \return `true` if the shader was added successfully, and `false` otherwise.
118118
///
119119
/// \note
120120
/// Shader object pointed to by pShader must have been created by the serialization device.
121121
///
122+
/// \note
122123
/// Multiple shaders may be packed into the same archive as long as they use unique names.
123124
///
124125
/// The method is thread-safe and may be called from multiple threads simultaneously.
@@ -129,11 +130,12 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
129130

130131
/// \param [in] pPSO - a pointer to the pipeline state to add to the archive.
131132
///
132-
/// \return true if the pipeline state was added successfully, and false otherwise.
133+
/// \return `true` if the pipeline state was added successfully, and `false` otherwise.
133134
///
134135
/// \note
135136
/// Pipeline state object pointed to by pPSO must have been created by the serialization device.
136137
///
138+
/// \note
137139
/// Multiple pipeline states may be packed into the same archive as long as they use unique names.
138140
/// All dependent objects (render pass, resource signatures, shaders) will be added to the archive
139141
/// and must also use unique names.
@@ -147,11 +149,12 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
147149

148150
/// \param [in] pSignature - a pointer to the resource signature to add to the archive.
149151
///
150-
/// \return true if the signature was added successfully, and false otherwise.
152+
/// \return `true` if the signature was added successfully, and `false` otherwise.
151153
///
152154
/// \note
153155
/// Pipeline resource signature pointed to by pSignature must have been created by the serialization device.
154156
///
157+
/// \note
155158
/// Multiple PSOs and signatures may be packed into the same archive as long as they use distinct names.
156159
///
157160
/// The method is thread-safe and may be called from multiple threads simultaneously.
@@ -166,8 +169,8 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
166169
/// \param [in] ShaderName - Name of the shader object to retrieve.
167170
/// \return A pointer to the shader object, or null if the object with that name was not added.
168171
///
169-
/// \ note The method does *not* increment the reference counter of the returned object,
170-
/// so the application must not call Release() unless it also explicitly calls AddRef().
172+
/// \note The method does *not* increment the reference counter of the returned object,
173+
/// so the application **must not** call Release() unless it also explicitly calls AddRef().
171174
VIRTUAL IShader* METHOD(GetShader)(THIS_
172175
const char* ShaderName) PURE;
173176

@@ -177,8 +180,8 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
177180
/// \param [in] PSOName - Name of the pipeline state to retrieve.
178181
/// \return A pointer to the pipeline state object, or null if the object with that name was not added.
179182
///
180-
/// \ note The method does *not* increment the reference counter of the returned object,
181-
/// so the application must not call Release() unless it also explicitly calls AddRef().
183+
/// \note The method does *not* increment the reference counter of the returned object,
184+
/// so the application **must not** call Release() unless it also explicitly calls AddRef().
182185
VIRTUAL IPipelineState* METHOD(GetPipelineState)(THIS_
183186
PIPELINE_TYPE PSOType,
184187
const char* PSOName) PURE;
@@ -188,8 +191,8 @@ DILIGENT_BEGIN_INTERFACE(IArchiver, IObject)
188191
/// \param [in] PRSName - Name of the pipeline resource signature to retrieve.
189192
/// \return A pointer to the the pipeline resource signature object, or null if the object with that name was not added.
190193
///
191-
/// \ note The method does *not* increment the reference counter of the returned object,
192-
/// so the application must not call Release() unless it also explicitly calls AddRef().
194+
/// \note The method does *not* increment the reference counter of the returned object,
195+
/// so the application **must not** call Release() unless it also explicitly calls AddRef().
193196
VIRTUAL IPipelineResourceSignature* METHOD(GetPipelineResourceSignature)(THIS_
194197
const char* PRSName) PURE;
195198
};

Graphics/Archiver/interface/ArchiverFactory.h

Lines changed: 17 additions & 16 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
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -107,7 +107,7 @@ struct SerializationDeviceGLInfo
107107
/// When OptimizeShaders is set to true, the archiver will optimize the shader
108108
/// source code for run-time loading performance.
109109
///
110-
/// Technical details: the archiver will compile the shader source code to SPIRV
110+
/// \remarks Technical details: the archiver will compile the shader source code to SPIRV
111111
/// with GLSLang and then translate SPIRV back to GLSL using SPIRV-Cross.
112112
/// The resulting GLSL code will be much more compact and will be stored in the
113113
/// archive instead of the original source code.
@@ -160,7 +160,6 @@ struct SerializationDeviceVkInfo
160160
return !(*this == RHS);
161161
}
162162
#endif
163-
164163
};
165164
typedef struct SerializationDeviceVkInfo SerializationDeviceVkInfo;
166165

@@ -201,13 +200,15 @@ typedef struct SerializationDeviceMtlInfo SerializationDeviceMtlInfo;
201200
struct SerializationDeviceCreateInfo
202201
{
203202
/// Device info, contains enabled device features.
204-
/// Can be used to validate shader, render pass, resource signature and pipeline state.
203+
204+
/// Can be used to validate shaders, render passes, resource signatures and pipeline states.
205205
///
206206
/// \note For OpenGL that does not support separable programs, disable the SeparablePrograms feature.
207207
RenderDeviceInfo DeviceInfo;
208208

209209
/// Adapter info, contains device parameters.
210-
/// Can be used to validate shader, render pass, resource signature and pipeline state.
210+
211+
/// Can be used to validate shaders, render passes, resource signatures and pipeline states.
211212
GraphicsAdapterInfo AdapterInfo;
212213

213214
/// Direct3D11 attributes, see Diligent::SerializationDeviceD3D11Info.
@@ -229,14 +230,14 @@ struct SerializationDeviceCreateInfo
229230
IThreadPool* pAsyncShaderCompilationThreadPool DEFAULT_INITIALIZER(nullptr);
230231

231232
/// The maximum number of threads that can be used to compile shaders.
232-
///
233-
/// \remarks If pAsyncShaderCompilationThreadPool is null, this value is used to define the number of threads in
234-
/// the default thread pool.
235-
/// If the value is 0xFFFFFFFF, the number of threads will be determined automatically.
236-
/// If the value is 0, the default thread pool will not be created.
233+
234+
/// If `pAsyncShaderCompilationThreadPool` is `null`, this value is used to define the number of threads in
235+
/// the default thread pool.
236+
/// If the value is `0xFFFFFFFF`, the number of threads will be determined automatically.
237+
/// If the value is `0`, the default thread pool will not be created.
237238
///
238-
/// If pAsyncShaderCompilationThreadPool is not null, the value is ignored as the user-provided
239-
/// thread pool is used instead.
239+
/// If `pAsyncShaderCompilationThreadPool` is not `null`, the value is ignored as the user-provided
240+
/// thread pool is used instead.
240241
Uint32 NumAsyncShaderCompilationThreads DEFAULT_INITIALIZER(0);
241242

242243
#if DILIGENT_CPP_INTERFACE
@@ -289,7 +290,7 @@ DILIGENT_BEGIN_INTERFACE(IArchiverFactory, IObject)
289290
/// \param [in] pSrcArchive - Source archive from which device specific-data will be removed.
290291
/// \param [in] DeviceFlags - Combination of device types that will be removed.
291292
/// \param [out] ppDstArchive - Memory address where a pointer to the new archive will be written.
292-
/// \return true if the device-specific data was successfully removed, and false otherwise.
293+
/// \return `true` if the device-specific data was successfully removed, and `false` otherwise.
293294
VIRTUAL Bool METHOD(RemoveDeviceData)(THIS_
294295
const IDataBlob* pSrcArchive,
295296
ARCHIVE_DEVICE_DATA_FLAGS DeviceFlags,
@@ -302,7 +303,7 @@ DILIGENT_BEGIN_INTERFACE(IArchiverFactory, IObject)
302303
/// \param [in] DeviceFlags - Combination of device types that will be copied.
303304
/// \param [in] pDeviceArchive - Archive that contains the same common data and additional device-specific data.
304305
/// \param [out] ppDstArchive - Memory address where a pointer to the new archive will be written.
305-
/// \return true if the device-specific data was successfully added, and false otherwise.
306+
/// \return `true` if the device-specific data was successfully added, and `false` otherwise.
306307
VIRTUAL Bool METHOD(AppendDeviceData)(THIS_
307308
const IDataBlob* pSrcArchive,
308309
ARCHIVE_DEVICE_DATA_FLAGS DeviceFlags,
@@ -313,9 +314,9 @@ DILIGENT_BEGIN_INTERFACE(IArchiverFactory, IObject)
313314
/// Merges multiple archives into one.
314315

315316
/// \param [in] ppSrcArchives - An array of pointers to the source archives.
316-
/// \param [in] NumSrcArchives - The number of elements in ppArchives array.
317+
/// \param [in] NumSrcArchives - The number of elements in `ppArchives` array.
317318
/// \param [out] ppDstArchive - Memory address where a pointer to the merged archive will be written.
318-
/// \return true if the archives were successfully merged, and false otherwise.
319+
/// \return `true` if the archives were successfully merged, and `false` otherwise.
319320
VIRTUAL Bool METHOD(MergeArchives)(THIS_
320321
const IDataBlob* ppSrcArchives[],
321322
Uint32 NumSrcArchives,

Graphics/Archiver/interface/SerializationDevice.h

Lines changed: 14 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
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,6 +56,7 @@ static DILIGENT_CONSTEXPR INTERFACE_ID IID_SerializationDevice =
5656
struct ShaderArchiveInfo
5757
{
5858
/// Bitset of Diligent::ARCHIVE_DEVICE_DATA_FLAGS.
59+
5960
/// Specifies for which backends the shader data will be serialized.
6061
ARCHIVE_DEVICE_DATA_FLAGS DeviceFlags DEFAULT_INITIALIZER(ARCHIVE_DEVICE_DATA_FLAG_NONE);
6162
};
@@ -65,6 +66,7 @@ typedef struct ShaderArchiveInfo ShaderArchiveInfo;
6566
struct ResourceSignatureArchiveInfo
6667
{
6768
/// Bitset of Diligent::ARCHIVE_DEVICE_DATA_FLAGS.
69+
6870
/// Specifies for which backends the resource signature data will be serialized.
6971
ARCHIVE_DEVICE_DATA_FLAGS DeviceFlags DEFAULT_INITIALIZER(ARCHIVE_DEVICE_DATA_FLAG_NONE);
7072
};
@@ -77,6 +79,7 @@ struct PipelineStateArchiveInfo
7779
PSO_ARCHIVE_FLAGS PSOFlags DEFAULT_INITIALIZER(PSO_ARCHIVE_FLAG_NONE);
7880

7981
/// Bitset of Diligent::ARCHIVE_DEVICE_DATA_FLAGS.
82+
8083
/// Specifies for which backends the pipeline state data will be serialized.
8184
ARCHIVE_DEVICE_DATA_FLAGS DeviceFlags DEFAULT_INITIALIZER(ARCHIVE_DEVICE_DATA_FLAG_NONE);
8285
};
@@ -86,23 +89,27 @@ typedef struct PipelineStateArchiveInfo PipelineStateArchiveInfo;
8689
/// Contains attributes to calculate pipeline resource bindings
8790
struct PipelineResourceBindingAttribs
8891
{
89-
/// An array of ResourceSignaturesCount shader resource signatures that
92+
/// An array of `ResourceSignaturesCount` shader resource signatures that
9093
/// define the layout of shader resources in this pipeline state object.
94+
9195
/// See Diligent::IPipelineResourceSignature.
9296
IPipelineResourceSignature** ppResourceSignatures DEFAULT_INITIALIZER(nullptr);
9397

94-
/// The number of elements in ppResourceSignatures array.
98+
/// The number of elements in `ppResourceSignatures` array.
9599
Uint32 ResourceSignaturesCount DEFAULT_INITIALIZER(0);
96100

97101
/// The number of render targets, only for graphics pipeline.
102+
98103
/// \note Required for Direct3D11 graphics pipelines that use UAVs.
99104
Uint32 NumRenderTargets DEFAULT_INITIALIZER(0);
100105

101106
/// The number of vertex buffers, only for graphics pipeline.
107+
102108
/// \note Required for Metal.
103109
Uint32 NumVertexBuffers DEFAULT_INITIALIZER(0);
104110

105111
/// Vertex buffer names.
112+
106113
/// \note Required for Metal.
107114
Char const* const* VertexBufferNames DEFAULT_INITIALIZER(nullptr);
108115

@@ -260,22 +267,22 @@ DILIGENT_BEGIN_INTERFACE(ISerializationDevice, IRenderDevice)
260267
IRenderDevice* pDevice) PURE;
261268

262269
#if DILIGENT_CPP_INTERFACE
263-
/// Overloaded alias for CreateGraphicsPipelineState.
270+
/// Overloaded alias for ISerializationDevice::CreateGraphicsPipelineState.
264271
void CreatePipelineState(const GraphicsPipelineStateCreateInfo& CI, const PipelineStateArchiveInfo& ArchiveInfo, IPipelineState** ppPipelineState)
265272
{
266273
CreateGraphicsPipelineState(CI, ArchiveInfo, ppPipelineState);
267274
}
268-
/// Overloaded alias for CreateComputePipelineState.
275+
/// Overloaded alias for ISerializationDevice::CreateComputePipelineState.
269276
void CreatePipelineState(const ComputePipelineStateCreateInfo& CI, const PipelineStateArchiveInfo& ArchiveInfo, IPipelineState** ppPipelineState)
270277
{
271278
CreateComputePipelineState(CI, ArchiveInfo, ppPipelineState);
272279
}
273-
/// Overloaded alias for CreateRayTracingPipelineState.
280+
/// Overloaded alias for ISerializationDevice::CreateRayTracingPipelineState.
274281
void CreatePipelineState(const RayTracingPipelineStateCreateInfo& CI, const PipelineStateArchiveInfo& ArchiveInfo, IPipelineState** ppPipelineState)
275282
{
276283
CreateRayTracingPipelineState(CI, ArchiveInfo, ppPipelineState);
277284
}
278-
/// Overloaded alias for CreateTilePipelineState.
285+
/// Overloaded alias for ISerializationDevice::CreateTilePipelineState.
279286
void CreatePipelineState(const TilePipelineStateCreateInfo& CI, const PipelineStateArchiveInfo& ArchiveInfo, IPipelineState** ppPipelineState)
280287
{
281288
CreateTilePipelineState(CI, ArchiveInfo, ppPipelineState);

Graphics/Archiver/interface/SerializedShader.h

Lines changed: 2 additions & 2 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.
@@ -51,7 +51,7 @@ static DILIGENT_CONSTEXPR INTERFACE_ID IID_SerializedShader =
5151
DILIGENT_BEGIN_INTERFACE(ISerializedShader, IShader)
5252
{
5353
/// Returns a device-specific shader for the given render device type.
54-
///
54+
5555
/// \note In order for the returned shader object to be fully initialized
5656
/// and suitable for use in rendering commands, a corresponding render
5757
/// device must have been initialized in the serialization device through

0 commit comments

Comments
 (0)