| Crates.io | raw-gpu-handle |
| lib.rs | raw-gpu-handle |
| version | 0.0.1 |
| created_at | 2025-10-15 19:57:12.267108+00 |
| updated_at | 2025-10-15 19:57:12.267108+00 |
| description | GPU API object interoperability crate |
| homepage | |
| repository | https://github.com/inner-daemons/raw-gpu-handle |
| max_upload_size | |
| id | 1884878 |
| size | 4,523 |
raw-gpu-handle: a GPU API object interoperability libraryThis library provides standard types for sharing GPU objects across APIs, such as Vulkan, DirectX, Cuda, and Metal. It also provides safety mechanisms to ensure that objects are reconstructed properly across API boundaries. The goal of the library is to ease interoperability between devices within a single process rather than between processes.
Note that sharing GPU objects is always unsafe. Lifetime requirements for example cannot be enforced across APIs by this crate. The sender of objects cannot verify that the receiver will behave properly, and vice versa. raw-gpu-handle shouldn't be used in security critical applications.
All safety mechanisms are simply rules that other libraries must follow. The raw-gpu-handle crate does not itself do any checks.
All reconstructed objects must be reconstructed by the same driver. That means a semaphore created by an integrated device driver cannot be imported into a discrete or virtual device driver.
Semaphores are the simplest objects. In order to be used properly, the semaphores must only be signalled on the device-side. Additionally, they must be timeline semaphores.
Because some objects may share the same memory object, memory is exported separately from objects (this is ignored on metal). Therefore, when buffers or textures are being exported, not only is the memory object needed, but also an offset and size.
When reconstructing objects, it must be in the same memory heap and memory type.
Buffers require information about the alignment guarantees of the allocated object.
When reconstructing textures, more information is required. The texture format must match, as well texture type information (D2 vs D2array vs D3). Additionally, information about the memory alignment of rows/slices of textures must be given.
Aside from semaphores, resource transfers (such as between queue families in vulkan) must be done when sharing data. Image layout transitions must also be done properly.
Raw objects are shared using win32 handles. Supported APIs include Vulkan, DirectX, and Cuda.
Raw objects are shared using unix file descriptors (fd's). Supported APIs include Vulkan and Cuda.
Raw objects are shared using metal resource handles. Supported APIs include Metal and Vulkan.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.