LLGL 0.05 Beta
Loading...
Searching...
No Matches
Texture utility functions to determine texture dimension and buffer sizes.

Functions

LLGL_EXPORT std::uint32_t LLGL::NumMipLevels (std::uint32_t width, std::uint32_t height=1, std::uint32_t depth=1)
 Returns the number of MIP-map levels for a texture with the specified size.
LLGL_EXPORT std::uint32_t LLGL::NumMipLevels (const TextureType type, const Extent3D &extent)
 Returns the number of MIP-map levels for the specified texture attributes.
LLGL_EXPORT std::uint32_t LLGL::NumMipLevels (const TextureDescriptor &textureDesc)
 Returns the number of MIP-map levels for the specified texture descriptor.
LLGL_EXPORT std::uint32_t LLGL::NumMipTexels (const TextureType type, const Extent3D &extent, std::uint32_t mipLevel)
 Returns the number of texture elements (texels) for the specified texture attributes, or zero extent if mipLevel is out of bounds (see NumMipLevels).
LLGL_EXPORT std::uint32_t LLGL::NumMipTexels (const TextureType type, const Extent3D &extent, const TextureSubresource &subresource)
 Returns the number of texture elements (texels) for the specified texture subresource range.
LLGL_EXPORT std::uint32_t LLGL::NumMipTexels (const TextureDescriptor &textureDesc, std::uint32_t mipLevel=~0u)
 Returns the number of texture elements (texels) for the specified texture descriptor.
LLGL_EXPORT std::uint32_t LLGL::NumMipDimensions (const TextureType type)
 Returns the number of MIP-map dimensions for the specified texture type. This is either 1, 2, 3, or 0 if the input is invalid.
LLGL_EXPORT std::uint32_t LLGL::NumTextureDimensions (const TextureType type)
 Returns the number of texture dimensions for the specified texture type. This is either 1, 2, 3, or 0 if the input is invalid.
LLGL_EXPORT Extent3D LLGL::GetMipExtent (const TextureType type, const Extent3D &extent, std::uint32_t mipLevel)
 Returns the MIP-map extent (including array layers) for the specified texture type, or an empty extent if mipLevel is out of bounds (see NumMipLevels).
LLGL_EXPORT Extent3D LLGL::GetMipExtent (const TextureDescriptor &textureDesc, std::uint32_t mipLevel=0)
 Returns the MIP-map extent (including array layers) for the specified texture descriptor.
LLGL_EXPORT std::size_t LLGL::GetMemoryFootprint (const TextureType type, const Format format, const Extent3D &extent, const TextureSubresource &subresource)
 Returns the memory footprint (in bytes) of a texture subresource with the specified hardware format and extent.
LLGL_EXPORT bool LLGL::IsMipMappedTexture (const TextureDescriptor &textureDesc)
 Returns true if the specified texture descriptor describes a texture with MIP-mapping enabled.
LLGL_EXPORT bool LLGL::IsArrayTexture (const TextureType type)
 Returns true if the specified texture type is an array texture.
LLGL_EXPORT bool LLGL::IsMultiSampleTexture (const TextureType type)
 Returns true if the specified texture type is a multi-sample texture.
LLGL_EXPORT bool LLGL::IsCubeTexture (const TextureType type)
 Returns true if the specified texture type is a cube texture.
LLGL_EXPORT bool LLGL::IsTextureSwizzleIdentity (const TextureSwizzleRGBA &swizzle)
 Returns true if the specified texture swizzling is equal to the identity mapping.

Detailed Description

Function Documentation

◆ GetMemoryFootprint()

LLGL_EXPORT std::size_t LLGL::GetMemoryFootprint ( const TextureType type,
const Format format,
const Extent3D & extent,
const TextureSubresource & subresource )

Returns the memory footprint (in bytes) of a texture subresource with the specified hardware format and extent.

Parameters
[in]typeSpecifies the texture type which determines how extent and subresource will result into the final texture dimensions.
[in]formatSpecifies the hardware format.
[in]extentSpecifies the extent of the texture subresource.
[in]subresourceSpecifies the texture subresource.
See also
GetMemoryFootprint(const Format, std::uint64_t)
Texture::GetMemoryFootprint
Texture::GetMipExtent
Texture::GetFormat

◆ GetMipExtent() [1/2]

LLGL_EXPORT Extent3D LLGL::GetMipExtent ( const TextureDescriptor & textureDesc,
std::uint32_t mipLevel = 0 )

Returns the MIP-map extent (including array layers) for the specified texture descriptor.

Parameters
[in]textureDescSpecifies the texture descriptor.
[in]mipLevelSpecifies the MIP-map level whose extent is to be determined. The first and largest MIP-map level has index zero.
See also
Texture::GetMipExtent
TextureDescriptor::extent
TextureDescriptor::arrayLayers

◆ GetMipExtent() [2/2]

LLGL_EXPORT Extent3D LLGL::GetMipExtent ( const TextureType type,
const Extent3D & extent,
std::uint32_t mipLevel )

Returns the MIP-map extent (including array layers) for the specified texture type, or an empty extent if mipLevel is out of bounds (see NumMipLevels).

Parameters
[in]typeSpecifies the texture type for which the MIP-map extent is to be determined.
[in]extentSpecifies the extent of the first MIP-map level.
[in]mipLevelSpecifies the MIP-map level whose extent is to be determined. The first and largest MIP-map level has index zero.
See also
Texture::GetMipExtent
TextureDescriptor::extent
NumMipLevels(const TextureType, const Extent3D&)

◆ IsArrayTexture()

LLGL_EXPORT bool LLGL::IsArrayTexture ( const TextureType type)

Returns true if the specified texture type is an array texture.

Returns
True if type is either TextureType::Texture1DArray, TextureType::Texture2DArray, TextureType::TextureCubeArray, or TextureType::Texture2DMSArray.

◆ IsCubeTexture()

LLGL_EXPORT bool LLGL::IsCubeTexture ( const TextureType type)

Returns true if the specified texture type is a cube texture.

Returns
True if type is either TextureType::TextureCube or TextureType::TextureCubeArray.

◆ IsMipMappedTexture()

LLGL_EXPORT bool LLGL::IsMipMappedTexture ( const TextureDescriptor & textureDesc)

Returns true if the specified texture descriptor describes a texture with MIP-mapping enabled.

Returns
True if the texture type is not a multi-sampled texture and the number of MIP-map levels in the descriptor is either zero or greater than one.
See also
TextureDescriptor::mipLevels

◆ IsMultiSampleTexture()

LLGL_EXPORT bool LLGL::IsMultiSampleTexture ( const TextureType type)

Returns true if the specified texture type is a multi-sample texture.

Returns
True if type is either TextureType::Texture2DMS, or TextureType::Texture2DMSArray.

◆ IsTextureSwizzleIdentity()

LLGL_EXPORT bool LLGL::IsTextureSwizzleIdentity ( const TextureSwizzleRGBA & swizzle)

Returns true if the specified texture swizzling is equal to the identity mapping.

Returns
True if the components are mapped as follows:
See also
TextureSwizzle

◆ NumMipDimensions()

LLGL_EXPORT std::uint32_t LLGL::NumMipDimensions ( const TextureType type)

Returns the number of MIP-map dimensions for the specified texture type. This is either 1, 2, 3, or 0 if the input is invalid.

Remarks
MIP-map dimensions do count array layers as a dimension, e.g. for TextureType::Texture2DArray this function returns 3.
See also
Texture::GetMipExtent
NumTextureDimensions

◆ NumMipLevels() [1/3]

LLGL_EXPORT std::uint32_t LLGL::NumMipLevels ( const TextureDescriptor & textureDesc)

Returns the number of MIP-map levels for the specified texture descriptor.

Parameters
[in]textureDescSpecifies the descriptor whose parameters are used to determine the number of MIP-map levels.
Remarks
This function will deduce the number MIP-map levels automatically only if the member mipLevels is zero. Otherwise, the value of this member is returned.
See also
NumMipLevels(const TextureType, const Extent3D&)

◆ NumMipLevels() [2/3]

LLGL_EXPORT std::uint32_t LLGL::NumMipLevels ( const TextureType type,
const Extent3D & extent )

Returns the number of MIP-map levels for the specified texture attributes.

Parameters
[in]typeSpecifies the texture type for which the MIP-map extent is to be determined.
[in]extentSpecifies the extent of the first MIP-map level.
See also
NumMipLevels(std::uint32_t, std::uint32_t, std::uint32_t)

◆ NumMipLevels() [3/3]

LLGL_EXPORT std::uint32_t LLGL::NumMipLevels ( std::uint32_t width,
std::uint32_t height = 1,
std::uint32_t depth = 1 )

Returns the number of MIP-map levels for a texture with the specified size.

Parameters
[in]widthSpecifies the texture width.
[in]heightSpecifies the texture height or number of layers for 1D array textures. By default 1 (if 1D textures are used).
[in]depthSpecifies the texture depth or number of layers for 2D array textures. By default 1 (if 1D or 2D textures are used).
Remarks
The height and depth are optional parameters, so this function can be easily used for 1D, 2D, and 3D textures.
Returns
\(\left\lfloor 1 + log_2\left(\max\left\{ \texttt{width}, \texttt{height}, \texttt{depth} \right\} \right) \right\rfloor\)

◆ NumMipTexels() [1/3]

LLGL_EXPORT std::uint32_t LLGL::NumMipTexels ( const TextureDescriptor & textureDesc,
std::uint32_t mipLevel = ~0u )

Returns the number of texture elements (texels) for the specified texture descriptor.

Parameters
[in]textureDescSpecifies the texture descriptor for which the number of MIP-map texels are determined.
[in]mipLevelOptional parameter to specify only a single MIP-map level. If this is 0xFFFFFFFF, the number of texels for the entire MIP-map chain is determined. By default 0xFFFFFFFF. The size of the MIP-map chain is determined by textureDesc.mipLevels.
See also
NumMipTexels(const TextureType, const Extent3D&, std::uint32_t)
TextureDescriptor::mipLevels

◆ NumMipTexels() [2/3]

LLGL_EXPORT std::uint32_t LLGL::NumMipTexels ( const TextureType type,
const Extent3D & extent,
const TextureSubresource & subresource )

Returns the number of texture elements (texels) for the specified texture subresource range.

Parameters
[in]typeSpecifies the texture type for which the number of texels are to be determined.
[in]extentSpecifies the extent of the first MIP-map level.
[in]subresourceSpecifies the subresource range. Which dimension in extent specifies the number of array layers depends on the texture type.
See also
TextureDescriptor::arrayLayers
TextureSubresource::baseArrayLayer
TextureSubresource::numArrayLayers
NumMipTexels(const TextureType, const Extent3D&, std::uint32_t)

◆ NumMipTexels() [3/3]

LLGL_EXPORT std::uint32_t LLGL::NumMipTexels ( const TextureType type,
const Extent3D & extent,
std::uint32_t mipLevel )

Returns the number of texture elements (texels) for the specified texture attributes, or zero extent if mipLevel is out of bounds (see NumMipLevels).

Parameters
[in]typeSpecifies the texture type for which the number of texels are to be determined.
[in]extentSpecifies the extent of the first MIP-map level.
[in]mipLevelSpecifies the MIP-map level whose number of texels is to be determined. The first and largest MIP-map level has index zero.
See also
TextureDescriptor::type
NumMipLevels(const TextureType, const Extent3D&)

◆ NumTextureDimensions()

LLGL_EXPORT std::uint32_t LLGL::NumTextureDimensions ( const TextureType type)

Returns the number of texture dimensions for the specified texture type. This is either 1, 2, 3, or 0 if the input is invalid.

Remarks
Texture dimensions don't count array layers as a dimension, e.g. for TextureType::Texture2DArray this function returns 2.
See also
TextureDescriptor::extent
NumMipDimensions