Expand description
§Rust binding and wrappers for the Basis Universal pure C API.
Rust binding and wrappers for the basisu pure C API, through FFI on native and wasm-bindgen on web. See also https://github.com/BinomialLLC/basis_universal/wiki#encoder-and-transcoding-c-api-documentation.
This crate also contains optional high level API that is easier to use with wgpu-types. Enabling the extra cargo feature to use the high level BasisuEncoder and BasisuTranscoder.
This supports wasm32-unknown-unknown by bundling basisu wasm binary and wasm-bindgen. You need to have emscripten and cmake installed to build this crate.
instantiate_basisu_wasm(or instantiate_custom_basisu_wasm) function must be called before calling other functions.
Feature flags:
encoder: Enable basisu encoder, which will significantly increase the binary size. By default only transcoder is enabled.serde: Enableserdeon some structs.extra: Enable extra high level encoder and transcoder API that is easier to use withwgpu-types.
Feature flags to enable specific transcode target:
transcode_etc1s_bc3transcode_etc1s_bc1transcode_etc1s_bc4_5transcode_etc1s_bc7transcode_etc1s_etc2transcode_uastctranscode_uastc_hdrtranscode_xuastctranscode_astc
It’s recommended to disable unused targets (especially for ETC1S) to reduce binary size.
PVRTC1, ATC, FXT1, PVRTC2 are always disabled since they are rarely used. Note: Some combinations may fail to compile due to upstream bugs.
Modules§
- common
- encoder
encoder - extra
extra - transcoder
Structs§
Enums§
- Basis
Texture Format - A enum that wraps
common::BTF_*. - Transcode
Target Format - A enum that wraps
common::TF_*.
Functions§
- copy_
basisu_ ⚠memory_ to_ host - Use this to copy memory between host and basisu. This is required on web where memory isn’t shared.
- copy_
host_ ⚠memory_ to_ basisu - Use this to copy memory between host and basisu. This is required on web where memory isn’t shared.
- instantiate_
basisu_ wasm target_os=unknownandtarget_vendor=unknownand WebAssembly - Instantiate the basisu wasm, required on web before calling other functions.
- instantiate_
custom_ basisu_ wasm target_os=unknownandtarget_vendor=unknownand WebAssembly - Instantiate the you custom basisu wasm, required on web before calling other functions. The wasm must be compatible with basisu C API.