delete tests

This commit is contained in:
Quaternions 2023-08-29 18:39:00 -07:00
parent 6e43fda9f3
commit 5af15fe443
2 changed files with 0 additions and 192 deletions

View File

@ -500,139 +500,6 @@ pub fn parse_url_query_string<'a>(query: &'a str, search_key: &str) -> Option<&'
None None
} }
pub use wgpu_test::image::ComparisonType;
pub struct FrameworkRefTest {
// Path to the reference image, relative to the root of the repo.
pub image_path: &'static str,
pub width: u32,
pub height: u32,
pub optional_features: wgpu::Features,
pub base_test_parameters: wgpu_test::TestParameters,
/// Comparisons against FLIP statistics that determine if the test passes or fails.
pub comparisons: &'static [ComparisonType],
}
#[allow(dead_code)]
pub fn test<E: Example>(mut params: FrameworkRefTest) {
use std::mem;
assert_eq!(params.width % 64, 0, "width needs to be aligned 64");
let features = E::required_features() | params.optional_features;
wgpu_test::initialize_test(
mem::take(&mut params.base_test_parameters).features(features),
|ctx| {
let spawner = Spawner::new();
let dst_texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: Some("destination"),
size: wgpu::Extent3d {
width: params.width,
height: params.height,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::COPY_SRC,
view_formats: &[],
});
let dst_view = dst_texture.create_view(&wgpu::TextureViewDescriptor::default());
let dst_buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: Some("image map buffer"),
size: params.width as u64 * params.height as u64 * 4,
usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ,
mapped_at_creation: false,
});
let mut example = E::init(
&wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
width: params.width,
height: params.height,
present_mode: wgpu::PresentMode::Fifo,
alpha_mode: wgpu::CompositeAlphaMode::Auto,
view_formats: vec![wgpu::TextureFormat::Rgba8UnormSrgb],
},
&ctx.adapter,
&ctx.device,
&ctx.queue,
);
example.render(&dst_view, &ctx.device, &ctx.queue, &spawner);
// Handle specific case for bunnymark
#[allow(deprecated)]
if params.image_path == "/examples/bunnymark/screenshot.png" {
// Press spacebar to spawn bunnies
example.update(winit::event::WindowEvent::KeyboardInput {
input: winit::event::KeyboardInput {
scancode: 0,
state: winit::event::ElementState::Pressed,
virtual_keycode: Some(winit::event::VirtualKeyCode::Space),
modifiers: winit::event::ModifiersState::empty(),
},
device_id: unsafe { winit::event::DeviceId::dummy() },
is_synthetic: false,
});
// Step 3 extra frames
for _ in 0..3 {
example.render(&dst_view, &ctx.device, &ctx.queue, &spawner);
}
}
let mut cmd_buf = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
cmd_buf.copy_texture_to_buffer(
wgpu::ImageCopyTexture {
texture: &dst_texture,
mip_level: 0,
origin: wgpu::Origin3d::ZERO,
aspect: wgpu::TextureAspect::All,
},
wgpu::ImageCopyBuffer {
buffer: &dst_buffer,
layout: wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: Some(params.width * 4),
rows_per_image: None,
},
},
wgpu::Extent3d {
width: params.width,
height: params.height,
depth_or_array_layers: 1,
},
);
ctx.queue.submit(Some(cmd_buf.finish()));
let dst_buffer_slice = dst_buffer.slice(..);
dst_buffer_slice.map_async(wgpu::MapMode::Read, |_| ());
ctx.device.poll(wgpu::Maintain::Wait);
let bytes = dst_buffer_slice.get_mapped_range().to_vec();
wgpu_test::image::compare_image_output(
env!("CARGO_MANIFEST_DIR").to_string() + "/../../" + params.image_path,
ctx.adapter_info.backend,
params.width,
params.height,
&bytes,
params.comparisons,
);
},
);
}
// This allows treating the framework as a standalone example, // This allows treating the framework as a standalone example,
// thus avoiding listing the example names in `Cargo.toml`. // thus avoiding listing the example names in `Cargo.toml`.
#[allow(dead_code)] #[allow(dead_code)]

View File

@ -462,62 +462,3 @@ impl strafe_client::framework::Example for Skybox {
fn main() { fn main() {
strafe_client::framework::run::<Skybox>("skybox"); strafe_client::framework::run::<Skybox>("skybox");
} }
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[test]
#[wasm_bindgen_test::wasm_bindgen_test]
fn skybox() {
wgpu_example::framework::test::<Skybox>(wgpu_example::framework::FrameworkRefTest {
image_path: "/examples/skybox/screenshot.png",
width: 1024,
height: 768,
optional_features: wgpu::Features::default(),
base_test_parameters: wgpu_test::TestParameters::default().specific_failure(
Some(wgpu::Backends::GL),
None,
Some("ANGLE"),
false,
),
comparisons: &[wgpu_test::ComparisonType::Mean(0.015)],
});
}
#[test]
#[wasm_bindgen_test::wasm_bindgen_test]
fn skybox_bc1() {
wgpu_example::framework::test::<Skybox>(wgpu_example::framework::FrameworkRefTest {
image_path: "/examples/skybox/screenshot-bc1.png",
width: 1024,
height: 768,
optional_features: wgpu::Features::TEXTURE_COMPRESSION_BC,
base_test_parameters: wgpu_test::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
comparisons: &[wgpu_test::ComparisonType::Mean(0.02)],
});
}
#[test]
#[wasm_bindgen_test::wasm_bindgen_test]
fn skybox_etc2() {
wgpu_example::framework::test::<Skybox>(wgpu_example::framework::FrameworkRefTest {
image_path: "/examples/skybox/screenshot-etc2.png",
width: 1024,
height: 768,
optional_features: wgpu::Features::TEXTURE_COMPRESSION_ETC2,
base_test_parameters: wgpu_test::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
comparisons: &[wgpu_test::ComparisonType::Mean(0.015)],
});
}
#[test]
#[wasm_bindgen_test::wasm_bindgen_test]
fn skybox_astc() {
wgpu_example::framework::test::<Skybox>(wgpu_example::framework::FrameworkRefTest {
image_path: "/examples/skybox/screenshot-astc.png",
width: 1024,
height: 768,
optional_features: wgpu::Features::TEXTURE_COMPRESSION_ASTC,
base_test_parameters: wgpu_test::TestParameters::default(), // https://bugs.chromium.org/p/angleproject/issues/detail?id=7056
comparisons: &[wgpu_test::ComparisonType::Mean(0.016)],
});
}