cli: Populate dot backend options in Parameters early.

This is a step towards having the output loop depend only on `params`,
rather than both `params` and `args`.
This commit is contained in:
Jim Blandy
2023-09-12 13:04:47 -07:00
committed by Teodor Tanasoaia
parent 54df410b94
commit 2a47a15f03
2 changed files with 5 additions and 8 deletions

View File

@@ -161,6 +161,7 @@ struct Parameters<'a> {
entry_point: Option<String>,
keep_coordinate_space: bool,
spv_block_ctx_dump_prefix: Option<String>,
dot: naga::back::dot::Options,
spv: naga::back::spv::Options<'a>,
msl: naga::back::msl::Options,
glsl: naga::back::glsl::Options,
@@ -273,6 +274,8 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
}
params.keep_coordinate_space = args.keep_coordinate_space;
params.dot.cfg_only = args.dot_cfg_only;
let (module, input_text) = match Path::new(&input_path)
.extension()
.ok_or(CliError("Input filename has no extension"))?
@@ -519,13 +522,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
"dot" => {
use naga::back::dot;
let output = dot::write(
&module,
info.as_ref(),
naga::back::dot::Options {
cfg_only: args.dot_cfg_only,
},
)?;
let output = dot::write(&module, info.as_ref(), params.dot.clone())?;
fs::write(output_path, output)?;
}
"hlsl" => {

View File

@@ -18,7 +18,7 @@ use std::{
};
/// Configuration options for the dot backend
#[derive(Default)]
#[derive(Clone, Default)]
pub struct Options {
/// Only emit function bodies
pub cfg_only: bool,