XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGALTextureUtilities Class Reference

Static Public Member Functions

static bool IsIdentityComponentMapping (const xiiGALTextureComponentMapping &mapping)
 Returns true if all components of the xiiGALTextureComponentMapping are xiiGALTextureComponentSwizzle::Identity.
 
static const xiiGALResourceFormatDescriptionGetResourceFormatProperties (xiiEnum< xiiGALResourceFormat > format)
 This returns the basic texture information for a particular format.
 
static const xiiGALSparseTextureProperties GetSparseTextureProperties (xiiEnum< xiiGALResourceFormat > format, xiiEnum< xiiGALResourceDimension > dimension, xiiUInt32 uiSampleCount)
 This returns the sparse texture format information for the given texture format, resource dimension and sample count.
 
static xiiVec3U32 GetMipLevelSize (xiiUInt32 uiMipLevelSize, const xiiGALTextureCreationDescription &textureDescription)
 This returns the mip level size of a given texture. This is typically used when retrieving the frame buffer size for a particular texture.
 
static xiiUInt32 GetMipSize (xiiUInt32 uiSize, xiiUInt32 uiMipLevel)
 This returns the mip size for a given mip level.
 
static xiiGALMipLevelProperties GetMipLevelProperties (const xiiGALTextureCreationDescription &textureDescription, xiiUInt32 uiMipLevel)
 
static xiiUInt64 GetStagingTextureLocationOffset (const xiiGALTextureCreationDescription &textureDescription, xiiUInt32 uiArraySlice, xiiUInt32 uiMipLevel, xiiUInt32 uiAlignment, xiiUInt32 uiLocationX, xiiUInt32 uiLocationY, xiiUInt32 uiLocationZ)
 Returns an offset from the beginning of the buffer backing a staging texture to the specified location within the given subresource.
 
static XII_ALWAYS_INLINE xiiUInt64 GetStagingTextureSubresourceOffset (const xiiGALTextureCreationDescription &textureDescription, xiiUInt32 uiArraySlice, xiiUInt32 uiMipLevel, xiiUInt32 uiAlignment)
 Returns an offset from the beginning of the buffer backing a staging texture to the given subresource. Texels within subresources are assumed to be tightly packed. There is no padding except between whole subresources.
 
static xiiGALBufferToTextureCopyDescription GetBufferToTextureCopyDescription (xiiGALResourceFormat::Enum format, const xiiBoundingBoxU32 &region, xiiUInt32 uiRowStrideAlignment)
 Computes the information required to perform a copy operation between a buffer and a texture.
 
static void CopyTextureSubresource (const xiiGALTextureSubResourceData &sourceSubresource, xiiUInt32 uiRowCount, xiiUInt32 uiDepthSliceCount, xiiUInt64 uiRowSize, void *pDestinationData, xiiUInt64 uiDestinationRowStride, xiiUInt64 uiDestinationDepthStride)
 Copies texture subresource data on the CPU.
 
static XII_ALWAYS_INLINE xiiUInt64 GetStagingTextureDataSize (const xiiGALTextureCreationDescription &textureDescription, xiiUInt32 uiAlignment=4U)
 Returns the total memory size required to store the staging texture data.
 
static xiiEnum< xiiGALResourceFormatGetDefaultTextureViewFormat (xiiEnum< xiiGALResourceFormat > format, xiiEnum< xiiGALTextureViewType > viewType, xiiBitflags< xiiGALBindFlags > bindFlags)
 This returns the default texture view type for a source format and the view type that are matched with the bind flags.
 
static xiiGALTextureCreationDescription GetDefaultTexture1DDescription () noexcept
 Returns the default texture 1D creation description.
 
static xiiGALTextureCreationDescription GetDefaultTexture2DDescription () noexcept
 Returns the default texture 2D creation description.
 
static xiiGALTextureCreationDescription GetDefaultTexture3DDescription () noexcept
 Returns the default texture 3D creation description.
 
static xiiGALTextureCreationDescription GetDefaultTextureCubeDescription () noexcept
 Returns the default texture cube creation description.
 

Member Function Documentation

◆ CopyTextureSubresource()

void xiiGALTextureUtilities::CopyTextureSubresource ( const xiiGALTextureSubResourceData & sourceSubresource,
xiiUInt32 uiRowCount,
xiiUInt32 uiDepthSliceCount,
xiiUInt64 uiRowSize,
void * pDestinationData,
xiiUInt64 uiDestinationRowStride,
xiiUInt64 uiDestinationDepthStride )
static

Copies texture subresource data on the CPU.

Parameters
sourceSubresource- Source subresource data.
uiRowCount- The number of rows in the subresource.
uiDepthSliceCount- The number of depth slices in the subresource.
uiRowSize- Subresource data row size, in bytes.
pDestinationData- Pointer to the destination subresource data.
uiDestinationRowStride- Destination subresource row stride, in bytes.
uiDestinationDepthStride- Destination subresource depth stride, in bytes.

◆ GetDefaultTextureViewFormat()

xiiEnum< xiiGALResourceFormat > xiiGALTextureUtilities::GetDefaultTextureViewFormat ( xiiEnum< xiiGALResourceFormat > format,
xiiEnum< xiiGALTextureViewType > viewType,
xiiBitflags< xiiGALBindFlags > bindFlags )
staticnodiscard

This returns the default texture view type for a source format and the view type that are matched with the bind flags.

Parameters
format- The source texture format.
viewType- The view type to be created.
bindFlags- The texture bind flags.

◆ GetResourceFormatProperties()

const xiiGALResourceFormatDescription & xiiGALTextureUtilities::GetResourceFormatProperties ( xiiEnum< xiiGALResourceFormat > format)
staticnodiscard

This returns the basic texture information for a particular format.

Parameters
format- The texture format for which to provide the information.
Returns
A const reference to the xiiGALResourceFormatDescription structure containing the texture format description.
Remarks
This method must be externally synchronized.

◆ GetSparseTextureProperties()

const xiiGALSparseTextureProperties xiiGALTextureUtilities::GetSparseTextureProperties ( xiiEnum< xiiGALResourceFormat > format,
xiiEnum< xiiGALResourceDimension > dimension,
xiiUInt32 uiSampleCount )
staticnodiscard

This returns the sparse texture format information for the given texture format, resource dimension and sample count.

Todo
GraphicsFoundation: To be implemented.

◆ GetStagingTextureLocationOffset()

xiiUInt64 xiiGALTextureUtilities::GetStagingTextureLocationOffset ( const xiiGALTextureCreationDescription & textureDescription,
xiiUInt32 uiArraySlice,
xiiUInt32 uiMipLevel,
xiiUInt32 uiAlignment,
xiiUInt32 uiLocationX,
xiiUInt32 uiLocationY,
xiiUInt32 uiLocationZ )
staticnodiscard

Returns an offset from the beginning of the buffer backing a staging texture to the specified location within the given subresource.

Parameters
textureDescription- Staging texture description.
uiArraySlice- Array slice.
uiMipLevel- Mip level.
uiAlignment- Subresource alignment. The alignment is applied to whole subresources only, but not to the row/depth strides. In other words, there may be padding between subresources, but texels in every subresource are assumed to be tightly packed.
uiLocationX- X location within the subresource.
uiLocationY- Y location within the subresource.
uiLocationZ- Z location within the subresource.
Returns
Offset from the beginning of the buffer to the given location.
Remarks
Alignment is applied to the subresource sizes, such that the beginning of data of every subresource starts at an offset aligned by 'Alignment'. The alignment is not applied to the row/depth strides and texels in all subresources are assumed to be tightly packed.

Subres 0 stride |<-------------->| |________________| Subres 1 | | stride | | |<------->| | | |_________| | Subres 0 | | | | | | Subres 1| | | | | _ |________________| |_________| ... |_| A A A | | | Buffer start Subres 1 offset, Subres N offset, aligned by 'Alignment' aligned by 'Alignment'


The documentation for this class was generated from the following files: