pub struct KhalBuilder { /* private fields */ }Expand description
Configures and runs the SPIR-V and PTX shader compilation pipeline.
Used in build.rs scripts to compile a shader crate before the host crate.
Implementations§
Source§impl KhalBuilder
impl KhalBuilder
Sourcepub fn new(
shader_crate: impl AsRef<Path>,
enable_builtin_features: bool,
) -> Self
pub fn new( shader_crate: impl AsRef<Path>, enable_builtin_features: bool, ) -> Self
Creates a new builder for the given shader crate directory.
If enable_builtin_features is true, platform-specific features are auto-detected.
Sourcepub fn from_dependency(links_name: &str, enable_builtin_features: bool) -> Self
pub fn from_dependency(links_name: &str, enable_builtin_features: bool) -> Self
Creates a new builder by locating the shader crate via cargo’s links
metadata mechanism.
links_name must match the links value declared in the shader
crate’s Cargo.toml. The shader crate’s build.rs must emit
cargo::metadata=manifest_dir=$CARGO_MANIFEST_DIR, and the host crate
must depend on the shader crate as a [build-dependencies] entry.
Cargo then exposes DEP_<LINKS>_MANIFEST_DIR to this build script,
which works identically for in-workspace path dependencies and for
versions fetched from a registry.
Sourcepub fn rust_min_stack(self, stack: u32) -> Self
pub fn rust_min_stack(self, stack: u32) -> Self
Sets the RUST_MIN_STACK environment variable for the shader compilation processes.
Sourcepub fn shader_src(self, src: impl AsRef<Path>) -> Self
pub fn shader_src(self, src: impl AsRef<Path>) -> Self
Overrides the shader source directory (defaults to <shader_crate>/src).