Example Usage
use rspirv::binary::Assemble;
use rspirv::binary::Disassemble;
fn main() {
// Building
let mut b = rspirv::dr::Builder::new();
b.set_version(1, 0);
b.capability(spirv::Capability::Shader);
b.memory_model(spirv::AddressingModel::Logical, spirv::MemoryModel::GLSL450);
let void = b.type_void();
let voidf = b.type_function(void, vec![]);
let fun = 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();
b.entry_point(spirv::ExecutionModel::Vertex, fun, "foo", vec![]);
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::dr::Loader::new();
rspirv::binary::parse_words(&code, &mut loader).unwrap();
let module = loader.module();
// Disassembling
assert_eq!(
module.disassemble(),
"; SPIR-V\n\
; Version: 1.0\n
See also
-SKYNET-Steam-Emulator
Open Source
Client emulator to play steam games on LAN without Internet connection.…
PS2Recomp
Open Source
Playstation 2 Static Recompiler & Runtime Tool to make native PC ports…
GH-Offset-Dumper
Free
Scan signatures and netvars. Dumps header files, cheat tables and ReClass files.…
.NET-Obfuscator
Open Source
Lists of .NET Obfuscator (Free, Freemium, Paid and Open Source )…
bddisasm
Open Source
bddisasm is a fast, lightweight, x86/x64 instruction decoder. The project also features a fast, bas…
ret-sync
Open Source
ret-sync is a set of plugins that helps to synchronize a debugging session (WinDbg/GDB/LLDB/OllyDbg2…