include_shader!() { /* proc-macro */ }
Expand description

Compiles the given PICA200 shader using picasso and returns the compiled bytes directly as a &[u8] slice.

This is similar to the standard library’s include_bytes! macro, for which file paths are relative to the source file where the macro is invoked.

The compiled shader binary will be saved in the caller’s $OUT_DIR.

§Errors

This macro will fail to compile if the input is not a single string literal. In other words, inputs like concat!("foo", "/bar") are not supported.

§Example

use citro3d_macros::include_shader;

static SHADER_BYTES: &[u8] = include_shader!("../tests/integration.pica");

§Errors

The macro will fail to compile if the .pica file cannot be found, or contains picasso syntax errors.

static _ERROR: &[u8] = include_shader!("../tests/nonexistent.pica");
static _ERROR: &[u8] = include_shader!("../tests/bad-shader.pica");