ReXGlue SDK
Loading...
Searching...
No Matches
rex::xenos::TextureInfo Struct Reference

#include <rex/xenos/texture.h>

Public Member Functions

const FormatInfo * GetFormatInfo () const
bool IsCompressed () const
u32 GetMipLevels () const
u32 GetMaxMipLevels () const
const TextureExtent GetMipExtent (u32 mip, bool is_guest) const
void GetMipSize (u32 mip, u32 *width, u32 *height) const
u32 GetMipLocation (u32 mip, u32 *offset_x, u32 *offset_y, bool is_guest) const
bool GetPackedMipOffset (u32 packed_tile, u32 *offset_x, u32 *offset_y) const
u64 Hash () const
bool operator== (const TextureInfo &other) const =default

Static Public Member Functions

static bool FromFetchConstant (const xenos::TextureFetch &fetch, TextureInfo *out_info)
static bool FromResolve (u32 physical_address, xenos::TextureFormat texture_format, xenos::Endian endian, u32 pitch, u32 width, u32 height, u32 depth, TextureInfo *out_info)
static bool GetPackedMipOffset (u32 width, u32 height, const FormatInfo *format_info, u32 packed_tile, u32 *offset_x, u32 *offset_y)

Public Attributes

xenos::TextureFormat format
xenos::Endian endianness
xenos::DataDimension dimension
u32 width_minus_1
u32 height_minus_1
u32 depth_or_array_size_minus_1
u32 pitch
u32 mip_min_level
u32 mip_max_level
bool is_stacked
bool is_tiled
bool has_packed_mips
TextureMemoryRanges memory
TextureExtent extent

Detailed Description

Texture description decoded from a fetch constant or a resolve.

Member Function Documentation

◆ FromFetchConstant()

bool rex::xenos::TextureInfo::FromFetchConstant ( const xenos::TextureFetch & fetch,
TextureInfo * out_info )
static

Decodes a texture description from a texture fetch constant.

Parameters
out_infoReceives the texture description.

◆ FromResolve()

bool rex::xenos::TextureInfo::FromResolve ( u32 physical_address,
xenos::TextureFormat texture_format,
xenos::Endian endian,
u32 pitch,
u32 width,
u32 height,
u32 depth,
TextureInfo * out_info )
static

Fills the texture info of a tiled 2D resolve destination with a single level.

Parameters
endianSwap mode of the texel data.
widthWidth in texels, at least 1.
heightHeight in texels, at least 1.
out_infoReceives the texture description.

◆ GetMaxMipLevels()

u32 rex::xenos::TextureInfo::GetMaxMipLevels ( ) const

Returns the mip level count of a full chain for the texture size.

◆ GetMipExtent()

const TextureExtent rex::xenos::TextureInfo::GetMipExtent ( u32 mip,
bool is_guest ) const

Returns the extent of a mip level.

Parameters
is_guestTrue for the padded guest layout with power of 2 mip sizes, false for packed.

◆ GetMipLocation()

u32 rex::xenos::TextureInfo::GetMipLocation ( u32 mip,
u32 * offset_x,
u32 * offset_y,
bool is_guest ) const

Returns the guest address of a mip level and its offset within a packed tile, or 0 when the texture has no mip data.

Parameters
offset_xReceives the X offset in blocks within a packed tile.
offset_yReceives the Y offset in blocks within a packed tile.
is_guestTrue for the padded guest memory layout, false for a packed host layout.

◆ GetMipSize()

void rex::xenos::TextureInfo::GetMipSize ( u32 mip,
u32 * width,
u32 * height ) const

Computes the size of a mip level in texels.

Parameters
widthReceives the width in texels, rounded to a power of 2 for levels above 0.
heightReceives the height in texels, rounded to a power of 2 for levels above 0.

◆ GetPackedMipOffset() [1/2]

bool rex::xenos::TextureInfo::GetPackedMipOffset ( u32 packed_tile,
u32 * offset_x,
u32 * offset_y ) const

Computes the block offset of a level of this texture within its packed tile.

Parameters
packed_tileIndex of the level within the packed tile.
offset_xReceives the X offset in blocks.
offset_yReceives the Y offset in blocks.
Returns
False when the texture has no packed mips or the level is not packed.

◆ GetPackedMipOffset() [2/2]

bool rex::xenos::TextureInfo::GetPackedMipOffset ( u32 width,
u32 height,
const FormatInfo * format_info,
u32 packed_tile,
u32 * offset_x,
u32 * offset_y )
static

Computes the block offset of a level within a packed tile.

Parameters
widthWidth of the packed level set in texels.
heightHeight of the packed level set in texels.
packed_tileIndex of the level within the packed tile.
offset_xReceives the X offset in blocks.
offset_yReceives the Y offset in blocks.
Returns
False when the level is too large to be packed, with both offsets set to 0.

◆ Hash()

u64 rex::xenos::TextureInfo::Hash ( ) const

Returns the 64 bit XXH3 hash of every field.

Member Data Documentation

◆ dimension

xenos::DataDimension rex::xenos::TextureInfo::dimension

Dimension, with 1D stored as 2D.

◆ extent

TextureExtent rex::xenos::TextureInfo::extent

Base level extent in the guest layout.

◆ has_packed_mips

bool rex::xenos::TextureInfo::has_packed_mips

True when small mips share a packed tile.

◆ is_stacked

bool rex::xenos::TextureInfo::is_stacked

True for a 2D array.


The documentation for this struct was generated from the following file: