Bincode support for naga-cli

This commit is contained in:
Dzmitry Malyshau
2022-02-15 19:00:00 -05:00
parent d0a4a193e3
commit 231da54cd7
2 changed files with 8 additions and 2 deletions

View File

@@ -14,8 +14,9 @@ name = "naga"
path = "src/main.rs"
[dependencies]
naga = { path = "../", features = ["validate", "span", "wgsl-in", "wgsl-out", "glsl-in", "glsl-out", "spv-in", "spv-out", "msl-out", "hlsl-out", "dot-out", "glsl-validate"] }
naga = { path = "../", features = ["validate", "span", "wgsl-in", "wgsl-out", "glsl-in", "glsl-out", "spv-in", "spv-out", "msl-out", "hlsl-out", "dot-out", "glsl-validate", "serialize", "deserialize"] }
bincode = "1"
log = "0.4"
codespan-reporting = "0.11"
env_logger = "0.8"
env_logger = "0.9"
argh = "0.1.5"

View File

@@ -265,6 +265,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
.to_str()
.ok_or(CliError("Input filename not valid unicode"))?
{
"bin" => (bincode::deserialize(&input)?, None),
"spv" => {
let options = naga::front::spv::Options {
adjust_coordinate_space: !params.keep_coordinate_space,
@@ -360,6 +361,10 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
writeln!(file, "{:#?}", info)?;
}
}
"bin" => {
let file = fs::File::create(output_path)?;
bincode::serialize_into(file, &module)?;
}
"metal" => {
use naga::back::msl;