LLGL 0.05 Beta
Loading...
Searching...
No Matches
Hardware format utility functions.

Functions

LLGL_EXPORT const FormatAttributes & LLGL::GetFormatAttribs (const Format format)
 Returns the attributes for the specified hardware format or a zero-initialized structure in case of an invalid argument.
LLGL_EXPORT std::uint32_t LLGL::ImageFormatSize (const ImageFormat imageFormat)
 Returns the size (in number of components) of the specified image format.
LLGL_EXPORT std::size_t LLGL::GetMemoryFootprint (const Format format, std::size_t numTexels)
 Returns the memory footprint (in bytes) of a texture or buffer with the specified hardware format and number of elements.
LLGL_EXPORT std::size_t LLGL::GetMemoryFootprint (const ImageFormat imageFormat, const DataType dataType, std::size_t numTexels)
 Returns the memory footprint (in bytes) of an image with the specified format, data type, and number of elements.
LLGL_EXPORT bool LLGL::IsCompressedFormat (const Format format)
 Returns true if the specified hardware format is a compressed format, e.g. Format::BC1UNorm, Format::BC2UNorm_sRGB, Format::BC4SNorm, etc.
LLGL_EXPORT bool LLGL::IsDepthOrStencilFormat (const Format format)
 Returns true if the specified hardware format is a depth or depth-stencil format, i.e. Format::D16UNorm, Format::D24UNormS8UInt, Format::D32Float, or Format::D32FloatS8X24UInt.
LLGL_EXPORT bool LLGL::IsDepthAndStencilFormat (const Format format)
 Returns true if the specified hardware format is a depth and stencil format, i.e. Format::D24UNormS8UInt or Format::D32FloatS8X24UInt.
LLGL_EXPORT bool LLGL::IsDepthOrStencilFormat (const ImageFormat imageFormat)
 Returns true if the specified color format is a depth-stencil format, i.e. either ImageFormat::Depth or ImageFormat::DepthStencil.
LLGL_EXPORT bool LLGL::IsDepthFormat (const Format format)
 Returns true if the specified hardware format is a depth format, i.e. Format::D16UNorm, Format::D24UNormS8UInt, Format::D32Float, or Format::D32FloatS8X24UInt.
LLGL_EXPORT bool LLGL::IsStencilFormat (const Format format)
 Returns true if the specified hardware format is a stencil format, i.e. Format::D24UNormS8UInt or Format::D32FloatS8X24UInt.
LLGL_EXPORT bool LLGL::IsColorFormat (const Format format)
 Returns true if the specified hardware format is a color format.
LLGL_EXPORT bool LLGL::IsNormalizedFormat (const Format format)
 Returns true if the specified hardware format is a normalized format (like Format::RGBA8UNorm, Format::R8SNorm etc.).
LLGL_EXPORT bool LLGL::IsIntegerFormat (const Format format)
 Returns true if the specified hardware format is a strict integer format (like Format::RGBA8UInt, Format::R8SInt etc.).
LLGL_EXPORT bool LLGL::IsFloatFormat (const Format format)
 Returns true if the specified hardware format is a strict floating-point format (like Format::RGBA32Float, Format::R32Float etc.).

Detailed Description

Function Documentation

◆ GetFormatAttribs()

LLGL_EXPORT const FormatAttributes & LLGL::GetFormatAttribs ( const Format format)

Returns the attributes for the specified hardware format or a zero-initialized structure in case of an invalid argument.

See also
FormatAttributes
Format

◆ GetMemoryFootprint() [1/2]

LLGL_EXPORT std::size_t LLGL::GetMemoryFootprint ( const Format format,
std::size_t numTexels )

Returns the memory footprint (in bytes) of a texture or buffer with the specified hardware format and number of elements.

Parameters
[in]formatSpecifies the hardware format.
[in]numTexelsSpecifies the number of elements that make up the memory footprint. For the DXT compressed formats, this must be a multiple of 16, since these formats compress images in 4x4 texel blocks.
Returns
The memory footprint size (in bytes), or zero if the input is invalid.
See also
GetMemoryFootprint(const TextureType, const Format, const Extent3D&, const TextureSubresource&)
Texture::GetMemoryFootprint

◆ GetMemoryFootprint() [2/2]

LLGL_EXPORT std::size_t LLGL::GetMemoryFootprint ( const ImageFormat imageFormat,
const DataType dataType,
std::size_t numTexels )

Returns the memory footprint (in bytes) of an image with the specified format, data type, and number of elements.

Parameters
[in]imageFormatSpecifies the image format.
[in]dataTypeSpecifies the data type of each pixel component.
[in]numTexelsSpecifies the number of elements that make up the memory footprint.

◆ ImageFormatSize()

LLGL_EXPORT std::uint32_t LLGL::ImageFormatSize ( const ImageFormat imageFormat)

Returns the size (in number of components) of the specified image format.

Parameters
[in]imageFormatSpecifies the image format.
Returns
Number of components of the specified image format, or 0 if imageFormat specifies a compressed color format.
Note
Compressed formats are not supported.
See also
IsCompressedFormat(const ImageFormat)
ImageFormat

◆ IsColorFormat()

LLGL_EXPORT bool LLGL::IsColorFormat ( const Format format)

Returns true if the specified hardware format is a color format.

Remarks
This is equivalent to (format != Format::Undefined && !IsDepthOrStencilFormat(format)).
See also
Format

◆ IsCompressedFormat()

LLGL_EXPORT bool LLGL::IsCompressedFormat ( const Format format)

Returns true if the specified hardware format is a compressed format, e.g. Format::BC1UNorm, Format::BC2UNorm_sRGB, Format::BC4SNorm, etc.

See also
Format

◆ IsDepthAndStencilFormat()

LLGL_EXPORT bool LLGL::IsDepthAndStencilFormat ( const Format format)

Returns true if the specified hardware format is a depth and stencil format, i.e. Format::D24UNormS8UInt or Format::D32FloatS8X24UInt.

See also
Format
IsDepthOrStencilFormat

◆ IsDepthFormat()

LLGL_EXPORT bool LLGL::IsDepthFormat ( const Format format)

Returns true if the specified hardware format is a depth format, i.e. Format::D16UNorm, Format::D24UNormS8UInt, Format::D32Float, or Format::D32FloatS8X24UInt.

See also
Format

◆ IsDepthOrStencilFormat() [1/2]

LLGL_EXPORT bool LLGL::IsDepthOrStencilFormat ( const Format format)

Returns true if the specified hardware format is a depth or depth-stencil format, i.e. Format::D16UNorm, Format::D24UNormS8UInt, Format::D32Float, or Format::D32FloatS8X24UInt.

See also
Format
IsDepthAndStencilFormat

◆ IsDepthOrStencilFormat() [2/2]

LLGL_EXPORT bool LLGL::IsDepthOrStencilFormat ( const ImageFormat imageFormat)

Returns true if the specified color format is a depth-stencil format, i.e. either ImageFormat::Depth or ImageFormat::DepthStencil.

See also
ImageFormat

◆ IsFloatFormat()

LLGL_EXPORT bool LLGL::IsFloatFormat ( const Format format)

Returns true if the specified hardware format is a strict floating-point format (like Format::RGBA32Float, Format::R32Float etc.).

Remarks
This does not include depth-stencil formats or compressed formats.
See also
IsDepthOrStencilFormat
IsCompressedFormat
Format

◆ IsIntegerFormat()

LLGL_EXPORT bool LLGL::IsIntegerFormat ( const Format format)

Returns true if the specified hardware format is a strict integer format (like Format::RGBA8UInt, Format::R8SInt etc.).

Remarks
Unlike FormatFlags::IsInteger, this does not include normalized integer formats such as Format::RGBA8UNorm. While these types use an integer type as input, they are normalized to a fractional number in the closed range [0, 1].
See also
IsNormalizedFormat
Format

◆ IsNormalizedFormat()

LLGL_EXPORT bool LLGL::IsNormalizedFormat ( const Format format)

Returns true if the specified hardware format is a normalized format (like Format::RGBA8UNorm, Format::R8SNorm etc.).

Remarks
This does not include depth-stencil formats or compressed formats.
See also
IsDepthOrStencilFormat
IsCompressedFormat
Format

◆ IsStencilFormat()

LLGL_EXPORT bool LLGL::IsStencilFormat ( const Format format)

Returns true if the specified hardware format is a stencil format, i.e. Format::D24UNormS8UInt or Format::D32FloatS8X24UInt.

See also
Format