Skip to content

Commit

Permalink
dot-out: Improvements
Browse files Browse the repository at this point in the history
Improves the dot backend output by:
- Linking new nodes to the end of other blocks, instead of the beginning
- Generating merge nodes for conditional statements
- Generating connections from break/continue nodes to their target
- Introducing a "cfg only" mode that only generates statements
  • Loading branch information
JCapucho committed Jun 15, 2022
1 parent 98bc8fe commit 70229b3
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 96 deletions.
12 changes: 11 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ struct Args {
#[argh(switch)]
keep_coordinate_space: bool,

/// enable the cfg only mode in the dot backend
#[argh(switch)]
dot_cfg_only: bool,

/// specify file path to process STDIN as
#[argh(option)]
stdin_file_path: Option<String>,
Expand Down Expand Up @@ -475,7 +479,13 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
"dot" => {
use naga::back::dot;

let output = dot::write(&module, info.as_ref())?;
let output = dot::write(
&module,
info.as_ref(),
naga::back::dot::Options {
cfg_only: args.dot_cfg_only,
},
)?;
fs::write(output_path, output)?;
}
"hlsl" => {
Expand Down
Loading

0 comments on commit 70229b3

Please sign in to comment.