mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 06:45:13 +00:00
Add binary back
This commit is contained in:
parent
e26d1a7616
commit
3bba335477
@ -24,9 +24,9 @@ pub enum LinkerError {
|
||||
Unknown,
|
||||
}
|
||||
|
||||
type Result<T> = std::result::Result<T, LinkerError>;
|
||||
pub type Result<T> = std::result::Result<T, LinkerError>;
|
||||
|
||||
fn load(bytes: &[u8]) -> rspirv::dr::Module {
|
||||
pub fn load(bytes: &[u8]) -> rspirv::dr::Module {
|
||||
let mut loader = rspirv::dr::Loader::new();
|
||||
rspirv::binary::parse_bytes(&bytes, &mut loader).unwrap();
|
||||
let module = loader.module();
|
||||
@ -838,21 +838,3 @@ pub fn link(inputs: &mut [&mut rspirv::dr::Module], opts: &Options) -> Result<rs
|
||||
// output the module
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let body1 = include_bytes!("../test/1/body_1.spv");
|
||||
let body2 = include_bytes!("../test/1/body_2.spv");
|
||||
|
||||
let mut body1 = load(&body1[..]);
|
||||
let mut body2 = load(&body2[..]);
|
||||
|
||||
let opts = Options {
|
||||
lib: false,
|
||||
partial: false,
|
||||
};
|
||||
|
||||
let output = link(&mut [&mut body1, &mut body2], &opts)?;
|
||||
println!("{}\n\n", output.disassemble());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
20
rspirv-linker/src/main.rs
Normal file
20
rspirv-linker/src/main.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use rspirv_linker::*;
|
||||
use rspirv::binary::Disassemble;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let body1 = include_bytes!("../test/1/body_1.spv");
|
||||
let body2 = include_bytes!("../test/1/body_2.spv");
|
||||
|
||||
let mut body1 = crate::load(&body1[..]);
|
||||
let mut body2 = crate::load(&body2[..]);
|
||||
|
||||
let opts = Options {
|
||||
lib: false,
|
||||
partial: false,
|
||||
};
|
||||
|
||||
let output = link(&mut [&mut body1, &mut body2], &opts)?;
|
||||
println!("{}\n\n", output.disassemble());
|
||||
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue
Block a user