Crate tegra_swizzle

Crate tegra_swizzle 

Source
Expand description

§tegra_swizzle

tegra_swizzle is a CPU implementation of the Tegra X1 block linear memory tiling for texture surfaces.

§Getting Started

Tiled texture data in binary files is often stored in a single buffer containing all arrays and mipmaps. This memory layout can be untiled all at once using surface::deswizzle_surface.

§Block Linear Memory Tiling

The surface::swizzle_surface and surface::deswizzle_surface functions implement safe and efficient tiling and untiling for the Tegra X1’s block linear format.

Block linear arranges bytes of a texture surface into a 2D grid of blocks where blocks are arranged linearly in row-major order. The tiled surface size is padded to integral dimensions in blocks, so tiled surfaces may be larger than the corresponding data in row-major order.

Groups of 512 bytes form GOBs (“group of bytes”) where each GOB is 64x8 bytes. The block_height parameter determines how many GOBs stack vertically to form a block.

Modules§

ffi
Documentation for the C API.
surface
Functions for working with surfaces stored in a combined buffer for all array layers and mipmaps.
swizzle
Functions for tiling and untiling a single mipmap of a surface.

Enums§

BlockHeight
The height of each block in GOBs where each GOB is 8 bytes tall.
SwizzleError
Errors than can occur while tiling or untiling.

Functions§

block_height_mip0
Calculates the block height parameter to use for the first mip level if no block height is specified.
div_round_up
Calculates the division of x by d but rounds up rather than truncating.
mip_block_height
Calculates the block height parameter for the given mip level.