We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extern crate rspirv; extern crate spirv_headers as spirv; use rspirv::binary::Assemble; use rspirv::binary::Disassemble; fn main() { // Building let mut b = rspirv::mr::Builder::new(); b.memory_model(spirv::AddressingModel::Logical, spirv::MemoryModel::GLSL450); let void = b.type_void(); let voidf = b.type_function(void, vec![void]); b.begin_function(void, None, (spirv::FunctionControl::DONT_INLINE | spirv::FunctionControl::CONST), voidf) .unwrap(); b.begin_basic_block(None).unwrap(); b.ret().unwrap(); b.end_function().unwrap(); let module = b.module(); // Assembling let code = module.assemble(); assert!(code.len() > 20); // Module header contains 5 words assert_eq!(spirv::MAGIC_NUMBER, code[0]); // Parsing let mut loader = rspirv::mr::Loader::new(); rspirv::binary::parse_words(&code, &mut loader).unwrap(); let module = loader.module(); use std::io::Write; let mut f = std::fs::File::create("out.frag").unwrap(); let len = code[..].len() * 4; let buf = unsafe { std::slice::from_raw_parts(code[..].as_ptr() as *const u8, len) }; f.write(buf); }
gives the following error when spirv-val out.frag is run.
spirv-val out.frag
error: line 1: Operand 2 of MemoryModel requires one of these capabilities: Shader OpMemoryModel Logical GLSL450
The text was updated successfully, but these errors were encountered:
It seems like adding b.capability(spirv::Capability::Shader); should fix this.
b.capability(spirv::Capability::Shader);
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
gives the following error when
spirv-val out.frag
is run.The text was updated successfully, but these errors were encountered: