librashader/librashader-capi/src/version.rs

46 lines
1.7 KiB
Rust
Raw Normal View History

//! librashader instance version helpers.
/// API version type alias.
pub type LIBRASHADER_API_VERSION = usize;
pub type LIBRASHADER_ABI_VERSION = usize;
/// The current version of the librashader API.
/// Pass this into `version` for config structs.
///
/// API versions are backwards compatible. It is valid to load
/// a librashader C API instance for all API versions less than
/// or equal to LIBRASHADER_CURRENT_VERSION, and subsequent API
/// versions must remain backwards compatible.
/// ## API Versions
/// - API version 0: 0.1.0
pub const LIBRASHADER_CURRENT_VERSION: LIBRASHADER_API_VERSION = 0;
/// The current version of the librashader ABI.
/// Used by the loader to check ABI compatibility.
///
/// ABI version 0 is reserved as a sentinel value.
///
/// ABI versions are not backwards compatible. It is not
/// valid to load a librashader C API instance for any ABI
/// version not equal to LIBRASHADER_CURRENT_ABI.
/// ## ABI Versions
/// - ABI version 0: null instance (unloaded)
/// - ABI version 1: 0.1.0
pub const LIBRASHADER_CURRENT_ABI: LIBRASHADER_ABI_VERSION = 1;
/// Function pointer definition for libra_abi_version
pub type PFN_libra_instance_abi_version = extern "C" fn() -> LIBRASHADER_ABI_VERSION;
/// Get the ABI version of the loaded instance.
#[no_mangle]
pub extern "C" fn libra_instance_abi_version() -> LIBRASHADER_ABI_VERSION {
LIBRASHADER_CURRENT_ABI
}
/// Function pointer definition for libra_abi_version
pub type PFN_libra_instance_api_version = extern "C" fn() -> LIBRASHADER_API_VERSION;
/// Get the API version of the loaded instance.
#[no_mangle]
pub extern "C" fn libra_instance_api_version() -> LIBRASHADER_API_VERSION {
LIBRASHADER_CURRENT_VERSION
}