This documents an old version of bs::framework. Click here to see the latest release.
TextureProperties Class Reference

Description

Properties of a Texture.

Shared between sim and core thread versions of a Texture.

Methods

 TextureProperties (const TEXTURE_DESC &desc)
 
TextureType getTextureType () const
 Gets the type of texture. More...
 
UINT32 getNumMipmaps () const
 Gets the number of mipmaps to be used for this texture. More...
 
bool isHardwareGammaEnabled () const
 Determines does the texture contain gamma corrected data. More...
 
UINT32 getNumSamples () const
 Gets the number of samples used for multisampling (0 or 1 if multisampling is not used). More...
 
UINT32 getHeight () const
 Returns the height of the texture. More...
 
UINT32 getWidth () const
 Returns the width of the texture. More...
 
UINT32 getDepth () const
 Returns the depth of the texture (only applicable for 3D textures). More...
 
int getUsage () const
 Returns a value that signals the engine in what way is the texture expected to be used. More...
 
PixelFormat getFormat () const
 Returns the pixel format for the texture surface. More...
 
bool hasAlpha () const
 Returns true if the texture has an alpha layer. More...
 
UINT32 getNumFaces () const
 Returns the number of faces this texture has. More...
 
UINT32 getNumArraySlices () const
 Returns the number of array slices of the texture (if the texture is an array texture). More...
 
SPtr< PixelDataallocBuffer (UINT32 face, UINT32 mipLevel) const
 Allocates a buffer that exactly matches the format of the texture described by these properties, for the provided face and mip level. More...
 

Method documentation

◆ allocBuffer()

SPtr<PixelData> allocBuffer ( UINT32  face,
UINT32  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.

Note
Thread safe.

◆ getDepth()

UINT32 getDepth ( ) const

Returns the depth of the texture (only applicable for 3D textures).

◆ getFormat()

PixelFormat getFormat ( ) const

Returns the pixel format for the texture surface.

◆ getHeight()

UINT32 getHeight ( ) const

Returns the height of the texture.

◆ getNumArraySlices()

UINT32 getNumArraySlices ( ) const

Returns the number of array slices of the texture (if the texture is an array texture).

◆ getNumFaces()

UINT32 getNumFaces ( ) 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.

◆ getNumMipmaps()

UINT32 getNumMipmaps ( ) const

Gets the number of mipmaps to be used for this texture.

This number excludes the top level map (which is always assumed to be present).

◆ getNumSamples()

UINT32 getNumSamples ( ) const

Gets the number of samples used for multisampling (0 or 1 if multisampling is not used).

◆ getTextureType()

TextureType getTextureType ( ) const

Gets the type of texture.

◆ getUsage()

int getUsage ( ) const

Returns a value that signals the engine in what way is the texture expected to be used.

◆ getWidth()

UINT32 getWidth ( ) const

Returns the width of the texture.

◆ hasAlpha()

bool hasAlpha ( ) const

Returns true if the texture has an alpha layer.

◆ isHardwareGammaEnabled()

bool isHardwareGammaEnabled ( ) const

Determines does the texture contain gamma corrected data.

If true then the GPU will automatically convert the pixels to linear space before reading from the texture, and convert them to gamma space when writing to the texture.

◆ mapFromSubresourceIdx()

void mapFromSubresourceIdx ( UINT32  subresourceIdx,
UINT32 &  face,
UINT32 &  mip 
) const
protected

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

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