Skip to content

James2022-rgb/glslang-sys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust FFI bindings for glslang

Build License: MIT

Low-level, unsafe Rust bindings to the C interface of glslang, generated with rust-bindgen.

License

Refer to glslang's LICENSE.txt.

This crate is licensed under the MIT license.

Motivation

  • 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.

glslang Version

14.0.0 https://github.com/KhronosGroup/glslang/commit/a91631b260cba3f22858d6c6827511e636c2458a

Build target support

Windows Linux
x86_64-pc-windows-msvc ✅
aarch64-linux-android ✅
x86_64-unknown-linux-gnu ✅

Remarks

glslang is built with:

  • ENABLE_OPT=OFF
  • ENABLE_SPVREMAPPER=OFF
  • (Android) ANDROID_STL=c++_shared

Usage

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)

Building

glslang

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:

  1. Check out and build from source, if feature build-from-source is enabled. The repository and commit SHA are defined in known_good.json
  2. Use the prebuilt binaries in the prebuilt directory.

Building from source

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)

Using the prebuilt binaries

This is the default behavior when nothing is specified.

About

Unsafe Rust FFI bindings for glslang 🦀

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published