kronos_compute/
lib.rs

1//! Kronos - A compute-only Vulkan implementation in Rust
2//! 
3//! This crate provides a streamlined, compute-focused subset of the Vulkan API,
4//! removing all graphics functionality to achieve maximum GPU compute performance.
5//!
6//! # Important: Linking Considerations
7//! 
8//! When using Kronos with the `implementation` feature, do NOT link to system Vulkan.
9//! Kronos provides its own Vulkan implementation. Linking to both will cause symbol
10//! conflicts where system Vulkan functions may be called instead of Kronos functions,
11//! breaking multi-GPU support.
12//!
13//! If you see `ErrorInitializationFailed` but don't see "KRONOS vkCreateBuffer called"
14//! in logs, your application is likely using system Vulkan instead of Kronos.
15
16#![allow(non_camel_case_types)]
17#![allow(non_snake_case)]
18
19pub mod core;
20pub mod sys;
21pub mod ffi;
22
23// Unified safe API
24pub mod api;
25
26#[cfg(feature = "implementation")]
27pub mod implementation;
28
29// Re-export commonly used items
30pub use core::*;
31pub use sys::*;
32pub use ffi::*;
33
34// When implementation feature is enabled, export all implementation functions
35// This MUST come after other exports to ensure our functions take precedence
36#[cfg(feature = "implementation")]
37pub use implementation::{initialize_kronos};
38
39#[cfg(feature = "implementation")]
40pub use implementation::*;
41
42// Explicitly re-export key functions to ensure they're available
43#[cfg(feature = "implementation")]
44pub use implementation::{
45    vkCreateBuffer, vkDestroyBuffer, vkAllocateMemory, vkFreeMemory,
46    vkCreateDevice, vkDestroyDevice, vkCreateInstance, vkDestroyInstance,
47};
48
49// For libc types
50extern crate libc;
51
52/// Version information
53pub const KRONOS_VERSION_MAJOR: u32 = 0;
54pub const KRONOS_VERSION_MINOR: u32 = 1;
55pub const KRONOS_VERSION_PATCH: u32 = 0;
56
57/// Make version number from major, minor, and patch numbers
58#[inline]
59pub const fn make_version(major: u32, minor: u32, patch: u32) -> u32 {
60    (major << 22) | (minor << 12) | patch
61}
62
63/// Kronos API version
64pub const KRONOS_API_VERSION: u32 = make_version(
65    KRONOS_VERSION_MAJOR,
66    KRONOS_VERSION_MINOR,
67    KRONOS_VERSION_PATCH
68);
69
70#[cfg(test)]
71mod tests {
72    use super::*;
73
74    #[test]
75    fn test_version() {
76        assert_eq!(KRONOS_API_VERSION, make_version(0, 1, 0));
77    }
78}