restructure this multi-crate project to use Cargo's "workspace" feature

this solves an issue in the Nix build, where managing multiple
Cargo.lock files is otherwise tricky. it causes (or fails to fix?) an adjacent issue where
the spirv builder doesn't seem to have everything it needs vendored.
This commit is contained in:
2022-07-05 17:34:21 -07:00
parent d3cd12aa47
commit 5b99d30cda
64 changed files with 108 additions and 206 deletions

View File

@@ -0,0 +1,29 @@
use spirv_builder::{Capability, MetadataPrintout, SpirvBuilder};
use std::env;
use std::error::Error;
use std::path::PathBuf;
fn main() -> Result<(), Box<dyn Error>> {
// based on EmbarkStudios/rust-gpu/examples/runners/wgpu/src/lib.rs:maybe_watch
let manifest_dir = env!("CARGO_MANIFEST_DIR");
let crate_path = [manifest_dir, "../", "spirv_backend"]
.iter()
.copied()
.collect::<PathBuf>();
println!("get_shader: constructing builder");
let builder = SpirvBuilder::new(crate_path, "spirv-unknown-vulkan1.1")
//let builder = SpirvBuilder::new(crate_path, "spirv-unknown-spv1.3")
.print_metadata(MetadataPrintout::None)
.capability(Capability::Int8)
// .capability(Capability::PhysicalStorageBufferAddresses)
// .capability(Capability::Addresses)
// .capability(Capability::GenericPointer)
;
println!("get_shader: building");
let initial_result = builder.build()?;
let module_path = initial_result.module.unwrap_single();
println!("get_shader: built: {:?}", module_path);
Ok(())
}