Function ash::util::read_spv

source ·
pub fn read_spv<R: Read + Seek>(x: &mut R) -> Result<Vec<u32>>
Expand description

Decode SPIR-V from bytes.

This function handles SPIR-V of arbitrary endianness gracefully, and returns correctly aligned storage.

Examples

// Decode SPIR-V from a file
let mut file = std::fs::File::open("/path/to/shader.spv").unwrap();
let words = ash::util::read_spv(&mut file).unwrap();
// Decode SPIR-V from memory
const SPIRV: &[u8] = &[
    // ...
];
let words = ash::util::read_spv(&mut std::io::Cursor::new(&SPIRV[..])).unwrap();