macro_rules! include_shader_code {
($file:expr $(,)?) => { ... };
}Expand description
A wrapper around include_bytes! that includes a SPIR-V bytecode buffer.
SPIR-V bytecode is required to be a sequence of 32-bit words, so this macro
enforces that the length of the included bytes is a multiple of 4 and stores
the included bytes in a #[repr(C, align(4))] struct before converting the
included bytes into a &[u32] to ensure valid alignment.
ยงExample
const vert_bytecode: &[u32] = include_shader_code!("../../examples/shaders/default/vert.spv");
let vert_info = vk::ShaderModuleCreateInfo::builder()
.code_size(vert_bytecode.len() * 4)
.code(vert_bytecode);