struct TextureProperties

Inherits: TextureInformation

Properties of a Texture.

Shared between main and render thread counterparts of a Texture.

Public

Constructors

TextureProperties

TextureProperties() = default

TextureProperties

TextureProperties(const TextureCreateInformation &createInformation)

Methods

HasAlpha

bool HasAlpha() const

Returns true if the texture has an alpha layer.

GetFaceCount

u32 GetFaceCount() const

Returns the number of faces this texture has.

This includes array slices (if texture is an array texture), as well as cube-map faces.

AllocBuffer

SPtr<PixelData> AllocBuffer(u32 face, u32 mipLevel) const

Allocates a buffer that exactly matches the format of the texture described by these properties, for the provided face and mip level.

This is a helper function, primarily meant for creating buffers when reading from, or writing to a texture.

Fields

Name

String Name

Optional name of the texture.

Used primarily for easier debugging.

Type

Type of the texture.

Format

Format of pixels in the texture.

Width

u32 Width

Width of the texture in pixels.

Height

u32 Height

Height of the texture in pixels.

Depth

u32 Depth

Depth of the texture in pixels (Must be 1 for 2D textures).

MipMapCount

u32 MipMapCount

Number of mip-maps the texture has.

This number excludes the full resolution map.

Usage

TextureUsageFlags Usage

Describes how the caller plans on using the texture in the pipeline.

UseHardwareSRGB

bool UseHardwareSRGB

If true the texture data is assumed to be in SRGB space and will be converted back to linear space when sampled on GPU.

SampleCount

u32 SampleCount

Number of samples per pixel.

Set to 1 or 0 to use the default of a single sample per pixel.

ArraySliceCount

u32 ArraySliceCount

Number of texture slices to create if creating a texture array.

Ignored for 3D textures.

Protected

Methods

MapFromSubresourceIdx

void MapFromSubresourceIdx(u32 subresourceIdx, u32 &face, u32 &mip) const

Maps a sub-resource index to an exact face and mip level.

Sub-resource indexes are used when reading or writing to the resource.

MapToSubresourceIdx

u32 MapToSubresourceIdx(u32 face, u32 mip) const

Map a face and a mip level to a sub-resource index you can use for updating or reading a specific sub-resource.