basis_universal::transcoding

Enum TranscoderTextureFormat

Source
#[repr(i32)]
pub enum TranscoderTextureFormat {
Show 21 variants ETC1_RGB = 0, ETC2_RGBA = 1, BC1_RGB = 2, BC3_RGBA = 3, BC4_R = 4, BC5_RG = 5, BC7_RGBA = 6, PVRTC1_4_RGB = 8, PVRTC1_4_RGBA = 9, ASTC_4x4_RGBA = 10, ATC_RGB = 11, ATC_RGBA = 12, FXT1_RGB = 17, PVRTC2_4_RGB = 18, PVRTC2_4_RGBA = 19, ETC2_EAC_R11 = 20, ETC2_EAC_RG11 = 21, RGBA32 = 13, RGB565 = 14, BGR565 = 15, RGBA4444 = 16,
}
Expand description

The texture format to transcode basis-universal data into

Variants§

§

ETC1_RGB = 0

Opaque only, returns RGB or alpha data if cDecodeFlagsTranscodeAlphaDataToOpaqueFormats flag is specified

§

ETC2_RGBA = 1

Opaque+alpha, ETC2_EAC_A8 block followed by a ETC1 block, alpha channel will be opaque for opaque .basis files

§

BC1_RGB = 2

Opaque only, no punchthrough alpha support yet, transcodes alpha slice if cDecodeFlagsTranscodeAlphaDataToOpaqueFormats flag is specified

§

BC3_RGBA = 3

Opaque+alpha, BC4 followed by a BC1 block, alpha channel will be opaque for opaque .basis files

§

BC4_R = 4

Red only, alpha slice is transcoded to output if cDecodeFlagsTranscodeAlphaDataToOpaqueFormats flag is specified

§

BC5_RG = 5

XY: Two BC4 blocks, X=R and Y=Alpha, .basis file should have alpha data (if not Y will be all 255’s)

§

BC7_RGBA = 6

RGB or RGBA, mode 5 for ETC1S, modes (1,2,3,5,6,7) for UASTC

§

PVRTC1_4_RGB = 8

Opaque only, RGB or alpha if cDecodeFlagsTranscodeAlphaDataToOpaqueFormats flag is specified, nearly lowest quality of any texture format.

§

PVRTC1_4_RGBA = 9

Opaque+alpha, most useful for simple opacity maps. If .basis file doesn’t have alpha cTFPVRTC1_4_RGB will be used instead. Lowest quality of any supported texture format.

§

ASTC_4x4_RGBA = 10

Opaque+alpha, ASTC 4x4, alpha channel will be opaque for opaque .basis files. Transcoder uses RGB/RGBA/L/LA modes, void extent, and up to two ([0,47] and [0,255]) endpoint precisions.

§

ATC_RGB = 11

Opaque, RGB or alpha if cDecodeFlagsTranscodeAlphaDataToOpaqueFormats flag is specified. ATI ATC (GL_ATC_RGB_AMD)

§

ATC_RGBA = 12

Opaque+alpha, alpha channel will be opaque for opaque .basis files. ATI ATC (GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD)

§

FXT1_RGB = 17

Opaque only, uses exclusively CC_MIXED blocks. Notable for having a 8x4 block size. GL_3DFX_texture_compression_FXT1 is supported on Intel integrated GPU’s (such as HD 630). Punch-through alpha is relatively easy to support, but full alpha is harder. This format is only here for completeness so opaque-only is fine for now. See the BASISU_USE_ORIGINAL_3DFX_FXT1_ENCODING macro in basisu_transcoder_internal.h.

§

PVRTC2_4_RGB = 18

Opaque-only, almost BC1 quality, much faster to transcode and supports arbitrary texture dimensions (unlike PVRTC1 RGB).

§

PVRTC2_4_RGBA = 19

Opaque+alpha, slower to encode than cTFPVRTC2_4_RGB. Premultiplied alpha is highly recommended, otherwise the color channel can leak into the alpha channel on transparent blocks.

§

ETC2_EAC_R11 = 20

R only (ETC2 EAC R11 unsigned)

§

ETC2_EAC_RG11 = 21

RG only (ETC2 EAC RG11 unsigned), R=opaque.r, G=alpha - for tangent space normal maps

§

RGBA32 = 13

32bpp RGBA image stored in raster (not block) order in memory, R is first byte, A is last byte.

§

RGB565 = 14

16bpp RGB image stored in raster (not block) order in memory, R at bit position 11

§

BGR565 = 15

16bpp RGB image stored in raster (not block) order in memory, R at bit position 0

§

RGBA4444 = 16

16bpp RGBA image stored in raster (not block) order in memory, R at bit position 12, A at bit position 0

Implementations§

Source§

impl TranscoderTextureFormat

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. NOTE: Previously, this function was called basis_get_bytes_per_block(), and it always returned 16*bytes_per_pixel for uncompressed formats which was confusing.

Source

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

Returns format’s name in ASCII

Source

pub fn has_alpha(self) -> bool

Returns true if the format supports an alpha channel.

Source

pub fn is_compressed(self) -> bool

Returns true if the transcoder texture type is a compressed format.

Source

pub fn uncompressed_bytes_per_pixel(self) -> u32

Returns the # of bytes per pixel for uncompressed formats, or 0 for block texture formats.

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 can_transcode_from_format( self, basis_texture_format: BasisTextureFormat, ) -> bool

Returns true if the specified format was enabled at compile time.

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

Source

pub fn validate_output_buffer_size( self, output_blocks_buf_size_in_blocks_or_pixels: u32, 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>, ) -> bool

Verify that the buffer size is large enough for the transcoded data

Trait Implementations§

Source§

impl Clone for TranscoderTextureFormat

Source§

fn clone(&self) -> TranscoderTextureFormat

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 TranscoderTextureFormat

Source§

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

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

impl From<i32> for TranscoderTextureFormat

Source§

fn from(value: basist_transcoder_texture_format) -> Self

Converts to this type from the input type.
Source§

impl Into<i32> for TranscoderTextureFormat

Source§

fn into(self) -> basist_transcoder_texture_format

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

impl PartialEq for TranscoderTextureFormat

Source§

fn eq(&self, other: &TranscoderTextureFormat) -> 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 TranscoderTextureFormat

Source§

impl StructuralPartialEq for TranscoderTextureFormat

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.