Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zeozeozeo/nvflex-rs
Safe NVIDIA FleX bindings for Rust
https://github.com/zeozeozeo/nvflex-rs
bindings game-development nvidia nvidia-flex physics physics-3d physics-engine physics-simulation rust rust-lang safe-bindings
Last synced: 20 days ago
JSON representation
Safe NVIDIA FleX bindings for Rust
- Host: GitHub
- URL: https://github.com/zeozeozeo/nvflex-rs
- Owner: zeozeozeo
- License: bsl-1.0
- Created: 2023-08-06T07:08:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-30T07:15:30.000Z (over 1 year ago)
- Last Synced: 2024-01-26T05:42:50.863Z (11 months ago)
- Topics: bindings, game-development, nvidia, nvidia-flex, physics, physics-3d, physics-engine, physics-simulation, rust, rust-lang, safe-bindings
- Language: Rust
- Homepage:
- Size: 215 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Safe [NVIDIA FleX](https://developer.nvidia.com/flex) bindings for Rust
![License](https://img.shields.io/github/license/zeozeozeo/nvflex-rs)
![GitHub issues](https://img.shields.io/github/issues/zeozeozeo/nvflex-rs)
![GitHub pull requests](https://img.shields.io/github/issues-pr/zeozeozeo/nvflex-rs)
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/zeozeozeo/nvflex-rs/main)This is a collection of crates which provide safe idiomatic NVIDIA FleX bindings for Rust (`nvflex`), as well as raw bindings to the C++ FleX library (`nvflex-sys`).
## The `nvflex` crate
Provides safe idiomatic Rust bindings over NVIDIA FleX's C++ API.
By default, structs don't implement Send/Sync, but you can enable that functionality by enabling the `unsafe_send_sync` feature. Note that [FleX is NOT thread safe](https://gameworksdocs.nvidia.com/FleX/1.2/lib_docs/manual.html#threading), meaning only one thread should ever use the API at a time.
FleX is *not* open source, so you have to bundle the dynamic libraries with your executable. When building, this crate will copy the required libraries into the `target/debug` or `target/release` directory.
`Vector` is basically `NvFlexVector` from `NvFlexExt.h`, rewritten in Rust. It exists even if the `ext` feature is disabled.
To enable NVIDIA FleX extensions (NvFlexExt), enable the `ext` feature.
### Supported APIs
* On Windows: D3D11/D3D12/CUDA
* On Linux: only CUDA is supported
* On Android: only CUDA is supported (you need a Tegra GPU)## Fixme
We somehow need to make the `Solver` aware that the `Library` is destroyed
and it shouldn't call `NvFlexDestroySolver()` when it's dropped if `NvFlexShutdown()` already destroyed it.This means that right now, if you create a solver, it will only be destroyed when `Library` goes
out of scope.## The `nvflex-sys` crate
`nvflex-sys` provides raw NVIDIA FleX bindings for Rust, generated with [bindgen](https://github.com/rust-lang/rust-bindgen).
Note that some functions (`NvFlexMakePhaseWithChannels`, `NvFlexMakePhase`, `NvFlexMakeShapeFlagsWithChannels` and `NvFlexMakeShapeFlags`) are implemented in Rust, because they are defined inside the `NvFlex.h` header.
### TODO
* Proper comment formatting
# License
BSL-1.0.
* Note: NVIDIA FleX is licensed under the [Nvidia Source Code License](https://raw.githubusercontent.com/NVIDIAGameWorks/FleX/master/LICENSE.txt)