Function rspirv::mr::load_bytes
[−]
[src]
pub fn load_bytes<T: AsRef<[u8]>>(binary: T) -> ParseResult<Module>
Loads the SPIR-V binary
into memory and returns a Module
.
Examples
use rspirv; use rspirv::binary::Disassemble; let buffer: Vec<u8> = vec![ // Magic number. Version number: 1.0. 0x03, 0x02, 0x23, 0x07, 0x00, 0x00, 0x01, 0x00, // Generator number: 0. Bound: 0. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Reserved word: 0. 0x00, 0x00, 0x00, 0x00, // OpMemoryModel. Logical. 0x0e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // GLSL450. 0x01, 0x00, 0x00, 0x00]; let dis = match rspirv::mr::load_bytes(buffer) { Ok(module) => module.disassemble(), Err(err) => format!("{}", err), }; assert_eq!(dis, "; SPIR-V\n\ ; Version: 1.1\n\ ; Generator: rspirv\n\ ; Bound: 0\n\ OpMemoryModel Logical GLSL450");