Skip to content

Commit

Permalink
When writing snapshots, reliably identify which writer has failed. (g…
Browse files Browse the repository at this point in the history
  • Loading branch information
jimblandy authored Sep 28, 2021
1 parent 3e992d8 commit 2e73e48
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn check_targets(module: &naga::Module, name: &str, targets: Targets) {

let info = naga::valid::Validator::new(naga::valid::ValidationFlags::all(), capabilities)
.validate(module)
.unwrap();
.expect("Naga module validation failed");

#[cfg(feature = "serialize")]
{
Expand Down Expand Up @@ -193,6 +193,7 @@ fn write_output_spv(
use naga::back::spv;
use rspirv::binary::Disassemble;

println!("writing SPIR-V");
let mut flags = spv::WriterFlags::LABEL_VARYINGS;
flags.set(spv::WriterFlags::DEBUG, params.spv.debug);
flags.set(
Expand Down Expand Up @@ -257,6 +258,8 @@ fn write_output_msl(
) {
use naga::back::msl;

println!("writing MSL");

#[cfg_attr(feature = "deserialize", allow(unused_variables))]
let default_options = msl::Options::default();
#[cfg(feature = "deserialize")]
Expand Down Expand Up @@ -297,6 +300,8 @@ fn write_output_glsl(
) {
use naga::back::glsl;

println!("writing GLSL");

#[cfg_attr(feature = "deserialize", allow(unused_variables))]
let default_options = glsl::Options::default();
#[cfg(feature = "deserialize")]
Expand Down Expand Up @@ -337,6 +342,8 @@ fn write_output_hlsl(
use naga::back::hlsl;
use std::fmt::Write;

println!("writing HLSL");

#[cfg_attr(feature = "deserialize", allow(unused_variables))]
let default_options = hlsl::Options::default();
#[cfg(feature = "deserialize")]
Expand Down Expand Up @@ -424,6 +431,8 @@ fn write_output_wgsl(
) {
use naga::back::wgsl;

println!("writing WGSL");

let string = wgsl::write_string(module, info).expect("WGSL write failed");

fs::write(destination.join(format!("wgsl/{}.wgsl", file_name)), string).unwrap();
Expand Down

0 comments on commit 2e73e48

Please sign in to comment.