Skip to content

A Rust macro for including shader files as string with dependencies support.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

adrienblanchard/include-shader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

include-shader

A Rust macro for including shader files as string with dependencies support.

Setup

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.

Nightly toolchain (recommended)

For the best experience, use nightly to gain access to extra features:

  • File tracking
  • Relative path resolution

Add the following to your Cargo.toml manifest file:

[dependencies]
include-shader = { version = "0.2.0", features = ["relative-path", "track-path"] }

Stable toolchain

Add the following to your Cargo.toml manifest file:

[dependencies]
include-shader = "0.2.0"

Example

use include_shader::include_shader;

fn main() {
   // ...
   let frag_shader = compile_shader(
       &context,
       WebGl2RenderingContext::FRAGMENT_SHADER,
       include_shader!("src/shaders/fragment_shader.glsl"),
   )?;
   // ...
}

Documentation

For more details on how to use this macro, see the documentation.

License

Distributed under the terms of both the MIT license and the Apache License (Version 2.0).

Contribution

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.

About

A Rust macro for including shader files as string with dependencies support.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks