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");
@@ -49,6 +49,7 @@ static DILIGENT_CONSTEXPR INTERFACE_ID IID_Texture =
4949// / The enumeration is used by TextureDesc to describe misc texture flags
5050DILIGENT_TYPED_ENUM (MISC_TEXTURE_FLAGS, Uint8)
5151{
52+ // / No special flags are set
5253 MISC_TEXTURE_FLAG_NONE = 0u ,
5354
5455 // / Allow automatic mipmap generation with IDeviceContext::GenerateMips()
@@ -58,9 +59,9 @@ DILIGENT_TYPED_ENUM(MISC_TEXTURE_FLAGS, Uint8)
5859
5960 // / The texture will be used as a transient framebuffer attachment.
6061
61- // / \note Memoryless textures may only be used within a render pass in a framebuffer;
62- // / the corresponding subpass load operation must be CLEAR or DISCARD, and the
63- // / subpass store operation must be DISCARD.
62+ // / Memoryless textures may only be used within a render pass in a framebuffer;
63+ // / the corresponding subpass load operation must be CLEAR or DISCARD, and the
64+ // / subpass store operation must be DISCARD.
6465 MISC_TEXTURE_FLAG_MEMORYLESS = 1u << 1 ,
6566
6667 // / For sparse textures, allow binding the same memory range in different texture
@@ -101,25 +102,30 @@ struct TextureDesc DILIGENT_DERIVE(DeviceObjectAttribs)
101102 };
102103#endif
103104 // / Texture format, see Diligent::TEXTURE_FORMAT.
105+
104106 // / Use IRenderDevice::GetTextureFormatInfo() to check if format is supported.
105107 TEXTURE_FORMAT Format DEFAULT_INITIALIZER (TEX_FORMAT_UNKNOWN);
106108
107109 // / Number of Mip levels in the texture. Multisampled textures can only have 1 Mip level.
110+
108111 // / Specify 0 to create full mipmap chain.
109112 Uint32 MipLevels DEFAULT_INITIALIZER (1 );
110113
111- // / Number of samples.\n
114+ // / The number of samples.
115+
112116 // / Only 2D textures or 2D texture arrays can be multisampled.
113117 Uint32 SampleCount DEFAULT_INITIALIZER (1 );
114118
115- // / Bind flags, see Diligent::BIND_FLAGS for details. \n
119+ // / Bind flags, see Diligent::BIND_FLAGS for details.
120+
116121 // / Use IRenderDevice::GetTextureFormatInfoExt() to check which bind flags are supported.
117122 BIND_FLAGS BindFlags DEFAULT_INITIALIZER (BIND_NONE);
118123
119124 // / Texture usage. See Diligent::USAGE for details.
120125 USAGE Usage DEFAULT_INITIALIZER (USAGE_DEFAULT);
121126
122127 // / CPU access flags or 0 if no CPU access is allowed,
128+
123129 // / see Diligent::CPU_ACCESS_FLAGS for details.
124130 CPU_ACCESS_FLAGS CPUAccessFlags DEFAULT_INITIALIZER (CPU_ACCESS_NONE);
125131
@@ -131,7 +137,7 @@ struct TextureDesc DILIGENT_DERIVE(DeviceObjectAttribs)
131137
132138 // / Defines which immediate contexts are allowed to execute commands that use this texture.
133139
134- // / When ImmediateContextMask contains a bit at position n, the texture may be
140+ // / When ` ImmediateContextMask` contains a bit at position n, the texture may be
135141 // / used in the immediate context with index n directly (see DeviceContextDesc::ContextId).
136142 // / It may also be used in a command list recorded by a deferred context that will be executed
137143 // / through that immediate context.
@@ -265,11 +271,13 @@ typedef struct TextureDesc TextureDesc;
265271struct TextureSubResData
266272{
267273 // / Pointer to the subresource data in CPU memory.
268- // / If provided, pSrcBuffer must be null
274+
275+ // / If provided, `pSrcBuffer` must be null
269276 const void * pData DEFAULT_INITIALIZER (nullptr );
270277
271278 // / Pointer to the GPU buffer that contains subresource data.
272- // / If provided, pData must be null
279+
280+ // / If provided, `pData` must be null
273281 struct IBuffer * pSrcBuffer DEFAULT_INITIALIZER (nullptr );
274282
275283 // / When updating data from the buffer (pSrcBuffer is not null),
@@ -279,8 +287,9 @@ struct TextureSubResData
279287 // / For 2D and 3D textures, row stride in bytes
280288 Uint64 Stride DEFAULT_INITIALIZER (0 );
281289
282- // / For 3D textures, depth slice stride in bytes
283- // / \note On OpenGL, this must be a multiple of Stride
290+ // / For 3D textures, depth slice stride in bytes.
291+
292+ // / On OpenGL, this must be a multiple of `Stride`
284293 Uint64 DepthStride DEFAULT_INITIALIZER (0 );
285294
286295
@@ -320,12 +329,13 @@ typedef struct TextureSubResData TextureSubResData;
320329// / Describes the initial data to store in the texture
321330struct TextureData
322331{
323- // / Pointer to the array of the TextureSubResData elements containing
332+ // / A pointer to the array of the TextureSubResData elements containing
324333 // / information about each subresource.
325334 TextureSubResData* pSubResources DEFAULT_INITIALIZER (nullptr );
326335
327- // / Number of elements in pSubResources array.
328- // / NumSubresources must exactly match the number
336+ // / The number of elements in `pSubResources` array.
337+
338+ // / `NumSubresources` must exactly match the number
329339 // / of subresources in the texture. Otherwise an error
330340 // / occurs.
331341 Uint32 NumSubresources DEFAULT_INITIALIZER (0 );
@@ -353,10 +363,16 @@ struct TextureData
353363};
354364typedef struct TextureData TextureData;
355365
366+ // / Describes the data for one mapped subresource
356367struct MappedTextureSubresource
357368{
369+ // / Pointer to the mapped subresource data in CPU memory.
358370 PVoid pData DEFAULT_INITIALIZER (nullptr );
371+
372+ // / Row stride in bytes.
359373 Uint64 Stride DEFAULT_INITIALIZER (0 );
374+
375+ // / Depth slice stride in bytes.
360376 Uint64 DepthStride DEFAULT_INITIALIZER (0 );
361377
362378#if DILIGENT_CPP_INTERFACE
@@ -388,6 +404,7 @@ struct SparseTextureProperties
388404 Uint64 MipTailStride DEFAULT_INITIALIZER (0 );
389405
390406 // / Specifies the mip tail size in bytes.
407+
391408 // / \note Single mip tail for a 2D array may exceed the 32-bit limit.
392409 Uint64 MipTailSize DEFAULT_INITIALIZER (0 );
393410
@@ -400,11 +417,11 @@ struct SparseTextureProperties
400417
401418 // / Size of the sparse memory block, in bytes.
402419
403- // / \remarks The offset in the packed mip tail, memory offset and memory size that are used in sparse
404- // / memory binding command must be multiples of the block size.
420+ // / The offset in the packed mip tail, memory offset and memory size that are used in sparse
421+ // / memory binding command must be multiples of the block size.
405422 // /
406- // / If the SPARSE_TEXTURE_FLAG_NONSTANDARD_BLOCK_SIZE flag is not set in the Flags member,
407- // / the block size is equal to SparseResourceProperties::StandardBlockSize.
423+ // / If the Diligent:: SPARSE_TEXTURE_FLAG_NONSTANDARD_BLOCK_SIZE flag is not set in the ` Flags` member,
424+ // / the block size is equal to SparseResourceProperties::StandardBlockSize.
408425 Uint32 BlockSize DEFAULT_INITIALIZER (0 );
409426
410427 // / Flags that describe additional packing modes.
@@ -432,20 +449,26 @@ DILIGENT_BEGIN_INTERFACE(ITexture, IDeviceObject)
432449 // / \param [in] ViewDesc - View description. See Diligent::TextureViewDesc for details.
433450 // / \param [out] ppView - Address of the memory location where the pointer to the view interface will be written to.
434451 // /
435- // / \remarks To create a shader resource view addressing the entire texture, set only TextureViewDesc::ViewType
436- // / member of the ViewDesc parameter to Diligent::TEXTURE_VIEW_SHADER_RESOURCE and leave all other
437- // / members in their default values. Using the same method, you can create render target or depth stencil
438- // / view addressing the largest mip level.\n
439- // / If texture view format is Diligent::TEX_FORMAT_UNKNOWN, the view format will match the texture format.\n
440- // / If texture view type is Diligent::TEXTURE_VIEW_UNDEFINED, the type will match the texture type.\n
441- // / If the number of mip levels is 0, and the view type is shader resource, the view will address all mip levels.
442- // / For other view types it will address one mip level.\n
443- // / If the number of slices is 0, all slices from FirstArraySlice or FirstDepthSlice will be referenced by the view.
444- // / For non-array textures, the only allowed values for the number of slices are 0 and 1.\n
445- // / Texture view will contain strong reference to the texture, so the texture will not be destroyed
446- // / until all views are released.\n
447- // / The function calls AddRef() for the created interface, so it must be released by
448- // / a call to Release() when it is no longer needed.
452+ // / To create a shader resource view addressing the entire texture, set only TextureViewDesc::ViewType
453+ // / member of the ViewDesc parameter to Diligent::TEXTURE_VIEW_SHADER_RESOURCE and leave all other
454+ // / members in their default values. Using the same method, you can create render target or depth stencil
455+ // / view addressing the largest mip level.
456+ // /
457+ // / If texture view format is Diligent::TEX_FORMAT_UNKNOWN, the view format will match the texture format.
458+ // /
459+ // / If texture view type is Diligent::TEXTURE_VIEW_UNDEFINED, the type will match the texture type.
460+ // / If the number of mip levels is 0, and the view type is shader resource, the view will address all mip levels.
461+ // /
462+ // / For other view types it will address one mip level.
463+ // /
464+ // / If the number of slices is 0, all slices from FirstArraySlice or FirstDepthSlice will be referenced by the view.
465+ // / For non-array textures, the only allowed values for the number of slices are 0 and 1.
466+ // /
467+ // / Texture view will contain strong reference to the texture, so the texture will not be destroyed
468+ // / until all views are released.
469+ // /
470+ // / The function calls AddRef() for the created interface, so it must be released by
471+ // / a call to Release() when it is no longer needed.
449472 VIRTUAL void METHOD (CreateView)(THIS_
450473 const TextureViewDesc REF ViewDesc,
451474 ITextureView** ppView) PURE;
@@ -455,26 +478,29 @@ DILIGENT_BEGIN_INTERFACE(ITexture, IDeviceObject)
455478 // / \param [in] ViewType - Type of the requested view. See Diligent::TEXTURE_VIEW_TYPE.
456479 // / \return Pointer to the interface
457480 // /
458- // / \note The function does not increase the reference counter for the returned interface, so
459- // / Release() must *NOT * be called.
481+ // / \note The function does ** not** increase the reference counter for the returned interface, so
482+ // / Release() ** must not* * be called.
460483 VIRTUAL ITextureView* METHOD (GetDefaultView)(THIS_
461484 TEXTURE_VIEW_TYPE ViewType) PURE;
462485
463486
464487 // / Returns native texture handle specific to the underlying graphics API
465488
466- // / \return pointer to ID3D11Resource interface, for D3D11 implementation\n
467- // / pointer to ID3D12Resource interface, for D3D12 implementation\n
468- // / GL buffer handle, for GL implementation
489+ // / \return A pointer to `ID3D11Resource` interface, for D3D11 implementation\n
490+ // / A pointer to `ID3D12Resource` interface, for D3D12 implementation\n
491+ // / `VkImage` handle, for Vulkan implementation\n
492+ // / GL texture name, for OpenGL implementation\n
493+ // / `MtlTexture`, for Metal implementation\n
494+ // / `WGPUTexture` for WebGPU implementation
469495 VIRTUAL Uint64 METHOD (GetNativeHandle)(THIS) PURE;
470496
471497 // / Sets the usage state for all texture subresources.
472498
473- // / \note This method does not perform state transition, but
474- // / resets the internal texture state to the given value.
475- // / This method should be used after the application finished
476- // / manually managing the texture state and wants to hand over
477- // / state management back to the engine.
499+ // / This method does not perform state transition, but
500+ // / resets the internal texture state to the given value.
501+ // / This method should be used after the application finished
502+ // / manually managing the texture state and wants to hand over
503+ // / state management back to the engine.
478504 VIRTUAL void METHOD (SetState)(THIS_
479505 RESOURCE_STATE State) PURE;
480506
0 commit comments