Crates.io | include-shader |
lib.rs | include-shader |
version | 0.2.0 |
source | src |
created_at | 2022-10-11 02:20:30.375894 |
updated_at | 2023-03-25 23:39:56.984591 |
description | A macro for including shader files as string with dependencies support. |
homepage | |
repository | https://github.com/adrienblanchard/include-shader |
max_upload_size | |
id | 684986 |
size | 29,551 |
A Rust macro for including shader files as string with dependencies support.
Although this library works on stable
, detection of shader file changes is not guaranteed due to caching. Therefore, it is recommended to use nightly
along with the track-path
feature enabled until the track_path
API stabilizes.
For the best experience, use nightly
to gain access to extra features:
Add the following to your Cargo.toml
manifest file:
[dependencies]
include-shader = { version = "0.2.0", features = ["relative-path", "track-path"] }
Add the following to your Cargo.toml
manifest file:
[dependencies]
include-shader = "0.2.0"
use include_shader::include_shader;
fn main() {
// ...
let frag_shader = compile_shader(
&context,
WebGl2RenderingContext::FRAGMENT_SHADER,
include_shader!("src/shaders/fragment_shader.glsl"),
)?;
// ...
}
For more details on how to use this macro, see the documentation.
Distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.