librashader_capi/
version.rs

1//! librashader instance version helpers.
2
3/// API version type alias.
4pub type LIBRASHADER_API_VERSION = usize;
5/// ABI version type alias.
6pub type LIBRASHADER_ABI_VERSION = usize;
7
8/// The current version of the librashader API.
9/// Pass this into `version` for config structs.
10///
11/// API versions are backwards compatible. It is valid to load
12/// a librashader C API instance for all API versions less than
13/// or equal to LIBRASHADER_CURRENT_VERSION, and subsequent API
14/// versions must remain backwards compatible.
15/// ## API Versions
16/// - API version 0: 0.1.0
17/// - API version 1: 0.2.0
18///     - Added rotation, total_subframes, current_subframes to frame options
19///     - Added preset context API
20///     - Added Metal runtime API
21/// - API version 2: 0.6.0
22///     - Added original aspect uniforms
23///     - Added frame time uniforms
24pub const LIBRASHADER_CURRENT_VERSION: LIBRASHADER_API_VERSION = 2;
25
26/// The current version of the librashader ABI.
27/// Used by the loader to check ABI compatibility.
28///
29/// ABI version 0 is reserved as a sentinel value.
30///
31/// ABI versions are not backwards compatible. It is not
32/// valid to load a librashader C API instance for any ABI
33/// version not equal to LIBRASHADER_CURRENT_ABI.
34///
35/// ## ABI Versions
36/// - ABI version 0: null instance (unloaded)
37/// - ABI version 1: 0.1.0
38/// - ABI version 2: 0.5.0
39///     - Reduced texture size information needed for some runtimes.
40///     - Removed wrapper structs for Direct3D 11 SRV and RTV handles.
41///     - Removed `gl_context_init`.
42///     - Make viewport handling consistent across runtimes, which are now
43///       span the output render target if omitted.
44pub const LIBRASHADER_CURRENT_ABI: LIBRASHADER_ABI_VERSION = 2;
45
46/// Function pointer definition for libra_abi_version
47pub type PFN_libra_instance_abi_version = extern "C" fn() -> LIBRASHADER_ABI_VERSION;
48/// Get the ABI version of the loaded instance.
49#[no_mangle]
50pub extern "C" fn libra_instance_abi_version() -> LIBRASHADER_ABI_VERSION {
51    LIBRASHADER_CURRENT_ABI
52}
53
54/// Function pointer definition for libra_abi_version
55pub type PFN_libra_instance_api_version = extern "C" fn() -> LIBRASHADER_API_VERSION;
56/// Get the API version of the loaded instance.
57#[no_mangle]
58pub extern "C" fn libra_instance_api_version() -> LIBRASHADER_API_VERSION {
59    LIBRASHADER_CURRENT_VERSION
60}