[−][src]Macro proc_spirv::spirv_from_file
spirv_from_file!() { /* proc-macro */ }
spirv_from_file!(ShaderKind, "file_path", "entry_point")
- ShaderKind is just the final variant bit of the
enum from the
shaderc
crate. So useFragment
, notShaderKind::Fragment
or anything else. Technically this just parses an Ident, so you actually don't even need theShaderKind
type to be in scope at all, you just write the name of one of those variants. - String literal containing the path to the shader source. This is passed directly to File::open. The "present working directory" for proc macros is the crate root, so relative paths should start from there.
- String literal for the name of the entry point of the shader module. By convention this is is usually "main", but do what you want.
Success produces a &[u8]
TokenStream. You probably want to assign this
into a const
somewhere in your program.
Like this:
#![feature(proc_macro_hygiene)] use proc_spirv::spirv_from_file; const FRAG_SPIRV: &[u8] = spirv_from_file!(Fragment, "tests/frag_glsl.frag", "main");