Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
shader-slang
Rust bindings for the Slang shader language compiler
Supports both the modern compilation and reflection API.
Currently mostly reflects the needs of our own engine but contributions are more than welcome.
Example
let global_session = new.unwrap;
let search_path = new.unwrap;
// All compiler options are available through this builder.
let session_options = default
.optimization
.matrix_layout_row;
let target_desc = default
.format
.profile;
let targets = ;
let search_paths = ;
let session_desc = default
.targets
.search_paths
.options;
let session = global_session.create_session.unwrap;
let module = session.load_module.unwrap;
let entry_point = module.find_entry_point_by_name.unwrap;
let program = session.create_composite_component_type.unwrap;
let linked_program = program.link.unwrap;
// Entry point to the reflection API.
let reflection = linked_program.layout.unwrap;
let shader_bytecode = linked_program.entry_point_code.unwrap;
Installation
Add shader-slang to the [dependencies] section of your Cargo.toml.
Point this library to a Slang installation. An easy way is by installing the LunarG Vulkan SDK which comes bundled with the Slang compiler. During installation VULKAN_SDK is added to the PATH and automatically picked up by this library.
Alternatively, download Slang from their releases page and manually set the SLANG_DIR environment variable to the path of your Slang directory. Copy slang.dll to your executable's directory. To compile to DXIL bytecode, also copy dxil.dll and dxcompiler.dll from the Microsoft DirectXShaderCompiler to your executable's directory.
To specify the include and lib directories separately, set the SLANG_INCLUDE_DIR and SLANG_LIB_DIR environment variables.
Credits
Maintained by Lauro Oyen (@laurooyen).
Licensed under MIT or Apache-2.0.