diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index 06db6092f7e..875d8544e73 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -625,7 +625,7 @@ pub fn test(mut params: FrameworkRefTest) { wgpu_test::image::compare_image_output( env!("CARGO_MANIFEST_DIR").to_string() + "/../../" + params.image_path, - ctx.adapter_info.backend, + &ctx.adapter_info, params.width, params.height, &bytes, diff --git a/tests/src/image.rs b/tests/src/image.rs index 00aa78f660c..e50fd43e7fe 100644 --- a/tests/src/image.rs +++ b/tests/src/image.rs @@ -150,7 +150,7 @@ impl ComparisonType { pub fn compare_image_output( path: impl AsRef + AsRef, - backend: Backend, + adapter_info: &wgt::AdapterInfo, width: u32, height: u32, test_with_alpha: &[u8], @@ -205,17 +205,18 @@ pub fn compare_image_output( } let file_stem = reference_path.file_stem().unwrap().to_string_lossy(); + let renderer = format!( + "{}-{}-{}", + adapter_info.backend.to_str(), + sanitize_for_path(&adapter_info.name), + sanitize_for_path(&adapter_info.driver) + ); // Determine the paths to write out the various intermediate files let actual_path = Path::new(&path).with_file_name( - OsString::from_str(&format!("{}-{}-actual.png", file_stem, backend.to_str(),)).unwrap(), + OsString::from_str(&format!("{}-{}-actual.png", file_stem, renderer)).unwrap(), ); let difference_path = Path::new(&path).with_file_name( - OsString::from_str(&format!( - "{}-{}-difference.png", - file_stem, - backend.to_str(), - )) - .unwrap(), + OsString::from_str(&format!("{}-{}-difference.png", file_stem, renderer,)).unwrap(), ); // Convert the error values to a false color reprensentation @@ -246,10 +247,16 @@ pub fn compare_image_output( #[cfg(target_arch = "wasm32")] { - let _ = (path, backend, width, height, test_with_alpha, checks); + let _ = (path, adapter_info, width, height, test_with_alpha, checks); } } +fn sanitize_for_path(s: &str) -> String { + s.chars() + .map(|ch| if ch.is_ascii_alphanumeric() { ch } else { '_' }) + .collect() +} + fn copy_via_compute( device: &Device, encoder: &mut CommandEncoder,