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 xiiGALResourceFormatDescription & GetResourceFormatProperties (xiiEnum< xiiGALResourceFormat > format)
static const xiiGALMultiPlanarFormatDescription & GetMultiPlanarFormatProperties (xiiEnum< xiiGALResourceFormat > format)
static XII_ALWAYS_INLINE bool IsCompressed (xiiEnum< xiiGALResourceFormat > format)
 Returns true if the given format is a multi-planar format.
static XII_ALWAYS_INLINE xiiUInt32 GetComponentCount (xiiEnum< xiiGALResourceFormat > format)
 Returns the number of components for a given texture format.
static XII_ALWAYS_INLINE xiiUInt32 GetBitsPerComponent (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex=0)
 Returns the bits per component for a given texture format.
static XII_ALWAYS_INLINE xiiUInt32 GetBytesPerBlock (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex=0)
 Returns the bytes per block for a given texture format. For most formats, this is equal to the bytes per pixel. For compressed formats, this is the total number of bytes in a compression block.
static XII_ALWAYS_INLINE xiiUInt32 GetBitsPerBlock (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex=0)
 Returns the bits per block for a given texture format. For most formats, this is equal to the bits per pixel. For compressed formats, this is the total number of bits in a compression block.
static XII_ALWAYS_INLINE xiiUInt32 GetBitsPerPixel (xiiEnum< xiiGALResourceFormat > format)
 Returns the bits per pixel for a given texture format. For compressed formats, this is the average bits per pixel across a block.
static XII_ALWAYS_INLINE float GetExactBitsPerPixel (xiiEnum< xiiGALResourceFormat > format)
 Returns the exact bits per pixel for a given texture format. For compressed formats, this may be a fractional value.
static XII_ALWAYS_INLINE xiiUInt32 GetBlockWidth (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex=0)
 Returns the block width for a given texture format. For most formats, this is 1. For compressed formats, this may be greater than 1.
static XII_ALWAYS_INLINE xiiUInt32 GetBlockHeight (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex=0)
 Returns the block height for a given texture format. For most formats, this is 1. For compressed formats, this may be greater than 1.
static XII_ALWAYS_INLINE xiiUInt32 GetBlockDepth (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex=0)
 Returns the block depth for a given texture format. For most formats, this is 1. For 3D textures, this may be greater than 1.
static XII_ALWAYS_INLINE bool RequiresFirstLevelBlockAlignment (xiiEnum< xiiGALResourceFormat > format)
 Returns true if the format requires first-level block alignment (i.e., if the block width or height is greater than 1).
static XII_ALWAYS_INLINE xiiEnum< xiiGALResourceFormat > GetPlaneSubFormat (xiiEnum< xiiGALResourceFormat > format, xiiUInt32 uiPlaneIndex)
 Returns the sub-format for a given multi-planar texture format and plane index.
static XII_ALWAYS_INLINE xiiEnum< xiiGALResourceFormatComponentType > GetComponentType (xiiEnum< xiiGALResourceFormat > format)
 Returns the component type for a given texture 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)
 This returns the mip level properties for a given texture and mip level.
static xiiUInt32 GetMipLevelCount (const xiiGALTextureCreationDescription &textureDescription)
 This returns the number of mip levels for a given texture.
static xiiUInt64 GetStagingTextureLocationOffset (const xiiGALTextureCreationDescription &textureDescription, xiiUInt32 uiArraySlice, xiiUInt32 uiMipLevel, xiiUInt32 uiAlignment, xiiUInt32 uiLocationX, xiiUInt32 uiLocationY, xiiUInt32 uiLocationZ)
static XII_ALWAYS_INLINE xiiUInt64 GetStagingTextureSubresourceOffset (const xiiGALTextureCreationDescription &textureDescription, xiiUInt32 uiArraySlice, xiiUInt32 uiMipLevel, xiiUInt32 uiAlignment)
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)
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< xiiGALResourceFormat > GetDefaultTextureViewFormat (xiiEnum< xiiGALResourceFormat > format, xiiEnum< xiiGALTextureViewType > viewType, xiiBitflags< xiiGALBindFlags > bindFlags)
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.
static XII_ALWAYS_INLINE xiiUInt32 GetSubResourceCount (const xiiGALTextureCreationDescription &description) noexcept
 Returns the total number of subresources. A volume mip includes all of its depth slices.
static XII_ALWAYS_INLINE xiiUInt32 GetRequiredRowPitch (const xiiGALTextureCreationDescription &description, xiiUInt32 uiMipLevel)
 Returns the required row pitch for the given texture description and mip level.
static XII_ALWAYS_INLINE xiiUInt32 GetRequiredSlicePitch (const xiiGALTextureCreationDescription &description, xiiUInt32 uiMipLevel)
 Returns the required slice pitch for the given texture description and mip level.
static xiiGALTextureData GetZeroMemoryInitialData (const xiiGALTextureCreationDescription description, xiiHybridArray< xiiGALTextureSubResourceData, 2U > &out_subresourceData, xiiDynamicArray< xiiUInt8 > &out_Data)
 Fills the out_subresourceData array with zero-initialized data pointers for all subresources of the given texture description.
static void CopySubresourceToMemory (const xiiGALTextureCreationDescription &description, const xiiGALMappedTextureSubresource &subresourceData, const xiiGALTextureMipLevelData &mipLevelData, xiiArrayPtr< xiiUInt8 > pTargetData, xiiUInt32 uiTargetRowStride)

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.

◆ GetMultiPlanarFormatProperties()

const xiiGALMultiPlanarFormatDescription & xiiGALTextureUtilities::GetMultiPlanarFormatProperties ( xiiEnum< xiiGALResourceFormat > format)
staticnodiscard

This returns the multi-planar format information for a particular format.

Parameters
format- The texture format for which to provide the information.
Returns
A const reference to the xiiGALMultiPlanarFormatDescription structure containing the multi-planar format description.

◆ 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.

◆ 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'

◆ GetStagingTextureSubresourceOffset()

XII_ALWAYS_INLINE xiiUInt64 xiiGALTextureUtilities::GetStagingTextureSubresourceOffset ( const xiiGALTextureCreationDescription & textureDescription,
xiiUInt32 uiArraySlice,
xiiUInt32 uiMipLevel,
xiiUInt32 uiAlignment )
inlinestaticnodiscard

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.

◆ IsIdentityComponentMapping()

bool xiiGALTextureUtilities::IsIdentityComponentMapping ( const xiiGALTextureComponentMapping & mapping)
staticnodiscard

Returns true if all components of the xiiGALTextureComponentMapping are xiiGALTextureComponentSwizzle::Identity.

Copyright (c) Theophilus Eriata. All Rights Reserved.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/GraphicsFoundation/Utilities/TextureUtilities.h
  • /home/runner/work/XII/XII/Source/Engine/GraphicsFoundation/Utilities/Implementation/TextureUtilities.cpp