Crate astcenc_rs

Source
Expand description

§ASTC Encoding

This is a library to encode images as ASTC for use on a GPU with hardware compression support. It is implemented as bindings to ARM’s official astc-encoder library.

In order to use the images generated by this library directly on the GPU, you need ensure that the GPU you’re running on has support for ASTC, which can be queried with the Vulkan textureCompressionASTC_* flags (one flag for each of the modes in Profile).

Structs§

Config
Configuration for initializing Context, see ConfigBuilder for more information.
ConfigBuilder
Builder for the context configuration.
Context
The core context. All configuration should be done through this.
Extents
A 3-dimensional set of width, height and depth. ASTC supports 3D images, so we always have to specify the depth of an image.
Flags
Configuration flags for the context.
Image
The 3D image type. Each pixel should be RGBA. The data can be anything that dereferences to a flat array of color components, as long as the color components are in one of the supported formats. For HDR images, f32 or half::f16 must be used.
Preset
The performance preset, higher settings take more time but provide higher quality. It will not provide better compression at higher settings, compression is decided only by the block size.
Swizzle
A component selection swizzle. The image must always be in RGBA order, even if the G, B and/or A components are never used.

Enums§

Error
An error during initialization, compression or decompression.
Profile
The color profile. HDR and LDR SRGB require the image to use floats for its individual colors.
Selector
An individual component of a swizzle.
Type
Which of the supported subpixel types the image data’s subpixels should be interpreted as. Floating-point types must be used for HDR data.

Constants§

PRESET_EXHAUSTIVE
The exhaustive, highest quality, search preset.
PRESET_FAST
The fast search preset.
PRESET_FASTEST
The fastest, lowest quality, search preset.
PRESET_MEDIUM
The medium quality search preset.
PRESET_THOROUGH
The thorough quality search preset.
PRESET_VERY_THOROUGH
The thorough quality search preset.

Traits§

DataType
A valid type for a subpixel.