basis_universal::transcoding

Enum TranscoderBlockFormat

Source
#[repr(i32)]
pub enum TranscoderBlockFormat {
Show 30 variants ETC1 = 0, ETC2_RGBA = 1, BC1 = 2, BC3 = 3, BC4 = 4, BC5 = 5, PVRTC1_4_RGB = 6, PVRTC1_4_RGBA = 7, BC7 = 8, BC7_M5_COLOR = 9, BC7_M5_ALPHA = 10, ETC2_EAC_A8 = 11, ASTC_4x4 = 12, ATC_RGB = 13, ATC_RGBA_INTERPOLATED_ALPHA = 14, FXT1_RGB = 15, PVRTC2_4_RGB = 16, PVRTC2_4_RGBA = 17, ETC2_EAC_R11 = 18, ETC2_EAC_RG11 = 19, Indices = 20, RGB32 = 21, RGBA32 = 22, A32 = 23, RGB565 = 24, BGR565 = 25, RGBA4444_COLOR = 26, RGBA4444_ALPHA = 27, RGBA4444_COLOR_OPAQUE = 28, RGBA4444 = 29,
}
Expand description

The block format to transcode universal texture data into

Variants§

§

ETC1 = 0

ETC1S RGB

§

ETC2_RGBA = 1

full ETC2 EAC RGBA8 block

§

BC1 = 2

DXT1 RGB

§

BC3 = 3

BC4 block followed by a four color BC1 block

§

BC4 = 4

DXT5A (alpha block only)

§

BC5 = 5

two BC4 blocks

§

PVRTC1_4_RGB = 6

opaque-only PVRTC1 4bpp

§

PVRTC1_4_RGBA = 7

PVRTC1 4bpp RGBA

§

BC7 = 8

Full BC7 block, any mode

§

BC7_M5_COLOR = 9

RGB BC7 mode 5 color (writes an opaque mode 5 block)

§

BC7_M5_ALPHA = 10

alpha portion of BC7 mode 5 (cBC7_M5_COLOR output data must have been written to the output buffer first to set the mode/rot fields etc.)

§

ETC2_EAC_A8 = 11

alpha block of ETC2 EAC (first 8 bytes of the 16-bit ETC2 EAC RGBA format)

§

ASTC_4x4 = 12

ASTC 4x4 (either color-only or color+alpha). Note that the transcoder always currently assumes sRGB is not enabled when outputting ASTC data. If you use a sRGB ASTC format you’ll get ~1 LSB of additional error, because of the different way ASTC decoders scale 8-bit endpoints to 16-bits during unpacking.

§

ATC_RGB = 13

§

ATC_RGBA_INTERPOLATED_ALPHA = 14

§

FXT1_RGB = 15

Opaque-only, has oddball 8x4 pixel block size

§

PVRTC2_4_RGB = 16

§

PVRTC2_4_RGBA = 17

§

ETC2_EAC_R11 = 18

§

ETC2_EAC_RG11 = 19

§

Indices = 20

Used internally: Write 16-bit endpoint and selector indices directly to output (output block must be at least 32-bits)

§

RGB32 = 21

Writes RGB components to 32bpp output pixels

§

RGBA32 = 22

Writes RGB255 components to 32bpp output pixels

§

A32 = 23

Writes alpha component to 32bpp output pixels

§

RGB565 = 24

§

BGR565 = 25

§

RGBA4444_COLOR = 26

§

RGBA4444_ALPHA = 27

§

RGBA4444_COLOR_OPAQUE = 28

§

RGBA4444 = 29

Implementations§

Source§

impl TranscoderBlockFormat

Source

pub fn bytes_per_block_or_pixel(self) -> u32

For compressed texture formats, this returns the # of bytes per block. For uncompressed, it returns the # of bytes per pixel.

Source

pub fn format_name(self) -> &'static str

Returns format’s name in ASCII

Source

pub fn is_compressed(self) -> bool

Returns true if the block format is a compressed format.

Source

pub fn block_width(self) -> u32

Returns the block width for the specified texture format, which is currently either 4 or 8 for FXT1.

Source

pub fn block_height(self) -> u32

Returns the block height for the specified texture format, which is currently always 4.

Source

pub fn calculate_minimum_output_buffer_blocks_or_pixels( self, original_width: u32, original_height: u32, total_slice_blocks: u32, output_row_pitch_in_blocks_or_pixels: Option<u32>, output_rows_in_pixels: Option<u32>, ) -> u32

Calculate the minimum output buffer required to store transcoded data in blocks for compressed formats and pixels for uncompressed formats

Source

pub fn calculate_minimum_output_buffer_bytes( self, original_width: u32, original_height: u32, total_slice_blocks: u32, output_row_pitch_in_blocks_or_pixels: Option<u32>, output_rows_in_pixels: Option<u32>, ) -> u32

Calculate the minimum output buffer required to store transcoded data in bytes

Trait Implementations§

Source§

impl Clone for TranscoderBlockFormat

Source§

fn clone(&self) -> TranscoderBlockFormat

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TranscoderBlockFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<i32> for TranscoderBlockFormat

Source§

fn from(value: basist_block_format) -> Self

Converts to this type from the input type.
Source§

impl Into<i32> for TranscoderBlockFormat

Source§

fn into(self) -> basist_block_format

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for TranscoderBlockFormat

Source§

fn eq(&self, other: &TranscoderBlockFormat) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TranscoderBlockFormat

Source§

impl StructuralPartialEq for TranscoderBlockFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.