Low-level, unsafe Rust bindings to the C interface of glslang, generated with rust-bindgen.
Refer to glslang's LICENSE.txt.
This crate is licensed under the MIT license.
- shaderc-rs already exists, but it was found not to be straight-forward to build for Android.
- TimNN/glslang-sys hasn't been maintained since 2015.
14.0.0 https://github.com/KhronosGroup/glslang/commit/a91631b260cba3f22858d6c6827511e636c2458a
Windows | Linux | |
---|---|---|
x86_64-pc-windows-msvc | ✅ | |
aarch64-linux-android | ✅ | |
x86_64-unknown-linux-gnu | ✅ |
glslang is built with:
ENABLE_OPT=OFF
ENABLE_SPVREMAPPER=OFF
- (Android)
ANDROID_STL=c++_shared
Cargo.toml
:
[dependencies]
glslang-sys-2022 = { git = "https://github.com/James2022-rgb/glslang-sys" }
Rust code:
use glslang_sys_2022 as glslang_sys;
unsafe {
glslang_sys::glslang_initialize_process();
}
(WIP)
The C++ library glslang is required (though bindings are only provided for its C interface). The build script attempts to obtain the native glslang library binaries in the following order of preference:
- Check out and build from source, if feature
build-from-source
is enabled. The repository and commit SHA are defined in known_good.json - Use the prebuilt binaries in the prebuilt directory.
CMake and Python 3.x are required in addition to MSVC or Android NDK. Refer to the relevant section on glslang's README.md.
Build with feature build-from-source
, e.g.
cargo build --target x86_64-pc-windows-msvc --features build-from-source
(WIP)
This is the default behavior when nothing is specified.