From d0ecda96cd1490feda71d9f5c345efee1a105e1c Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Thu, 30 Jul 2026 03:16:43 -0700 Subject: [PATCH] Replace `wgpu-macros` package with use of `macro_rules_attribute`. (#9963) --- Cargo.lock | 12 +- Cargo.toml | 7 +- docs/testing.md | 4 +- .../features/src/big_compute_buffers/tests.rs | 4 +- examples/features/src/boids/mod.rs | 2 +- examples/features/src/bunnymark/mod.rs | 2 +- .../features/src/conservative_raster/mod.rs | 2 +- .../features/src/cooperative_matrix/tests.rs | 6 +- examples/features/src/cube/mod.rs | 4 +- .../src/hello_synchronization/tests.rs | 4 +- examples/features/src/mesh_shader/mod.rs | 2 +- examples/features/src/mipmap/mod.rs | 4 +- examples/features/src/msaa_line/mod.rs | 2 +- .../src/multiple_render_targets/mod.rs | 2 +- examples/features/src/ray_aabb_compute/mod.rs | 2 +- examples/features/src/ray_cube_compute/mod.rs | 2 +- .../features/src/ray_cube_fragment/mod.rs | 2 +- examples/features/src/ray_cube_normals/mod.rs | 2 +- examples/features/src/ray_scene/mod.rs | 2 +- examples/features/src/ray_shadows/mod.rs | 2 +- .../features/src/ray_traced_triangle/mod.rs | 2 +- examples/features/src/shadow/mod.rs | 2 +- examples/features/src/skybox/mod.rs | 8 +- examples/features/src/srgb_blend/mod.rs | 4 +- .../features/src/stencil_triangles/mod.rs | 2 +- examples/features/src/texture_arrays/mod.rs | 6 +- .../features/src/timestamp_queries/mod.rs | 8 +- examples/features/src/water/mod.rs | 2 +- tests/Cargo.toml | 3 +- tests/src/lib.rs | 31 +- tests/tests/wgpu-gpu/adapter.rs | 4 +- tests/tests/wgpu-gpu/bgra8unorm_storage.rs | 4 +- .../tests/wgpu-gpu/bind_group_layout_dedup.rs | 14 +- tests/tests/wgpu-gpu/bind_groups.rs | 15 +- tests/tests/wgpu-gpu/binding_array/buffers.rs | 11 +- .../binding_array/sampled_textures.rs | 10 +- .../tests/wgpu-gpu/binding_array/samplers.rs | 6 +- .../binding_array/storage_textures.rs | 8 +- tests/tests/wgpu-gpu/binding_array/tlas.rs | 4 +- tests/tests/wgpu-gpu/buffer.rs | 19 +- tests/tests/wgpu-gpu/buffer_copy.rs | 6 +- .../tests/wgpu-gpu/buffer_resource_limits.rs | 679 +++++++++--------- tests/tests/wgpu-gpu/buffer_usages.rs | 9 +- tests/tests/wgpu-gpu/clear_texture.rs | 16 +- tests/tests/wgpu-gpu/clip_distances.rs | 4 +- tests/tests/wgpu-gpu/cloneable_types.rs | 4 +- .../tests/wgpu-gpu/compute_pass_ownership.rs | 11 +- .../compute_pass_transition_resources.rs | 4 +- tests/tests/wgpu-gpu/create_surface_error.rs | 4 +- tests/tests/wgpu-gpu/device.rs | 21 +- .../wgpu-gpu/dispatch_workgroups_indirect.rs | 10 +- tests/tests/wgpu-gpu/draw_index.rs | 11 +- tests/tests/wgpu-gpu/draw_indirect.rs | 10 +- tests/tests/wgpu-gpu/dual_source_blending.rs | 6 +- tests/tests/wgpu-gpu/encoder.rs | 10 +- tests/tests/wgpu-gpu/external_image_copy.rs | 4 +- tests/tests/wgpu-gpu/external_texture/mod.rs | 18 +- tests/tests/wgpu-gpu/float32_filterable.rs | 6 +- tests/tests/wgpu-gpu/image_atomics/mod.rs | 10 +- tests/tests/wgpu-gpu/immediates.rs | 6 +- tests/tests/wgpu-gpu/instance.rs | 4 +- tests/tests/wgpu-gpu/life_cycle.rs | 22 +- tests/tests/wgpu-gpu/mem_leaks.rs | 2 +- tests/tests/wgpu-gpu/mesh_shader/mod.rs | 26 +- tests/tests/wgpu-gpu/multiview/mod.rs | 11 +- tests/tests/wgpu-gpu/naga_capabilities.rs | 4 +- tests/tests/wgpu-gpu/occlusion_query/mod.rs | 6 +- tests/tests/wgpu-gpu/oob_indexing.rs | 10 +- tests/tests/wgpu-gpu/oom.rs | 14 +- tests/tests/wgpu-gpu/pass_ops/mod.rs | 10 +- tests/tests/wgpu-gpu/passthrough/mod.rs | 23 +- tests/tests/wgpu-gpu/per_vertex/mod.rs | 4 +- tests/tests/wgpu-gpu/pipeline.rs | 12 +- tests/tests/wgpu-gpu/pipeline_cache.rs | 4 +- tests/tests/wgpu-gpu/planar_texture/mod.rs | 14 +- tests/tests/wgpu-gpu/poll.rs | 27 +- tests/tests/wgpu-gpu/primitive_index.rs | 11 +- tests/tests/wgpu-gpu/query_set.rs | 4 +- tests/tests/wgpu-gpu/queue_transfer.rs | 8 +- tests/tests/wgpu-gpu/ray_tracing/as_aabb.rs | 16 +- tests/tests/wgpu-gpu/ray_tracing/as_build.rs | 32 +- tests/tests/wgpu-gpu/ray_tracing/as_create.rs | 9 +- .../wgpu-gpu/ray_tracing/as_use_after_free.rs | 5 +- tests/tests/wgpu-gpu/ray_tracing/limits.rs | 5 +- tests/tests/wgpu-gpu/ray_tracing/scene/mod.rs | 6 +- tests/tests/wgpu-gpu/ray_tracing/shader.rs | 10 +- tests/tests/wgpu-gpu/regression/issue_3349.rs | 6 +- tests/tests/wgpu-gpu/regression/issue_3457.rs | 4 +- tests/tests/wgpu-gpu/regression/issue_4024.rs | 4 +- tests/tests/wgpu-gpu/regression/issue_4122.rs | 4 +- tests/tests/wgpu-gpu/regression/issue_4485.rs | 5 +- tests/tests/wgpu-gpu/regression/issue_4514.rs | 5 +- .../wgpu-gpu/regression/issue_5231_9343.rs | 9 +- tests/tests/wgpu-gpu/regression/issue_5553.rs | 4 +- tests/tests/wgpu-gpu/regression/issue_6317.rs | 5 +- tests/tests/wgpu-gpu/regression/issue_6467.rs | 4 +- tests/tests/wgpu-gpu/regression/issue_6827.rs | 7 +- tests/tests/wgpu-gpu/regression/issue_9115.rs | 6 +- tests/tests/wgpu-gpu/render_pass_ownership.rs | 11 +- tests/tests/wgpu-gpu/render_target.rs | 12 +- .../tests/wgpu-gpu/resolve_query_set_init.rs | 25 +- .../wgpu-gpu/resource_descriptor_accessor.rs | 4 +- tests/tests/wgpu-gpu/resource_error.rs | 10 +- tests/tests/wgpu-gpu/samplers.rs | 10 +- tests/tests/wgpu-gpu/scissor_tests/mod.rs | 10 +- .../wgpu-gpu/shader/array_size_overrides.rs | 4 +- .../shader/compilation_messages/mod.rs | 12 +- tests/tests/wgpu-gpu/shader/data_builtins.rs | 10 +- .../tests/wgpu-gpu/shader/numeric_builtins.rs | 12 +- tests/tests/wgpu-gpu/shader/struct_layout.rs | 22 +- .../shader/workgroup_size_overrides.rs | 4 +- .../shader/zero_init_workgroup_mem.rs | 4 +- .../tests/wgpu-gpu/shader_barycentric/mod.rs | 6 +- .../wgpu-gpu/shader_primitive_index/mod.rs | 6 +- .../tests/wgpu-gpu/shader_view_format/mod.rs | 4 +- .../tests/wgpu-gpu/subgroup_operations/mod.rs | 4 +- tests/tests/wgpu-gpu/texture_binding/mod.rs | 9 +- tests/tests/wgpu-gpu/texture_blit.rs | 6 +- tests/tests/wgpu-gpu/texture_bounds.rs | 4 +- tests/tests/wgpu-gpu/texture_view_creation.rs | 10 +- .../wgpu-gpu/timestamp_normalization/utils.rs | 6 +- tests/tests/wgpu-gpu/timestamp_query.rs | 5 +- tests/tests/wgpu-gpu/transfer.rs | 4 +- tests/tests/wgpu-gpu/transient.rs | 4 +- tests/tests/wgpu-gpu/transition_resources.rs | 4 +- tests/tests/wgpu-gpu/vertex_formats/mod.rs | 6 +- tests/tests/wgpu-gpu/vertex_indices/mod.rs | 4 +- tests/tests/wgpu-gpu/vertex_state.rs | 4 +- tests/tests/wgpu-gpu/write_texture.rs | 10 +- tests/tests/wgpu-gpu/zero_init.rs | 44 +- wgpu-macros/Cargo.toml | 23 - wgpu-macros/src/lib.rs | 30 - 132 files changed, 889 insertions(+), 897 deletions(-) delete mode 100644 wgpu-macros/Cargo.toml delete mode 100644 wgpu-macros/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index ec3d78604..d426e7db7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4916,15 +4916,6 @@ dependencies = [ "wgpu", ] -[[package]] -name = "wgpu-macros" -version = "30.0.0" -dependencies = [ - "heck", - "quote", - "syn", -] - [[package]] name = "wgpu-naga-bridge" version = "30.0.0" @@ -4955,10 +4946,12 @@ dependencies = [ "js-sys", "libtest-mimic", "log", + "macro_rules_attribute", "naga", "nanorand", "nv-flip", "parking_lot", + "paste", "png", "pollster", "profiling", @@ -4974,7 +4967,6 @@ dependencies = [ "wgpu", "wgpu-core", "wgpu-hal", - "wgpu-macros", "wgpu-types", ] diff --git a/Cargo.toml b/Cargo.toml index 59c9ef0a1..8bbcaf27e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ members = [ "wgpu-core/platform-deps/*", "wgpu-hal", "wgpu-info", - "wgpu-macros", "wgpu-naga-bridge", "wgpu-types", "wgpu", @@ -49,7 +48,6 @@ default-members = [ "wgpu-core/platform-deps/*", "wgpu-hal", "wgpu-info", - "wgpu-macros", "wgpu-naga-bridge", "wgpu-types", "wgpu", @@ -93,7 +91,6 @@ wgpu = { version = "30.0.0", path = "./wgpu", default-features = false, features ] } wgpu-core = { version = "30.0.0", path = "./wgpu-core" } wgpu-hal = { version = "30.0.0", path = "./wgpu-hal" } -wgpu-macros = { version = "30.0.0", path = "./wgpu-macros" } wgpu-naga-bridge = { version = "30.0.0", path = "./wgpu-naga-bridge" } wgpu-test = { version = "30.0.0", path = "./tests" } wgpu-types = { version = "30.0.0", path = "./wgpu-types", default-features = false } @@ -141,7 +138,6 @@ hashbrown = { version = "0.17", default-features = false, features = [ "default-hasher", "inline-more", ] } -heck = "0.5" image = { version = "0.25", default-features = false, features = ["png"] } indexmap = { version = "2.11.4", default-features = false } indicatif = "0.18" @@ -169,6 +165,7 @@ once_cell = { version = "1.21", default-features = false } # Firefox has 3.4.0 vendored, so we allow that version in our dependencies ordered-float = { version = ">=3, <6.0", default-features = false } parking_lot = "0.12.3" +paste = "1.0.15" petgraph = { version = "0.8", default-features = false } pico-args = { version = "0.5", features = [ "eq-separator", @@ -181,7 +178,6 @@ portable-atomic = "1.10" portable-atomic-util = "0.2.4" pp-rs = "0.2.1" profiling = { version = "1.0.1", default-features = false } -quote = "1.0.38" raw-window-handle = { version = "0.6.2", default-features = false } rayon = "1.3" regex-lite = "0.1" @@ -199,7 +195,6 @@ smallvec = "1.14" spirv = "0.4" static_assertions = "1.1" strum = { version = "0.28", default-features = false, features = ["derive"] } -syn = "2.0.98" tempfile = "3" toml = "1.0.0" trybuild = "1" diff --git a/docs/testing.md b/docs/testing.md index 7e00a29c7..75b2a9084 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -69,7 +69,7 @@ To run the benchmarks for benchmarking purposes, use `cargo bench`. - Located in: `examples/features` - Run with `cargo xtask test --bin wgpu-examples` -- Uses a custom `#[gpu_test]` harness. +- Uses a custom `#[apply(gpu_test!)]` harness. - `wgpu` integration tests, with access to `wgpu_test` helpers. These tests validate that the examples are functioning correctly @@ -188,7 +188,7 @@ This provides a way to ensure that our `toml` files are correct. - Located in: `tests/tests/wgpu-gpu` - Run with `cargo xtask test --test wgpu-gpu` -- Uses a custom `#[gpu_test]` harness. +- Uses a custom `#[apply(gpu_test!)]` harness. - `wgpu` integration tests, with access to `wgpu_test` helpers. These tests use a custom harness to run each test on all GPUs diff --git a/examples/features/src/big_compute_buffers/tests.rs b/examples/features/src/big_compute_buffers/tests.rs index 1b3a398f2..b15e9884e 100644 --- a/examples/features/src/big_compute_buffers/tests.rs +++ b/examples/features/src/big_compute_buffers/tests.rs @@ -1,7 +1,7 @@ use super::*; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters}; -#[gpu_test] +#[apply(gpu_test!)] pub static TWO_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/examples/features/src/boids/mod.rs b/examples/features/src/boids/mod.rs index 886f1aec5..a661c2334 100644 --- a/examples/features/src/boids/mod.rs +++ b/examples/features/src/boids/mod.rs @@ -322,7 +322,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "boids", // Generated on 1080ti on Vk/Windows diff --git a/examples/features/src/bunnymark/mod.rs b/examples/features/src/bunnymark/mod.rs index 837ad7c54..c58d70d49 100644 --- a/examples/features/src/bunnymark/mod.rs +++ b/examples/features/src/bunnymark/mod.rs @@ -440,7 +440,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "bunnymark", image_path: "/examples/features/src/bunnymark/screenshot.png", diff --git a/examples/features/src/conservative_raster/mod.rs b/examples/features/src/conservative_raster/mod.rs index 54fd67367..8d7a15a29 100644 --- a/examples/features/src/conservative_raster/mod.rs +++ b/examples/features/src/conservative_raster/mod.rs @@ -318,7 +318,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "conservative-raster", image_path: "/examples/features/src/conservative_raster/screenshot.png", diff --git a/examples/features/src/cooperative_matrix/tests.rs b/examples/features/src/cooperative_matrix/tests.rs index 911bd4d4b..1f93d297e 100644 --- a/examples/features/src/cooperative_matrix/tests.rs +++ b/examples/features/src/cooperative_matrix/tests.rs @@ -1,11 +1,11 @@ use super::*; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters}; // These tests are split into `COOPERATIVE_MATRIX_F16` and // `COOPERATIVE_MATRIX_F32` because the latter can run without // `wgpu::Features::SHADER_F16`. -#[gpu_test] +#[apply(gpu_test!)] pub static COOPERATIVE_MATRIX_F32: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -45,7 +45,7 @@ pub static COOPERATIVE_MATRIX_F32: GpuTestConfiguration = GpuTestConfiguration:: assert!(max_error < tolerance); }); -#[gpu_test] +#[apply(gpu_test!)] pub static COOPERATIVE_MATRIX_F16: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/examples/features/src/cube/mod.rs b/examples/features/src/cube/mod.rs index 668b98e04..61d9d5c16 100644 --- a/examples/features/src/cube/mod.rs +++ b/examples/features/src/cube/mod.rs @@ -381,7 +381,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "cube", // Generated on 1080ti on Vk/Windows @@ -397,7 +397,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_LINES: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "cube-lines", // Generated on 1080ti on Vk/Windows diff --git a/examples/features/src/hello_synchronization/tests.rs b/examples/features/src/hello_synchronization/tests.rs index ff34abbd0..51edc4db5 100644 --- a/examples/features/src/hello_synchronization/tests.rs +++ b/examples/features/src/hello_synchronization/tests.rs @@ -1,7 +1,7 @@ use super::*; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters}; -#[gpu_test] +#[apply(gpu_test!)] pub static SYNC: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( // Taken from hello-compute tests. diff --git a/examples/features/src/mesh_shader/mod.rs b/examples/features/src/mesh_shader/mod.rs index 874ca65d2..1811f10f5 100644 --- a/examples/features/src/mesh_shader/mod.rs +++ b/examples/features/src/mesh_shader/mod.rs @@ -104,7 +104,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "mesh_shader", image_path: "/examples/features/src/mesh_shader/screenshot.png", diff --git a/examples/features/src/mipmap/mod.rs b/examples/features/src/mipmap/mod.rs index 142533842..e947cc6b3 100644 --- a/examples/features/src/mipmap/mod.rs +++ b/examples/features/src/mipmap/mod.rs @@ -511,7 +511,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "mipmap", image_path: "/examples/features/src/mipmap/screenshot.png", @@ -524,7 +524,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_QUERY: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "mipmap-query", image_path: "/examples/features/src/mipmap/screenshot_query.png", diff --git a/examples/features/src/msaa_line/mod.rs b/examples/features/src/msaa_line/mod.rs index a84578a01..40d93e003 100644 --- a/examples/features/src/msaa_line/mod.rs +++ b/examples/features/src/msaa_line/mod.rs @@ -322,7 +322,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "msaa-line", image_path: "/examples/features/src/msaa_line/screenshot.png", diff --git a/examples/features/src/multiple_render_targets/mod.rs b/examples/features/src/multiple_render_targets/mod.rs index 76a0643f6..701dc4bb8 100644 --- a/examples/features/src/multiple_render_targets/mod.rs +++ b/examples/features/src/multiple_render_targets/mod.rs @@ -537,7 +537,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: EXAMPLE_NAME, image_path: "/examples/features/src/multiple_render_targets/screenshot.png", diff --git a/examples/features/src/ray_aabb_compute/mod.rs b/examples/features/src/ray_aabb_compute/mod.rs index 4fa8398ce..3d0f69940 100644 --- a/examples/features/src/ray_aabb_compute/mod.rs +++ b/examples/features/src/ray_aabb_compute/mod.rs @@ -389,7 +389,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_aabb_compute", image_path: "/examples/features/src/ray_aabb_compute/screenshot.png", diff --git a/examples/features/src/ray_cube_compute/mod.rs b/examples/features/src/ray_cube_compute/mod.rs index 76c0960ae..db3e8dc1b 100644 --- a/examples/features/src/ray_cube_compute/mod.rs +++ b/examples/features/src/ray_cube_compute/mod.rs @@ -462,7 +462,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_cube_compute", image_path: "/examples/features/src/ray_cube_compute/screenshot.png", diff --git a/examples/features/src/ray_cube_fragment/mod.rs b/examples/features/src/ray_cube_fragment/mod.rs index 1a5396609..53b6b13f7 100644 --- a/examples/features/src/ray_cube_fragment/mod.rs +++ b/examples/features/src/ray_cube_fragment/mod.rs @@ -348,7 +348,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_cube_fragment", image_path: "/examples/features/src/ray_cube_fragment/screenshot.png", diff --git a/examples/features/src/ray_cube_normals/mod.rs b/examples/features/src/ray_cube_normals/mod.rs index 05793d604..63a1178a5 100644 --- a/examples/features/src/ray_cube_normals/mod.rs +++ b/examples/features/src/ray_cube_normals/mod.rs @@ -448,7 +448,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_cube_normals", image_path: "/examples/features/src/ray_cube_normals/screenshot.png", diff --git a/examples/features/src/ray_scene/mod.rs b/examples/features/src/ray_scene/mod.rs index b4a1db8d9..8f4da8e90 100644 --- a/examples/features/src/ray_scene/mod.rs +++ b/examples/features/src/ray_scene/mod.rs @@ -528,7 +528,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_scene", image_path: "/examples/features/src/ray_scene/screenshot.png", diff --git a/examples/features/src/ray_shadows/mod.rs b/examples/features/src/ray_shadows/mod.rs index fc41e797e..141cccb81 100644 --- a/examples/features/src/ray_shadows/mod.rs +++ b/examples/features/src/ray_shadows/mod.rs @@ -345,7 +345,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_shadows", image_path: "/examples/features/src/ray_shadows/screenshot.png", diff --git a/examples/features/src/ray_traced_triangle/mod.rs b/examples/features/src/ray_traced_triangle/mod.rs index b154ce906..b3b72d094 100644 --- a/examples/features/src/ray_traced_triangle/mod.rs +++ b/examples/features/src/ray_traced_triangle/mod.rs @@ -431,7 +431,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "ray_traced_triangle", image_path: "/examples/features/src/ray_traced_triangle/screenshot.png", diff --git a/examples/features/src/shadow/mod.rs b/examples/features/src/shadow/mod.rs index 32f59b6a7..2cb38a134 100644 --- a/examples/features/src/shadow/mod.rs +++ b/examples/features/src/shadow/mod.rs @@ -841,7 +841,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "shadow", image_path: "/examples/features/src/shadow/screenshot.png", diff --git a/examples/features/src/skybox/mod.rs b/examples/features/src/skybox/mod.rs index bd67c88f2..579aa1cad 100644 --- a/examples/features/src/skybox/mod.rs +++ b/examples/features/src/skybox/mod.rs @@ -470,7 +470,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "skybox", image_path: "/examples/features/src/skybox/screenshot.png", @@ -485,7 +485,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_BCN: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "skybox-bc7", image_path: "/examples/features/src/skybox/screenshot_bc7.png", @@ -498,7 +498,7 @@ pub static TEST_BCN: crate::framework::ExampleTestParams = crate::framework::Exa }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_ETC2: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "skybox-etc2", image_path: "/examples/features/src/skybox/screenshot_etc2.png", @@ -511,7 +511,7 @@ pub static TEST_ETC2: crate::framework::ExampleTestParams = crate::framework::Ex }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_ASTC: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "skybox-astc", image_path: "/examples/features/src/skybox/screenshot_astc.png", diff --git a/examples/features/src/srgb_blend/mod.rs b/examples/features/src/srgb_blend/mod.rs index bc4992d2e..3c63513b4 100644 --- a/examples/features/src/srgb_blend/mod.rs +++ b/examples/features/src/srgb_blend/mod.rs @@ -222,7 +222,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_SRGB: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "srgb-blend-srg", // Generated on WARP/Windows @@ -236,7 +236,7 @@ pub static TEST_SRGB: crate::framework::ExampleTestParams = crate::framework::Ex }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_LINEAR: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "srgb-blend-linear", // Generated on WARP/Windows diff --git a/examples/features/src/stencil_triangles/mod.rs b/examples/features/src/stencil_triangles/mod.rs index 210ce1481..a0afc3675 100644 --- a/examples/features/src/stencil_triangles/mod.rs +++ b/examples/features/src/stencil_triangles/mod.rs @@ -239,7 +239,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "stencil-triangles", image_path: "/examples/features/src/stencil_triangles/screenshot.png", diff --git a/examples/features/src/texture_arrays/mod.rs b/examples/features/src/texture_arrays/mod.rs index da909670c..f5ffd68ce 100644 --- a/examples/features/src/texture_arrays/mod.rs +++ b/examples/features/src/texture_arrays/mod.rs @@ -431,7 +431,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "texture-arrays", image_path: "/examples/features/src/texture_arrays/screenshot.png", @@ -451,7 +451,7 @@ pub static TEST: crate::framework::ExampleTestParams = crate::framework::Example }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_UNIFORM: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "texture-arrays-uniform", @@ -472,7 +472,7 @@ pub static TEST_UNIFORM: crate::framework::ExampleTestParams = }; #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST_NON_UNIFORM: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "texture-arrays-non-uniform", diff --git a/examples/features/src/timestamp_queries/mod.rs b/examples/features/src/timestamp_queries/mod.rs index 127314e58..ff0a51788 100644 --- a/examples/features/src/timestamp_queries/mod.rs +++ b/examples/features/src/timestamp_queries/mod.rs @@ -431,11 +431,11 @@ pub fn main() { #[cfg(test)] pub mod tests { use wgpu::Backends; - use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration}; + use wgpu_test::{apply, gpu_test, FailureCase, GpuTestConfiguration}; use super::{submit_render_and_compute_pass_with_queries, QueryResults}; - #[gpu_test] + #[apply(gpu_test!)] pub static TIMESTAMPS_PASS_BOUNDARIES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( wgpu_test::TestParameters::default() @@ -444,7 +444,7 @@ pub mod tests { ) .run_sync(|ctx| test_timestamps(ctx, false, false)); - #[gpu_test] + #[apply(gpu_test!)] pub static TIMESTAMPS_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( wgpu_test::TestParameters::default() @@ -456,7 +456,7 @@ pub mod tests { ) .run_sync(|ctx| test_timestamps(ctx, true, false)); - #[gpu_test] + #[apply(gpu_test!)] pub static TIMESTAMPS_PASSES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( wgpu_test::TestParameters::default() diff --git a/examples/features/src/water/mod.rs b/examples/features/src/water/mod.rs index 0db1622b2..fc0946654 100644 --- a/examples/features/src/water/mod.rs +++ b/examples/features/src/water/mod.rs @@ -824,7 +824,7 @@ pub fn main() { } #[cfg(test)] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] pub static TEST: crate::framework::ExampleTestParams = crate::framework::ExampleTestParams { name: "water", image_path: "/examples/features/src/water/screenshot.png", diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 5b83974e8..202cdfab2 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -47,7 +47,6 @@ test-build-with-profiling = ["profiling/type-check"] wgpu = { workspace = true, features = ["noop", "gles", "webgl", "angle"] } wgpu-core = { workspace = true, features = ["trace"] } wgpu-hal = { workspace = true, features = ["validation_canary"] } -wgpu-macros.workspace = true wgpu-types.workspace = true naga = { workspace = true, features = [ "spv-out", @@ -65,7 +64,9 @@ cfg-if.workspace = true exhaust.workspace = true futures-lite.workspace = true libtest-mimic.workspace = true +macro_rules_attribute.workspace = true log.workspace = true +paste.workspace = true png.workspace = true pollster.workspace = true profiling.workspace = true diff --git a/tests/src/lib.rs b/tests/src/lib.rs index 66f6b1f40..ba5621148 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -22,9 +22,9 @@ pub use self::image::ComparisonType; pub use config::{GpuTestConfiguration, GpuTestInitializer}; pub use expectations::{FailureApplicationReasons, FailureBehavior, FailureCase, FailureReason}; pub use init::{initialize_adapter, initialize_device, initialize_instance}; +pub use macro_rules_attribute::apply; pub use params::TestParameters; pub use run::{execute_test, TestingContext}; -pub use wgpu_macros::gpu_test; /// Run some code in an error scope and assert that validation fails. /// @@ -144,3 +144,32 @@ macro_rules! gpu_test_main { } }; } + +/// Creates a test that will run on all gpus on a given system. +/// +/// Use this macro as [`#[apply(gpu_test)]`][apply] on a static variable with a type that +/// can be converted to a [`GpuTestConfiguration`]. +#[macro_export] +macro_rules! gpu_test { + ( + $( #[ $meta:meta ] )* + $vis:vis static $static_name:ident: $static_type:ty = $init_expr:expr; + ) => { + $crate::macro_support::paste! { + $( #[ $meta ] )* + #[allow(non_snake_case)] + $vis fn $static_name() -> $crate::GpuTestConfiguration { + struct S; + + // Allow any type that can be converted to a GpuTestConfiguration + $crate::GpuTestConfiguration::from($init_expr) + .name_from_init_function_typename::(stringify!([< $static_name:lower >])) + } + } + }; +} + +#[doc(hidden)] +pub mod macro_support { + pub use paste::paste; +} diff --git a/tests/tests/wgpu-gpu/adapter.rs b/tests/tests/wgpu-gpu/adapter.rs index 73f307e5e..6cccd8418 100644 --- a/tests/tests/wgpu-gpu/adapter.rs +++ b/tests/tests/wgpu-gpu/adapter.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(STRICT_WEBGPU_COMPLIANCE_ADAPTER); } -#[gpu_test] +#[apply(gpu_test!)] static STRICT_WEBGPU_COMPLIANCE_ADAPTER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/bgra8unorm_storage.rs b/tests/tests/wgpu-gpu/bgra8unorm_storage.rs index 6d42eaacd..12df31e4f 100644 --- a/tests/tests/wgpu-gpu/bgra8unorm_storage.rs +++ b/tests/tests/wgpu-gpu/bgra8unorm_storage.rs @@ -2,7 +2,7 @@ use std::borrow::Cow; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(BGRA8_UNORM_STORAGE); @@ -17,7 +17,7 @@ fn main(@builtin(workgroup_id) wgid: vec3) { } "; -#[gpu_test] +#[apply(gpu_test!)] static BGRA8_UNORM_STORAGE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/bind_group_layout_dedup.rs b/tests/tests/wgpu-gpu/bind_group_layout_dedup.rs index 882a87c8b..31aff99c4 100644 --- a/tests/tests/wgpu-gpu/bind_group_layout_dedup.rs +++ b/tests/tests/wgpu-gpu/bind_group_layout_dedup.rs @@ -1,7 +1,7 @@ use std::num::NonZeroU64; use wgpu_test::{ - fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -38,7 +38,7 @@ const ENTRY: wgpu::BindGroupLayoutEntry = wgpu::BindGroupLayoutEntry { count: None, }; -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_LAYOUT_DEDUPLICATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -121,7 +121,7 @@ async fn bgl_dedupe(ctx: TestingContext) { ctx.queue.submit(Some(encoder.finish())); } -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_LAYOUT_DEDUPLICATION_WITH_DROPPED_USER_HANDLE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -209,7 +209,7 @@ fn bgl_dedupe_with_dropped_user_handle(ctx: TestingContext) { ctx.queue.submit(Some(encoder.finish())); } -#[gpu_test] +#[apply(gpu_test!)] static GET_DERIVED_BGL: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -286,7 +286,7 @@ fn get_derived_bgl(ctx: TestingContext) { ctx.queue.submit(Some(encoder.finish())); } -#[gpu_test] +#[apply(gpu_test!)] static SEPARATE_PIPELINES_HAVE_INCOMPATIBLE_DERIVED_BGLS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -354,7 +354,7 @@ fn separate_pipelines_have_incompatible_derived_bgls(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static DERIVED_BGLS_INCOMPATIBLE_WITH_REGULAR_BGLS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -430,7 +430,7 @@ fn derived_bgls_incompatible_with_regular_bgls(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_LAYOUT_DEDUPLICATION_DERIVED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/bind_groups.rs b/tests/tests/wgpu-gpu/bind_groups.rs index 5d9f788ab..0c82d4fc4 100644 --- a/tests/tests/wgpu-gpu/bind_groups.rs +++ b/tests/tests/wgpu-gpu/bind_groups.rs @@ -2,7 +2,8 @@ use std::num::NonZeroU64; use wgpu::{util::DeviceExt, BufferUsages, PollType}; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -172,7 +173,7 @@ fn try_sampler_nonfiltering_layout( } } -#[gpu_test] +#[apply(gpu_test!)] static MULTIPLE_BINDINGS_WITH_DIFFERENT_SIZES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -181,7 +182,7 @@ static MULTIPLE_BINDINGS_WITH_DIFFERENT_SIZES: GpuTestConfiguration = GpuTestCon ) .run_sync(multiple_bindings_with_differing_sizes); -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_NONFILTERING_LAYOUT_NONFILTERING_SAMPLER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) @@ -199,7 +200,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_NONFILTERING_SAMPLER: GpuTestConfiguration ); }); -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_NONFILTERING_LAYOUT_MIN_SAMPLER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) @@ -217,7 +218,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MIN_SAMPLER: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_NONFILTERING_LAYOUT_MAG_SAMPLER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) @@ -235,7 +236,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MAG_SAMPLER: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_NONFILTERING_LAYOUT_MIPMAP_SAMPLER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) @@ -253,7 +254,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MIPMAP_SAMPLER: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static BIND_GROUP_WITH_MAX_BINDING_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/binding_array/buffers.rs b/tests/tests/wgpu-gpu/binding_array/buffers.rs index e74e7d901..9495fc419 100644 --- a/tests/tests/wgpu-gpu/binding_array/buffers.rs +++ b/tests/tests/wgpu-gpu/binding_array/buffers.rs @@ -2,7 +2,8 @@ use std::num::{NonZeroU32, NonZeroU64}; use wgpu::*; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -14,7 +15,7 @@ pub fn all_tests(tests: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static BINDING_ARRAY_UNIFORM_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -33,7 +34,7 @@ static BINDING_ARRAY_UNIFORM_BUFFERS: GpuTestConfiguration = GpuTestConfiguratio ) .run_async(|ctx| async move { binding_array_buffers(ctx, BufferType::Uniform, false).await }); -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_BINDING_ARRAY_UNIFORM_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -56,7 +57,7 @@ static PARTIAL_BINDING_ARRAY_UNIFORM_BUFFERS: GpuTestConfiguration = GpuTestConf ) .run_async(|ctx| async move { binding_array_buffers(ctx, BufferType::Uniform, true).await }); -#[gpu_test] +#[apply(gpu_test!)] static BINDING_ARRAY_STORAGE_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters { required_instance_flags: wgpu::InstanceFlags::GPU_BASED_VALIDATION, @@ -81,7 +82,7 @@ static BINDING_ARRAY_STORAGE_BUFFERS: GpuTestConfiguration = GpuTestConfiguratio }) .run_async(|ctx| async move { binding_array_buffers(ctx, BufferType::Storage, false).await }); -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_BINDING_ARRAY_STORAGE_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters { required_instance_flags: wgpu::InstanceFlags::GPU_BASED_VALIDATION, diff --git a/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs b/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs index 3671d38ed..5bd636618 100644 --- a/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs +++ b/tests/tests/wgpu-gpu/binding_array/sampled_textures.rs @@ -2,8 +2,8 @@ use std::num::NonZeroU32; use wgpu::*; use wgpu_test::{ - gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters, - TestingContext, + apply, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, + TestParameters, TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -14,7 +14,7 @@ pub fn all_tests(tests: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static BINDING_ARRAY_SAMPLED_TEXTURES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -36,7 +36,7 @@ static BINDING_ARRAY_SAMPLED_TEXTURES: GpuTestConfiguration = GpuTestConfigurati ) .run_async(|ctx| async move { binding_array_sampled_textures(ctx, false).await }); -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_BINDING_ARRAY_SAMPLED_TEXTURES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -259,7 +259,7 @@ async fn binding_array_sampled_textures(ctx: TestingContext, partially_bound: bo readback_buffers.assert_buffer_contents(&ctx, &image).await; } -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_BINDING_ARRAY_FOLLOWED_BY_STORAGE_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( diff --git a/tests/tests/wgpu-gpu/binding_array/samplers.rs b/tests/tests/wgpu-gpu/binding_array/samplers.rs index 466271122..b906644ba 100644 --- a/tests/tests/wgpu-gpu/binding_array/samplers.rs +++ b/tests/tests/wgpu-gpu/binding_array/samplers.rs @@ -2,14 +2,14 @@ use std::num::{NonZeroU32, NonZeroU64}; use wgpu::*; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(tests: &mut Vec) { tests.extend([BINDING_ARRAY_SAMPLERS, PARTIAL_BINDING_ARRAY_SAMPLERS]); } -#[gpu_test] +#[apply(gpu_test!)] static BINDING_ARRAY_SAMPLERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -32,7 +32,7 @@ static BINDING_ARRAY_SAMPLERS: GpuTestConfiguration = GpuTestConfiguration::new( ) .run_async(|ctx| async move { binding_array_samplers(ctx, false).await }); -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_BINDING_ARRAY_SAMPLERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/binding_array/storage_textures.rs b/tests/tests/wgpu-gpu/binding_array/storage_textures.rs index 95d4aeddd..d2cee19ce 100644 --- a/tests/tests/wgpu-gpu/binding_array/storage_textures.rs +++ b/tests/tests/wgpu-gpu/binding_array/storage_textures.rs @@ -2,8 +2,8 @@ use std::num::NonZeroU32; use wgpu::*; use wgpu_test::{ - gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters, - TestingContext, + apply, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, + TestParameters, TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -13,7 +13,7 @@ pub fn all_tests(tests: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static BINDING_ARRAY_STORAGE_TEXTURES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -31,7 +31,7 @@ static BINDING_ARRAY_STORAGE_TEXTURES: GpuTestConfiguration = GpuTestConfigurati ) .run_async(|ctx| async move { binding_array_storage_textures(ctx, false).await }); -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_BINDING_ARRAY_STORAGE_TEXTURES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/binding_array/tlas.rs b/tests/tests/wgpu-gpu/binding_array/tlas.rs index f44f6ddda..8ed4641c3 100644 --- a/tests/tests/wgpu-gpu/binding_array/tlas.rs +++ b/tests/tests/wgpu-gpu/binding_array/tlas.rs @@ -3,14 +3,14 @@ use std::{borrow::Cow, num::NonZeroU32}; use wgpu::util::DeviceExt; use wgpu::*; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(tests: &mut Vec) { tests.push(BINDING_ARRAY_TLAS); } -#[gpu_test] +#[apply(gpu_test!)] static BINDING_ARRAY_TLAS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/buffer.rs b/tests/tests/wgpu-gpu/buffer.rs index 1c8076a0f..cbab64815 100644 --- a/tests/tests/wgpu-gpu/buffer.rs +++ b/tests/tests/wgpu-gpu/buffer.rs @@ -1,5 +1,6 @@ use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -129,7 +130,7 @@ async fn test_empty_buffer_range_with_usage( .unwrap(); } -#[gpu_test] +#[apply(gpu_test!)] static EMPTY_BUFFER_READ: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -138,7 +139,7 @@ static EMPTY_BUFFER_READ: GpuTestConfiguration = GpuTestConfiguration::new() test_empty_buffer_range_with_usage(&ctx, 0, "zero-sized buffer", usage).await; }); -#[gpu_test] +#[apply(gpu_test!)] static EMPTY_BUFFER_READ_WRITE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -151,7 +152,7 @@ static EMPTY_BUFFER_READ_WRITE: GpuTestConfiguration = GpuTestConfiguration::new test_empty_buffer_range_with_usage(&ctx, 0, "zero-sized buffer", usage).await; }); -#[gpu_test] +#[apply(gpu_test!)] static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -228,7 +229,7 @@ static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new() /// intervening submit. /// /// Regression test for [#5173](https://github.com/gfx-rs/wgpu/issues/5173). -#[gpu_test] +#[apply(gpu_test!)] static MAP_WITHOUT_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor { @@ -273,7 +274,7 @@ static MAP_WITHOUT_SUBMIT: GpuTestConfiguration = /// This test tries to build a pipeline from a shader module with a /// 32-byte variable and a bindgroup layout with a min_binding_size of /// 16 for that variable's group/index. Pipeline creation should fail. -#[gpu_test] +#[apply(gpu_test!)] static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().test_features_limits().enable_noop()) .run_sync(|ctx| { @@ -343,7 +344,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfigu /// variable with a bindgroup layout with a min_binding_size of zero /// (meaning, "validate at dispatch recording time") and a 16-byte /// binding. Command recording should fail. -#[gpu_test] +#[apply(gpu_test!)] static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().test_features_limits().enable_noop()) .run_sync(|ctx| { @@ -440,7 +441,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfi ); }); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -465,7 +466,7 @@ static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfi ); }); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_OFFSET_PLUS_SIZE_OUTSIDE_U64_BOUNDS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) diff --git a/tests/tests/wgpu-gpu/buffer_copy.rs b/tests/tests/wgpu-gpu/buffer_copy.rs index a3091d216..5819a8899 100644 --- a/tests/tests/wgpu-gpu/buffer_copy.rs +++ b/tests/tests/wgpu-gpu/buffer_copy.rs @@ -2,7 +2,9 @@ use wgpu::BufferAddress; -use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{ + apply, fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, +}; pub fn all_tests(vec: &mut Vec) { vec.push(COPY_ALIGNMENT); @@ -25,7 +27,7 @@ fn try_copy( ); } -#[gpu_test] +#[apply(gpu_test!)] static COPY_ALIGNMENT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/buffer_resource_limits.rs b/tests/tests/wgpu-gpu/buffer_resource_limits.rs index cc7008f03..41528d5e8 100644 --- a/tests/tests/wgpu-gpu/buffer_resource_limits.rs +++ b/tests/tests/wgpu-gpu/buffer_resource_limits.rs @@ -1,339 +1,340 @@ -/// Tests for `max_buffers_and_acceleration_structures_per_shader_stage`. -/// -/// This limit only has a meaningful finite value on Metal (non-strict mode), where all buffer -/// types (storage, uniform, vertex buffers, acceleration structures) share a single argument -/// table of 31 slots with 2 reserved for internal use, leaving 29 user-visible slots. -/// -/// On all other backends the limit is `u32::MAX`, so these tests are skipped there to avoid -/// hitting other, lower per-type limits while trying to reach the combined limit. -use wgpu_test::{ - fail, gpu_test, valid, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, -}; - -pub fn all_tests(vec: &mut Vec) { - vec.extend([ - BUFFERS_AND_ACCEL_STRUCTS_VALID_WITHIN_LIMIT, - BUFFERS_AND_ACCEL_STRUCTS_VALID_VERTEX_STAGE_AT_LIMIT, - BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_SINGLE_BGL, - BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_ACROSS_BGLS, - BUFFERS_AND_ACCEL_STRUCTS_VERTEX_STAGE_EXCEEDS_WITH_VERTEX_BUFFERS, - ]); -} - -/// Skip on every backend except Metal. The combined limit is `u32::MAX` on other backends, -/// so reaching it would require an impractical number of resources and would run into the -/// individual per-type limits instead. -fn skip_non_metal() -> FailureCase { - FailureCase::backend(!wgpu::Backends::METAL) -} - -/// Device limits that reflect Metal's combined buffer slot constraint. -/// -/// `max_buffers_and_acceleration_structures_per_shader_stage` is set to 29 (Metal's limit). -/// The per-type limits are raised above the default 8/12 so that tests can exercise the -/// *combined* limit without being blocked by an individual per-type limit first. -/// -/// Setting `max_storage_buffers_per_shader_stage: 29` also means the test is automatically -/// skipped on Metal in STRICT_WEBGPU_COMPLIANCE mode, where the adapter only supports 8. -fn metal_limits() -> wgpu::Limits { - wgpu::Limits { - max_storage_buffers_per_shader_stage: 29, - max_uniform_buffers_per_shader_stage: 29, - max_vertex_buffers: 16, - max_buffers_and_acceleration_structures_per_shader_stage: 29, - ..wgpu::Limits::defaults() - } -} - -fn storage_entries(n: u32, visibility: wgpu::ShaderStages) -> Vec { - (0..n) - .map(|i| wgpu::BindGroupLayoutEntry { - binding: i, - visibility, - ty: wgpu::BindingType::Buffer { - ty: wgpu::BufferBindingType::Storage { read_only: true }, - has_dynamic_offset: false, - min_binding_size: None, - }, - count: None, - }) - .collect() -} - -fn uniform_entries( - n: u32, - binding_offset: u32, - visibility: wgpu::ShaderStages, -) -> Vec { - (0..n) - .map(|i| wgpu::BindGroupLayoutEntry { - binding: binding_offset + i, - visibility, - ty: wgpu::BindingType::Buffer { - ty: wgpu::BufferBindingType::Uniform, - has_dynamic_offset: false, - min_binding_size: None, - }, - count: None, - }) - .collect() -} - -/// 14 storage + 14 uniform = 28 combined in a BGL. -/// Pipeline layout creation must succeed since 28 < 29. -#[gpu_test] -static BUFFERS_AND_ACCEL_STRUCTS_VALID_WITHIN_LIMIT: GpuTestConfiguration = - GpuTestConfiguration::new() - .parameters( - TestParameters::default() - .limits(metal_limits()) - .skip(skip_non_metal()), - ) - .run_sync(|ctx| { - let mut entries = storage_entries(14, wgpu::ShaderStages::COMPUTE); - entries.extend(uniform_entries(14, 14, wgpu::ShaderStages::COMPUTE)); - - valid(&ctx.device, || { - let bgl = ctx - .device - .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: None, - entries: &entries, - }); - let _ = ctx - .device - .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: None, - bind_group_layouts: &[Some(&bgl)], - immediate_size: 0, - }); - }); - }); - -/// 20 storage buffers + 9 vertex buffers = 29 combined. -/// Render pipeline creation must succeed since 29 == limit. -#[gpu_test] -static BUFFERS_AND_ACCEL_STRUCTS_VALID_VERTEX_STAGE_AT_LIMIT: GpuTestConfiguration = - GpuTestConfiguration::new() - .parameters( - TestParameters::default() - .limits(metal_limits()) - .skip(skip_non_metal()), - ) - .run_sync(|ctx| { - let entries = storage_entries(20, wgpu::ShaderStages::VERTEX); - - let bgl = ctx - .device - .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: None, - entries: &entries, - }); - let pipeline_layout = - ctx.device - .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: None, - bind_group_layouts: &[Some(&bgl)], - immediate_size: 0, - }); - - let shader = ctx - .device - .create_shader_module(wgpu::ShaderModuleDescriptor { - label: None, - source: wgpu::ShaderSource::Wgsl( - "@vertex fn vs() -> @builtin(position) vec4f { return vec4f(0.0); } - @fragment fn fs() -> @location(0) vec4f { return vec4f(0.0); }" - .into(), - ), - }); - - const EMPTY_VB: Option> = - Some(wgpu::VertexBufferLayout { - array_stride: 4, - step_mode: wgpu::VertexStepMode::Vertex, - attributes: &[], - }); - - valid(&ctx.device, || { - let _ = ctx - .device - .create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: None, - layout: Some(&pipeline_layout), - vertex: wgpu::VertexState { - module: &shader, - entry_point: Some("vs"), - compilation_options: Default::default(), - buffers: &[EMPTY_VB; 9], - }, - fragment: Some(wgpu::FragmentState { - module: &shader, - entry_point: Some("fs"), - compilation_options: Default::default(), - targets: &[Some(wgpu::ColorTargetState { - format: wgpu::TextureFormat::Rgba8Unorm, - blend: None, - write_mask: wgpu::ColorWrites::ALL, - })], - }), - primitive: wgpu::PrimitiveState::default(), - depth_stencil: None, - multisample: wgpu::MultisampleState::default(), - multiview_mask: None, - cache: None, - }); - }); - }); - -/// 15 storage + 15 uniform = 30 combined in a single BGL. -/// Must fail at BGL creation since the combined limit is 29. -#[gpu_test] -static BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_SINGLE_BGL: GpuTestConfiguration = - GpuTestConfiguration::new() - .parameters( - TestParameters::default() - .limits(metal_limits()) - .skip(skip_non_metal()), - ) - .run_sync(|ctx| { - let mut entries = storage_entries(15, wgpu::ShaderStages::COMPUTE); - entries.extend(uniform_entries(15, 15, wgpu::ShaderStages::COMPUTE)); - - fail( - &ctx.device, - || { - let _ = ctx - .device - .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: None, - entries: &entries, - }); - }, - Some("max_buffers_and_acceleration_structures_per_shader_stage"), - ); - }); - -/// Two BGLs where one has 15 storage buffers and the other has 15 uniform -/// buffers. Each individual BGL is within the combined limit, and neither -/// per-type limit is exceeded across both BGLs. However their combined use -/// in a pipeline layout adds up to 30 total buffer slots, exceeding the limit. -#[gpu_test] -static BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_ACROSS_BGLS: GpuTestConfiguration = - GpuTestConfiguration::new() - .parameters( - TestParameters::default() - .limits(metal_limits()) - .skip(skip_non_metal()), - ) - .run_sync(|ctx| { - let storage = storage_entries(15, wgpu::ShaderStages::COMPUTE); - let uniform = uniform_entries(15, 0, wgpu::ShaderStages::COMPUTE); - - let bgl_a = ctx - .device - .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: Some("bgl_a"), - entries: &storage, - }); - let bgl_b = ctx - .device - .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: Some("bgl_b"), - entries: &uniform, - }); - - fail( - &ctx.device, - || { - let _ = ctx - .device - .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: None, - bind_group_layouts: &[Some(&bgl_a), Some(&bgl_b)], - immediate_size: 0, - }); - }, - Some("max_buffers_and_acceleration_structures_per_shader_stage"), - ); - }); - -/// 20 storage buffers + 10 vertex buffers = 30 combined in the vertex stage, -/// which exceeds the limit of 29. Render pipeline creation must fail. -#[gpu_test] -static BUFFERS_AND_ACCEL_STRUCTS_VERTEX_STAGE_EXCEEDS_WITH_VERTEX_BUFFERS: GpuTestConfiguration = - GpuTestConfiguration::new() - .parameters( - TestParameters::default() - .limits(metal_limits()) - .skip(skip_non_metal()), - ) - .run_sync(|ctx| { - let entries = storage_entries(20, wgpu::ShaderStages::VERTEX); - - let bgl = ctx - .device - .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { - label: None, - entries: &entries, - }); - let pipeline_layout = - ctx.device - .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: None, - bind_group_layouts: &[Some(&bgl)], - immediate_size: 0, - }); - - let shader = ctx - .device - .create_shader_module(wgpu::ShaderModuleDescriptor { - label: None, - source: wgpu::ShaderSource::Wgsl( - "@vertex fn vs() -> @builtin(position) vec4f { return vec4f(0.0); } - @fragment fn fs() -> @location(0) vec4f { return vec4f(0.0); }" - .into(), - ), - }); - - const EMPTY_VB: Option> = - Some(wgpu::VertexBufferLayout { - array_stride: 4, - step_mode: wgpu::VertexStepMode::Vertex, - attributes: &[], - }); - - fail( - &ctx.device, - || { - let _ = ctx - .device - .create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: None, - layout: Some(&pipeline_layout), - vertex: wgpu::VertexState { - module: &shader, - entry_point: Some("vs"), - compilation_options: Default::default(), - buffers: &[EMPTY_VB; 10], - }, - fragment: Some(wgpu::FragmentState { - module: &shader, - entry_point: Some("fs"), - compilation_options: Default::default(), - targets: &[Some(wgpu::ColorTargetState { - format: wgpu::TextureFormat::Rgba8Unorm, - blend: None, - write_mask: wgpu::ColorWrites::ALL, - })], - }), - primitive: wgpu::PrimitiveState::default(), - depth_stencil: None, - multisample: wgpu::MultisampleState::default(), - multiview_mask: None, - cache: None, - }); - }, - Some("vertex-stage buffers and acceleration structures"), - ); - }); +/// Tests for `max_buffers_and_acceleration_structures_per_shader_stage`. +/// +/// This limit only has a meaningful finite value on Metal (non-strict mode), where all buffer +/// types (storage, uniform, vertex buffers, acceleration structures) share a single argument +/// table of 31 slots with 2 reserved for internal use, leaving 29 user-visible slots. +/// +/// On all other backends the limit is `u32::MAX`, so these tests are skipped there to avoid +/// hitting other, lower per-type limits while trying to reach the combined limit. +use wgpu_test::{ + apply, fail, gpu_test, valid, FailureCase, GpuTestConfiguration, GpuTestInitializer, + TestParameters, +}; + +pub fn all_tests(vec: &mut Vec) { + vec.extend([ + BUFFERS_AND_ACCEL_STRUCTS_VALID_WITHIN_LIMIT, + BUFFERS_AND_ACCEL_STRUCTS_VALID_VERTEX_STAGE_AT_LIMIT, + BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_SINGLE_BGL, + BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_ACROSS_BGLS, + BUFFERS_AND_ACCEL_STRUCTS_VERTEX_STAGE_EXCEEDS_WITH_VERTEX_BUFFERS, + ]); +} + +/// Skip on every backend except Metal. The combined limit is `u32::MAX` on other backends, +/// so reaching it would require an impractical number of resources and would run into the +/// individual per-type limits instead. +fn skip_non_metal() -> FailureCase { + FailureCase::backend(!wgpu::Backends::METAL) +} + +/// Device limits that reflect Metal's combined buffer slot constraint. +/// +/// `max_buffers_and_acceleration_structures_per_shader_stage` is set to 29 (Metal's limit). +/// The per-type limits are raised above the default 8/12 so that tests can exercise the +/// *combined* limit without being blocked by an individual per-type limit first. +/// +/// Setting `max_storage_buffers_per_shader_stage: 29` also means the test is automatically +/// skipped on Metal in STRICT_WEBGPU_COMPLIANCE mode, where the adapter only supports 8. +fn metal_limits() -> wgpu::Limits { + wgpu::Limits { + max_storage_buffers_per_shader_stage: 29, + max_uniform_buffers_per_shader_stage: 29, + max_vertex_buffers: 16, + max_buffers_and_acceleration_structures_per_shader_stage: 29, + ..wgpu::Limits::defaults() + } +} + +fn storage_entries(n: u32, visibility: wgpu::ShaderStages) -> Vec { + (0..n) + .map(|i| wgpu::BindGroupLayoutEntry { + binding: i, + visibility, + ty: wgpu::BindingType::Buffer { + ty: wgpu::BufferBindingType::Storage { read_only: true }, + has_dynamic_offset: false, + min_binding_size: None, + }, + count: None, + }) + .collect() +} + +fn uniform_entries( + n: u32, + binding_offset: u32, + visibility: wgpu::ShaderStages, +) -> Vec { + (0..n) + .map(|i| wgpu::BindGroupLayoutEntry { + binding: binding_offset + i, + visibility, + ty: wgpu::BindingType::Buffer { + ty: wgpu::BufferBindingType::Uniform, + has_dynamic_offset: false, + min_binding_size: None, + }, + count: None, + }) + .collect() +} + +/// 14 storage + 14 uniform = 28 combined in a BGL. +/// Pipeline layout creation must succeed since 28 < 29. +#[apply(gpu_test!)] +static BUFFERS_AND_ACCEL_STRUCTS_VALID_WITHIN_LIMIT: GpuTestConfiguration = + GpuTestConfiguration::new() + .parameters( + TestParameters::default() + .limits(metal_limits()) + .skip(skip_non_metal()), + ) + .run_sync(|ctx| { + let mut entries = storage_entries(14, wgpu::ShaderStages::COMPUTE); + entries.extend(uniform_entries(14, 14, wgpu::ShaderStages::COMPUTE)); + + valid(&ctx.device, || { + let bgl = ctx + .device + .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: None, + entries: &entries, + }); + let _ = ctx + .device + .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: None, + bind_group_layouts: &[Some(&bgl)], + immediate_size: 0, + }); + }); + }); + +/// 20 storage buffers + 9 vertex buffers = 29 combined. +/// Render pipeline creation must succeed since 29 == limit. +#[apply(gpu_test!)] +static BUFFERS_AND_ACCEL_STRUCTS_VALID_VERTEX_STAGE_AT_LIMIT: GpuTestConfiguration = + GpuTestConfiguration::new() + .parameters( + TestParameters::default() + .limits(metal_limits()) + .skip(skip_non_metal()), + ) + .run_sync(|ctx| { + let entries = storage_entries(20, wgpu::ShaderStages::VERTEX); + + let bgl = ctx + .device + .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: None, + entries: &entries, + }); + let pipeline_layout = + ctx.device + .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: None, + bind_group_layouts: &[Some(&bgl)], + immediate_size: 0, + }); + + let shader = ctx + .device + .create_shader_module(wgpu::ShaderModuleDescriptor { + label: None, + source: wgpu::ShaderSource::Wgsl( + "@vertex fn vs() -> @builtin(position) vec4f { return vec4f(0.0); } + @fragment fn fs() -> @location(0) vec4f { return vec4f(0.0); }" + .into(), + ), + }); + + const EMPTY_VB: Option> = + Some(wgpu::VertexBufferLayout { + array_stride: 4, + step_mode: wgpu::VertexStepMode::Vertex, + attributes: &[], + }); + + valid(&ctx.device, || { + let _ = ctx + .device + .create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: None, + layout: Some(&pipeline_layout), + vertex: wgpu::VertexState { + module: &shader, + entry_point: Some("vs"), + compilation_options: Default::default(), + buffers: &[EMPTY_VB; 9], + }, + fragment: Some(wgpu::FragmentState { + module: &shader, + entry_point: Some("fs"), + compilation_options: Default::default(), + targets: &[Some(wgpu::ColorTargetState { + format: wgpu::TextureFormat::Rgba8Unorm, + blend: None, + write_mask: wgpu::ColorWrites::ALL, + })], + }), + primitive: wgpu::PrimitiveState::default(), + depth_stencil: None, + multisample: wgpu::MultisampleState::default(), + multiview_mask: None, + cache: None, + }); + }); + }); + +/// 15 storage + 15 uniform = 30 combined in a single BGL. +/// Must fail at BGL creation since the combined limit is 29. +#[apply(gpu_test!)] +static BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_SINGLE_BGL: GpuTestConfiguration = + GpuTestConfiguration::new() + .parameters( + TestParameters::default() + .limits(metal_limits()) + .skip(skip_non_metal()), + ) + .run_sync(|ctx| { + let mut entries = storage_entries(15, wgpu::ShaderStages::COMPUTE); + entries.extend(uniform_entries(15, 15, wgpu::ShaderStages::COMPUTE)); + + fail( + &ctx.device, + || { + let _ = ctx + .device + .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: None, + entries: &entries, + }); + }, + Some("max_buffers_and_acceleration_structures_per_shader_stage"), + ); + }); + +/// Two BGLs where one has 15 storage buffers and the other has 15 uniform +/// buffers. Each individual BGL is within the combined limit, and neither +/// per-type limit is exceeded across both BGLs. However their combined use +/// in a pipeline layout adds up to 30 total buffer slots, exceeding the limit. +#[apply(gpu_test!)] +static BUFFERS_AND_ACCEL_STRUCTS_EXCEEDS_ACROSS_BGLS: GpuTestConfiguration = + GpuTestConfiguration::new() + .parameters( + TestParameters::default() + .limits(metal_limits()) + .skip(skip_non_metal()), + ) + .run_sync(|ctx| { + let storage = storage_entries(15, wgpu::ShaderStages::COMPUTE); + let uniform = uniform_entries(15, 0, wgpu::ShaderStages::COMPUTE); + + let bgl_a = ctx + .device + .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: Some("bgl_a"), + entries: &storage, + }); + let bgl_b = ctx + .device + .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: Some("bgl_b"), + entries: &uniform, + }); + + fail( + &ctx.device, + || { + let _ = ctx + .device + .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: None, + bind_group_layouts: &[Some(&bgl_a), Some(&bgl_b)], + immediate_size: 0, + }); + }, + Some("max_buffers_and_acceleration_structures_per_shader_stage"), + ); + }); + +/// 20 storage buffers + 10 vertex buffers = 30 combined in the vertex stage, +/// which exceeds the limit of 29. Render pipeline creation must fail. +#[apply(gpu_test!)] +static BUFFERS_AND_ACCEL_STRUCTS_VERTEX_STAGE_EXCEEDS_WITH_VERTEX_BUFFERS: GpuTestConfiguration = + GpuTestConfiguration::new() + .parameters( + TestParameters::default() + .limits(metal_limits()) + .skip(skip_non_metal()), + ) + .run_sync(|ctx| { + let entries = storage_entries(20, wgpu::ShaderStages::VERTEX); + + let bgl = ctx + .device + .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: None, + entries: &entries, + }); + let pipeline_layout = + ctx.device + .create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { + label: None, + bind_group_layouts: &[Some(&bgl)], + immediate_size: 0, + }); + + let shader = ctx + .device + .create_shader_module(wgpu::ShaderModuleDescriptor { + label: None, + source: wgpu::ShaderSource::Wgsl( + "@vertex fn vs() -> @builtin(position) vec4f { return vec4f(0.0); } + @fragment fn fs() -> @location(0) vec4f { return vec4f(0.0); }" + .into(), + ), + }); + + const EMPTY_VB: Option> = + Some(wgpu::VertexBufferLayout { + array_stride: 4, + step_mode: wgpu::VertexStepMode::Vertex, + attributes: &[], + }); + + fail( + &ctx.device, + || { + let _ = ctx + .device + .create_render_pipeline(&wgpu::RenderPipelineDescriptor { + label: None, + layout: Some(&pipeline_layout), + vertex: wgpu::VertexState { + module: &shader, + entry_point: Some("vs"), + compilation_options: Default::default(), + buffers: &[EMPTY_VB; 10], + }, + fragment: Some(wgpu::FragmentState { + module: &shader, + entry_point: Some("fs"), + compilation_options: Default::default(), + targets: &[Some(wgpu::ColorTargetState { + format: wgpu::TextureFormat::Rgba8Unorm, + blend: None, + write_mask: wgpu::ColorWrites::ALL, + })], + }), + primitive: wgpu::PrimitiveState::default(), + depth_stencil: None, + multisample: wgpu::MultisampleState::default(), + multiview_mask: None, + cache: None, + }); + }, + Some("vertex-stage buffers and acceleration structures"), + ); + }); diff --git a/tests/tests/wgpu-gpu/buffer_usages.rs b/tests/tests/wgpu-gpu/buffer_usages.rs index f099c207d..4df07a754 100644 --- a/tests/tests/wgpu-gpu/buffer_usages.rs +++ b/tests/tests/wgpu-gpu/buffer_usages.rs @@ -3,7 +3,8 @@ use wgpu::BufferAddress; use wgpu::{BufferUsages as Bu, MapMode as Ma}; use wgpu_test::{ - fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -58,7 +59,7 @@ fn try_create(ctx: TestingContext, usages: &[(bool, &[wgpu::BufferUsages])]) { } } -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_USAGE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -72,7 +73,7 @@ static BUFFER_USAGE: GpuTestConfiguration = GpuTestConfiguration::new() ); }); -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_USAGE_MAPPABLE_PRIMARY_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -175,7 +176,7 @@ async fn map_test( } } -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_MAP_ASYNC_MAP_STATE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/clear_texture.rs b/tests/tests/wgpu-gpu/clear_texture.rs index aee78b2a0..48e9931ec 100644 --- a/tests/tests/wgpu-gpu/clear_texture.rs +++ b/tests/tests/wgpu-gpu/clear_texture.rs @@ -1,5 +1,5 @@ use wgpu_test::{ - gpu_test, image::ReadbackBuffers, FailureCase, GpuTestConfiguration, GpuTestInitializer, + apply, gpu_test, image::ReadbackBuffers, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -337,7 +337,7 @@ async fn clear_texture_tests(ctx: TestingContext, formats: &'static [wgpu::Textu } } -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_UNCOMPRESSED_GLES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -346,7 +346,7 @@ static CLEAR_TEXTURE_UNCOMPRESSED_GLES: GpuTestConfiguration = GpuTestConfigurat ) .run_async(|ctx| clear_texture_tests(ctx, TEXTURE_FORMATS_UNCOMPRESSED_GLES_COMPAT)); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_UNCOMPRESSED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -361,7 +361,7 @@ static CLEAR_TEXTURE_UNCOMPRESSED: GpuTestConfiguration = GpuTestConfiguration:: ) .run_async(|ctx| clear_texture_tests(ctx, TEXTURE_FORMATS_UNCOMPRESSED)); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_DEPTH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -377,7 +377,7 @@ static CLEAR_TEXTURE_DEPTH: GpuTestConfiguration = GpuTestConfiguration::new() ) .run_async(|ctx| clear_texture_tests(ctx, TEXTURE_FORMATS_DEPTH)); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_DEPTH32_STENCIL8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -388,7 +388,7 @@ static CLEAR_TEXTURE_DEPTH32_STENCIL8: GpuTestConfiguration = GpuTestConfigurati ) .run_async(|ctx| clear_texture_tests(ctx, &[wgpu::TextureFormat::Depth32FloatStencil8])); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_COMPRESSED_BCN: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -408,7 +408,7 @@ static CLEAR_TEXTURE_COMPRESSED_BCN: GpuTestConfiguration = GpuTestConfiguration ) .run_async(|ctx| clear_texture_tests(ctx, TEXTURE_FORMATS_BC)); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_COMPRESSED_ASTC: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -429,7 +429,7 @@ static CLEAR_TEXTURE_COMPRESSED_ASTC: GpuTestConfiguration = GpuTestConfiguratio ) .run_async(|ctx| clear_texture_tests(ctx, TEXTURE_FORMATS_ASTC)); -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_TEXTURE_COMPRESSED_ETC2: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/clip_distances.rs b/tests/tests/wgpu-gpu/clip_distances.rs index 0cdc703f6..d68a49141 100644 --- a/tests/tests/wgpu-gpu/clip_distances.rs +++ b/tests/tests/wgpu-gpu/clip_distances.rs @@ -1,12 +1,12 @@ use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { vec.push(CLIP_DISTANCES); } -#[gpu_test] +#[apply(gpu_test!)] static CLIP_DISTANCES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/cloneable_types.rs b/tests/tests/wgpu-gpu/cloneable_types.rs index 1c9831b6d..d99ec70ce 100644 --- a/tests/tests/wgpu-gpu/cloneable_types.rs +++ b/tests/tests/wgpu-gpu/cloneable_types.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestInitializer, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestInitializer, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(CLONEABLE_BUFFERS); } -#[gpu_test] +#[apply(gpu_test!)] static CLONEABLE_BUFFERS: GpuTestConfiguration = wgpu_test::GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(cloneable_buffers); diff --git a/tests/tests/wgpu-gpu/compute_pass_ownership.rs b/tests/tests/wgpu-gpu/compute_pass_ownership.rs index 4e1330331..4fd884e21 100644 --- a/tests/tests/wgpu-gpu/compute_pass_ownership.rs +++ b/tests/tests/wgpu-gpu/compute_pass_ownership.rs @@ -5,7 +5,8 @@ use std::num::NonZeroU64; use wgpu::util::DeviceExt as _; use wgpu_test::{ - gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -26,7 +27,7 @@ var buffer: array; } "; -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PASS_RESOURCE_OWNERSHIP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -71,7 +72,7 @@ async fn compute_pass_resource_ownership(ctx: TestingContext) { assert_compute_pass_executed_normally(encoder, gpu_buffer, cpu_buffer, buffer_size, ctx).await; } -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PASS_QUERY_SET_OWNERSHIP_PIPELINE_STATISTICS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -121,7 +122,7 @@ async fn compute_pass_query_set_ownership_pipeline_statistics(ctx: TestingContex assert_compute_pass_executed_normally(encoder, gpu_buffer, cpu_buffer, buffer_size, ctx).await; } -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PASS_QUERY_SET_OWNERSHIP_TIMESTAMPS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().test_features_limits().features( @@ -179,7 +180,7 @@ async fn compute_pass_query_set_ownership_timestamps(ctx: TestingContext) { assert_compute_pass_executed_normally(encoder, gpu_buffer, cpu_buffer, buffer_size, ctx).await; } -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PASS_KEEP_ENCODER_ALIVE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/compute_pass_transition_resources.rs b/tests/tests/wgpu-gpu/compute_pass_transition_resources.rs index ea1d5fb7a..a24970122 100644 --- a/tests/tests/wgpu-gpu/compute_pass_transition_resources.rs +++ b/tests/tests/wgpu-gpu/compute_pass_transition_resources.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(COMPUTE_PASS_TRANSITION_RESOURCES); } -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PASS_TRANSITION_RESOURCES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/create_surface_error.rs b/tests/tests/wgpu-gpu/create_surface_error.rs index af5cf4891..93ae371d7 100644 --- a/tests/tests/wgpu-gpu/create_surface_error.rs +++ b/tests/tests/wgpu-gpu/create_surface_error.rs @@ -2,7 +2,7 @@ #![cfg(wasm_test)] use wgpu_test::GpuTestInitializer; -use wgpu_test::{gpu_test, GpuTestConfiguration}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration}; pub fn all_tests(vec: &mut Vec) { vec.push(CANVAS_GET_CONTEXT_RETURNED_NULL); @@ -10,7 +10,7 @@ pub fn all_tests(vec: &mut Vec) { /// This test applies to those cfgs that can create a surface from a canvas, which /// include WebGL and WebGPU, but *not* Emscripten GLES. -#[gpu_test] +#[apply(gpu_test!)] static CANVAS_GET_CONTEXT_RETURNED_NULL: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(wgpu_test::TestParameters::default().enable_noop()) .run_async(|_ctx| async move { diff --git a/tests/tests/wgpu-gpu/device.rs b/tests/tests/wgpu-gpu/device.rs index c5428e9ce..e8783d225 100644 --- a/tests/tests/wgpu-gpu/device.rs +++ b/tests/tests/wgpu-gpu/device.rs @@ -1,7 +1,8 @@ use std::sync::atomic::AtomicBool; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -21,7 +22,7 @@ pub fn all_tests(vec: &mut Vec) { } } -#[gpu_test] +#[apply(gpu_test!)] static CROSS_DEVICE_BIND_GROUP_USAGE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -52,7 +53,7 @@ static CROSS_DEVICE_BIND_GROUP_USAGE: GpuTestConfiguration = GpuTestConfiguratio }); #[cfg(not(wasm_test))] -#[gpu_test] +#[apply(gpu_test!)] static DEVICE_LIFETIME_CHECK: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -79,7 +80,7 @@ static DEVICE_LIFETIME_CHECK: GpuTestConfiguration = GpuTestConfiguration::new() }); #[cfg(not(wasm_test))] -#[gpu_test] +#[apply(gpu_test!)] static MULTIPLE_DEVICES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -102,7 +103,7 @@ static MULTIPLE_DEVICES: GpuTestConfiguration = GpuTestConfiguration::new() .expect("failed to create device"); }); -#[gpu_test] +#[apply(gpu_test!)] static REQUEST_DEVICE_ERROR_MESSAGE_NATIVE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters({ let default = TestParameters::default(); @@ -167,7 +168,7 @@ async fn request_device_error_message() { // This is a test of device behavior after `device.destroy()`. Specifically, all operations // should turn into no-ops, per spec. -#[gpu_test] +#[apply(gpu_test!)] static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -484,7 +485,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne buffer_for_unmap.unmap(); }); -#[gpu_test] +#[apply(gpu_test!)] static DEVICE_DESTROY_THEN_LOST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -519,7 +520,7 @@ static DEVICE_DESTROY_THEN_LOST: GpuTestConfiguration = GpuTestConfiguration::ne ); }); -#[gpu_test] +#[apply(gpu_test!)] static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -646,7 +647,7 @@ static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConf }); }); -#[gpu_test] +#[apply(gpu_test!)] static DEVICE_DESTROY_THEN_BUFFER_CLEANUP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -685,7 +686,7 @@ static DEVICE_DESTROY_THEN_BUFFER_CLEANUP: GpuTestConfiguration = GpuTestConfigu ctx.instance.poll_all(true); }); -#[gpu_test] +#[apply(gpu_test!)] static DEVICE_AND_QUEUE_HAVE_DIFFERENT_IDS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { diff --git a/tests/tests/wgpu-gpu/dispatch_workgroups_indirect.rs b/tests/tests/wgpu-gpu/dispatch_workgroups_indirect.rs index e471bee8e..dece7c26a 100644 --- a/tests/tests/wgpu-gpu/dispatch_workgroups_indirect.rs +++ b/tests/tests/wgpu-gpu/dispatch_workgroups_indirect.rs @@ -1,5 +1,5 @@ use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -12,7 +12,7 @@ pub fn all_tests(vec: &mut Vec) { } /// Make sure that the num_workgroups builtin works properly (it requires a workaround on D3D12). -#[gpu_test] +#[apply(gpu_test!)] static NUM_WORKGROUPS_BUILTIN: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -32,7 +32,7 @@ static NUM_WORKGROUPS_BUILTIN: GpuTestConfiguration = GpuTestConfiguration::new( }); /// Make sure that we discard (don't run) the dispatch if its size exceeds the device limit. -#[gpu_test] +#[apply(gpu_test!)] static DISCARD_DISPATCH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -63,7 +63,7 @@ static DISCARD_DISPATCH: GpuTestConfiguration = GpuTestConfiguration::new() }); /// Make sure that resetting the bind groups set by the validation code works properly. -#[gpu_test] +#[apply(gpu_test!)] static RESET_BIND_GROUPS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -105,7 +105,7 @@ static RESET_BIND_GROUPS: GpuTestConfiguration = GpuTestConfiguration::new() }); /// Make sure that zero sized buffer validation is raised. -#[gpu_test] +#[apply(gpu_test!)] static ZERO_SIZED_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/draw_index.rs b/tests/tests/wgpu-gpu/draw_index.rs index 7acd3dc06..a177f9f93 100644 --- a/tests/tests/wgpu-gpu/draw_index.rs +++ b/tests/tests/wgpu-gpu/draw_index.rs @@ -4,7 +4,8 @@ use wgpu::{ TextureFormat, VertexState, }; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -64,7 +65,7 @@ fn fragment() -> @location(0) vec4 { }); } -#[gpu_test] +#[apply(gpu_test!)] static DRAW_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -187,17 +188,17 @@ fn mesh_params() -> TestParameters { .limits(Limits::defaults().using_recommended_minimum_mesh_shader_values()) } -#[gpu_test] +#[apply(gpu_test!)] static DRAW_INDEX_TASK_NO_MESH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(mesh_params()) .run_async(async |ctx| test_mesh(ctx, true, false).await); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_INDEX_MESH_NO_TASK: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(mesh_params()) .run_async(async |ctx| test_mesh(ctx, false, true).await); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_INDEX_MESH_TASK: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(mesh_params().expect_fail(FailureCase::always())) .run_async(async |ctx| test_mesh(ctx, true, true).await); diff --git a/tests/tests/wgpu-gpu/draw_indirect.rs b/tests/tests/wgpu-gpu/draw_indirect.rs index 391253c3d..8fbcb4e3f 100644 --- a/tests/tests/wgpu-gpu/draw_indirect.rs +++ b/tests/tests/wgpu-gpu/draw_indirect.rs @@ -3,7 +3,7 @@ use wgpu::{ vertex_attr_array, }; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -363,7 +363,7 @@ macro_rules! make_test { make_test!($name, $test_data, false, $features); }; ($name:ident, $test_data:expr, $expect_noop:expr, $features:expr) => { - #[gpu_test] + #[apply(gpu_test!)] static $name: GpuTestConfiguration = GpuTestConfiguration::new() .parameters({ let params = TestParameters::default() @@ -596,7 +596,7 @@ make_failing_test!( get_instanced_indexed_draw_test_data(0, 6, 0, 5) ); -#[gpu_test] +#[apply(gpu_test!)] static INDIRECT_BUFFER_OFFSETS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -816,7 +816,7 @@ async fn indirect_buffer_offsets(ctx: TestingContext) { assert!(succeeded); } -#[gpu_test] +#[apply(gpu_test!)] static MULTI_DRAW_INDEXED_INDIRECT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -825,7 +825,7 @@ static MULTI_DRAW_INDEXED_INDIRECT: GpuTestConfiguration = GpuTestConfiguration: ) .run_async(|ctx| run_test_inner(ctx, get_indexed_draw_test_data(0, 6), false, true)); -#[gpu_test] +#[apply(gpu_test!)] static MULTI_DRAW_INDIRECT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/dual_source_blending.rs b/tests/tests/wgpu-gpu/dual_source_blending.rs index e9e714263..58ea75d5e 100644 --- a/tests/tests/wgpu-gpu/dual_source_blending.rs +++ b/tests/tests/wgpu-gpu/dual_source_blending.rs @@ -1,6 +1,6 @@ use wgpu::*; use wgpu_test::{ - fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -53,7 +53,7 @@ fn blend_state_with_dual_source_blending() -> BlendState { } } -#[gpu_test] +#[apply(gpu_test!)] static DUAL_SOURCE_BLENDING_FEATURE_DISABLED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(dual_source_blending_disabled); @@ -116,7 +116,7 @@ async fn dual_source_blending_disabled(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static DUAL_SOURCE_BLENDING_FEATURE_ENABLED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/encoder.rs b/tests/tests/wgpu-gpu/encoder.rs index 7036a0241..f1c5355cd 100644 --- a/tests/tests/wgpu-gpu/encoder.rs +++ b/tests/tests/wgpu-gpu/encoder.rs @@ -1,7 +1,7 @@ use wgpu::util::DeviceExt; use wgpu::CommandEncoder; use wgpu_test::{ - fail, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + apply, fail, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -14,7 +14,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static DROP_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -24,7 +24,7 @@ static DROP_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new() drop(encoder); }); -#[gpu_test] +#[apply(gpu_test!)] static DROP_QUEUE_BEFORE_CREATING_COMMAND_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -42,7 +42,7 @@ static DROP_QUEUE_BEFORE_CREATING_COMMAND_ENCODER: GpuTestConfiguration = device.create_command_encoder(&wgpu::CommandEncoderDescriptor::default()); }); -#[gpu_test] +#[apply(gpu_test!)] static DROP_ENCODER_AFTER_ERROR: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -87,7 +87,7 @@ static DROP_ENCODER_AFTER_ERROR: GpuTestConfiguration = GpuTestConfiguration::ne fail(&ctx.device, || encoder.finish(), Some("less than zero")); }); -#[gpu_test] +#[apply(gpu_test!)] static ENCODER_OPERATIONS_FAIL_WHILE_PASS_ALIVE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/external_image_copy.rs b/tests/tests/wgpu-gpu/external_image_copy.rs index 1c6d41aff..db29330d2 100644 --- a/tests/tests/wgpu-gpu/external_image_copy.rs +++ b/tests/tests/wgpu-gpu/external_image_copy.rs @@ -2,9 +2,9 @@ use wasm_bindgen::JsCast; use wgpu::ExternalImageSource; -use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration}; +use wgpu_test::{apply, fail_if, gpu_test, GpuTestConfiguration}; -#[gpu_test] +#[apply(gpu_test!)] static IMAGE_BITMAP_IMPORT: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { let image_encoded = include_bytes!("3x3_colors.png"); diff --git a/tests/tests/wgpu-gpu/external_texture/mod.rs b/tests/tests/wgpu-gpu/external_texture/mod.rs index a71bac422..3019f7906 100644 --- a/tests/tests/wgpu-gpu/external_texture/mod.rs +++ b/tests/tests/wgpu-gpu/external_texture/mod.rs @@ -1,6 +1,6 @@ use approx::assert_abs_diff_eq; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -412,7 +412,7 @@ fn get_samples( /// Tests that `textureDimensions()` returns the correct value for both external textures /// and texture views bound to an external texture binding. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_DIMENSIONS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -463,7 +463,7 @@ static EXTERNAL_TEXTURE_DIMENSIONS: GpuTestConfiguration = GpuTestConfiguration: /// Tests that `textureLoad()` returns the correct values for both RGBA format external /// textures and texture views bound to an external texture binding. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_LOAD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -514,7 +514,7 @@ static EXTERNAL_TEXTURE_LOAD: GpuTestConfiguration = GpuTestConfiguration::new() /// Tests that `textureLoad()` returns the correct values for YUV format external /// textures. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_LOAD_YUV: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -585,7 +585,7 @@ static EXTERNAL_TEXTURE_LOAD_YUV: GpuTestConfiguration = GpuTestConfiguration::n /// Tests that `textureLoad()` returns the correct values for external textures with /// various load transforms. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_LOAD_TRANSFORM: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -761,7 +761,7 @@ static EXTERNAL_TEXTURE_LOAD_TRANSFORM: GpuTestConfiguration = GpuTestConfigurat }); /// Tests that `textureLoad()` for an invalid address returns an allowed value. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_LOAD_INVALID_ADDRESS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -819,7 +819,7 @@ static EXTERNAL_TEXTURE_LOAD_INVALID_ADDRESS: GpuTestConfiguration = GpuTestConf /// Tests that `textureSampleBaseClampToEdge()` returns the correct values for both RGBA /// format external textures and texture views bound to an external texture binding. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_SAMPLE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -870,7 +870,7 @@ static EXTERNAL_TEXTURE_SAMPLE: GpuTestConfiguration = GpuTestConfiguration::new /// Tests that `textureSampleBaseClampToEdge()` returns the correct values for YUV /// format external textures. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_SAMPLE_YUV: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -946,7 +946,7 @@ static EXTERNAL_TEXTURE_SAMPLE_YUV: GpuTestConfiguration = GpuTestConfiguration: /// Tests that `textureSampleBaseClampToEdge()` returns the correct values for external /// textures with various sample transforms. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_SAMPLE_TRANSFORM: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/float32_filterable.rs b/tests/tests/wgpu-gpu/float32_filterable.rs index c18a3e641..d524f6669 100644 --- a/tests/tests/wgpu-gpu/float32_filterable.rs +++ b/tests/tests/wgpu-gpu/float32_filterable.rs @@ -1,6 +1,6 @@ //! Tests for FLOAT32_FILTERABLE feature. -use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -51,7 +51,7 @@ fn create_texture_binding(device: &wgpu::Device, format: wgpu::TextureFormat, fi }); } -#[gpu_test] +#[apply(gpu_test!)] static FLOAT32_FILTERABLE_WITHOUT_FEATURE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -78,7 +78,7 @@ static FLOAT32_FILTERABLE_WITHOUT_FEATURE: GpuTestConfiguration = GpuTestConfigu ); }); -#[gpu_test] +#[apply(gpu_test!)] static FLOAT32_FILTERABLE_WITH_FEATURE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/image_atomics/mod.rs b/tests/tests/wgpu-gpu/image_atomics/mod.rs index 816ce80cf..c5ad9bea2 100644 --- a/tests/tests/wgpu-gpu/image_atomics/mod.rs +++ b/tests/tests/wgpu-gpu/image_atomics/mod.rs @@ -2,7 +2,7 @@ use wgpu::ShaderModuleDescriptor; use wgpu_test::{ - fail, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, + apply, fail, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -15,7 +15,7 @@ pub fn all_tests(tests: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static IMAGE_64_ATOMICS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -43,7 +43,7 @@ static IMAGE_64_ATOMICS: GpuTestConfiguration = GpuTestConfiguration::new() .await; }); -#[gpu_test] +#[apply(gpu_test!)] static IMAGE_32_ATOMICS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -170,7 +170,7 @@ async fn test_format( readback_buffers.assert_buffer_contents(&ctx, &data).await; } -#[gpu_test] +#[apply(gpu_test!)] static IMAGE_ATOMICS_NOT_ENABLED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -198,7 +198,7 @@ static IMAGE_ATOMICS_NOT_ENABLED: GpuTestConfiguration = GpuTestConfiguration::n ); }); -#[gpu_test] +#[apply(gpu_test!)] static IMAGE_ATOMICS_NOT_SUPPORTED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().features(wgpu::Features::TEXTURE_ATOMIC).enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/immediates.rs b/tests/tests/wgpu-gpu/immediates.rs index 29b14e70c..70caf9f6d 100644 --- a/tests/tests/wgpu-gpu/immediates.rs +++ b/tests/tests/wgpu-gpu/immediates.rs @@ -4,7 +4,7 @@ use std::num::NonZeroU64; use wgpu::util::RenderEncoder; use wgpu::*; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -18,7 +18,7 @@ pub fn all_tests(vec: &mut Vec) { /// /// If the update code is working correctly, the values not written to by the second update /// will remain unchanged. -#[gpu_test] +#[apply(gpu_test!)] static PARTIAL_UPDATE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -159,7 +159,7 @@ async fn partial_update_test(ctx: TestingContext) { // second 4 floats the first update assert_eq!(floats, [1.0, 2.0, 3.0, 4.0, 1.0, 5.0, 3.0, 4.0]); } -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PASS_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/instance.rs b/tests/tests/wgpu-gpu/instance.rs index adab85f2a..2d7a0e6a6 100644 --- a/tests/tests/wgpu-gpu/instance.rs +++ b/tests/tests/wgpu-gpu/instance.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(INITIALIZE); } -#[gpu_test] +#[apply(gpu_test!)] static INITIALIZE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|_ctx| {}); diff --git a/tests/tests/wgpu-gpu/life_cycle.rs b/tests/tests/wgpu-gpu/life_cycle.rs index 2812603cb..2f16357f2 100644 --- a/tests/tests/wgpu-gpu/life_cycle.rs +++ b/tests/tests/wgpu-gpu/life_cycle.rs @@ -1,7 +1,7 @@ use wgpu::util::DeviceExt; use wgpu::{ComputePassTimestampWrites, QueryType, RenderPassTimestampWrites}; use wgpu_test::{ - fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -19,7 +19,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -97,7 +97,7 @@ static BUFFER_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new() .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -413,7 +413,7 @@ fn test_buffer_destroy_before_submit(ctx: &TestingContext, usage: UsageKind) { } // Test that destroying a buffer between command encoding and submission fails gracefully. -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -483,7 +483,7 @@ fn test_buffer_destroy_after_submit(ctx: &TestingContext, usage: UsageKind) { } // Test that destroying a buffer between submission and GPU completion is handled correctly. -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_DESTROY_AFTER_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -590,7 +590,7 @@ fn test_texture_destroy_before_submit(ctx: &TestingContext, usage: UsageKind) { } // Test that destroying a texture between command encoding and submission fails gracefully. -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -692,7 +692,7 @@ fn test_texture_destroy_after_submit(ctx: &TestingContext, usage: UsageKind) { } // Test that destroying a texture between submission and GPU completion is handled correctly. -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_DESTROY_AFTER_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -763,7 +763,7 @@ fn test_external_texture_destroy_before_submit(ctx: &TestingContext, usage: Usag // Test that destroying an external texture between command encoding and submission fails // gracefully. -#[gpu_test] +#[apply(gpu_test!)] static EXTERNAL_TEXTURE_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -856,7 +856,7 @@ fn test_query_set_destroy_before_submit(ctx: &TestingContext, ty: QueryType, usa // Test that destroying a query set between command encoding and submission fails // gracefully. -#[gpu_test] +#[apply(gpu_test!)] static QUERY_SET_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -947,7 +947,7 @@ fn test_query_set_destroy_after_submit(ctx: &TestingContext, ty: QueryType, usag } // Test that destroying a query set between submission and GPU completion is handled correctly. -#[gpu_test] +#[apply(gpu_test!)] static QUERY_SET_DESTROY_AFTER_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -1085,7 +1085,7 @@ fn test_replaced_bind_group(ctx: &TestingContext, usage: UsageKind) { /// Test that bind groups that are replaced before use in a draw/dispatch are still /// considered in submit-time liveness checks. -#[gpu_test] +#[apply(gpu_test!)] static REPLACED_BIND_GROUP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/mem_leaks.rs b/tests/tests/wgpu-gpu/mem_leaks.rs index 3f4b0ecdf..22e6ab944 100644 --- a/tests/tests/wgpu-gpu/mem_leaks.rs +++ b/tests/tests/wgpu-gpu/mem_leaks.rs @@ -308,7 +308,7 @@ async fn draw_test_with_reports( target_os = "emscripten", feature = "webgl" ))] -#[wgpu_test::gpu_test] +#[wgpu_test::apply(wgpu_test::gpu_test!)] static SIMPLE_DRAW_CHECK_MEM_LEAKS: wgpu_test::GpuTestConfiguration = wgpu_test::GpuTestConfiguration::new() .parameters( diff --git a/tests/tests/wgpu-gpu/mesh_shader/mod.rs b/tests/tests/wgpu-gpu/mesh_shader/mod.rs index 2e774fe4a..e3afbee1e 100644 --- a/tests/tests/wgpu-gpu/mesh_shader/mod.rs +++ b/tests/tests/wgpu-gpu/mesh_shader/mod.rs @@ -1,6 +1,6 @@ use wgpu::util::DeviceExt; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -269,7 +269,7 @@ fn default_gpu_test_config(draw_type: DrawType) -> GpuTestConfiguration { ) } -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_PIPELINE_BASIC_MESH: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_pipeline_build( @@ -282,7 +282,7 @@ pub static MESH_PIPELINE_BASIC_MESH: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_PIPELINE_BASIC_TASK_MESH: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_pipeline_build( @@ -295,7 +295,7 @@ pub static MESH_PIPELINE_BASIC_TASK_MESH: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_PIPELINE_BASIC_MESH_FRAG: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_pipeline_build( @@ -308,7 +308,7 @@ pub static MESH_PIPELINE_BASIC_MESH_FRAG: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_PIPELINE_BASIC_TASK_MESH_FRAG: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_pipeline_build( @@ -321,7 +321,7 @@ pub static MESH_PIPELINE_BASIC_TASK_MESH_FRAG: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_PIPELINE_BASIC_MESH_NO_DRAW: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_pipeline_build( @@ -334,7 +334,7 @@ pub static MESH_PIPELINE_BASIC_MESH_NO_DRAW: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_PIPELINE_BASIC_TASK_MESH_FRAG_NO_DRAW: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_pipeline_build( @@ -349,7 +349,7 @@ pub static MESH_PIPELINE_BASIC_TASK_MESH_FRAG_NO_DRAW: GpuTestConfiguration = }); // Mesh draw -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_DRAW: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard).run_sync(|ctx| { mesh_draw( @@ -363,7 +363,7 @@ pub static MESH_DRAW: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_DRAW_NO_TASK: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard) .run_sync(|ctx| { mesh_draw( @@ -377,7 +377,7 @@ pub static MESH_DRAW_NO_TASK: GpuTestConfiguration = default_gpu_test_config(Dra }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_DRAW_DIVERGENT: GpuTestConfiguration = default_gpu_test_config(DrawType::Standard) .run_sync(|ctx| { mesh_draw( @@ -391,7 +391,7 @@ pub static MESH_DRAW_DIVERGENT: GpuTestConfiguration = default_gpu_test_config(D }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_DRAW_INDIRECT: GpuTestConfiguration = default_gpu_test_config(DrawType::Indirect) .run_sync(|ctx| { mesh_draw( @@ -405,7 +405,7 @@ pub static MESH_DRAW_INDIRECT: GpuTestConfiguration = default_gpu_test_config(Dr }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_MULTI_DRAW_INDIRECT: GpuTestConfiguration = default_gpu_test_config(DrawType::MultiIndirect).run_sync(|ctx| { mesh_draw( @@ -419,7 +419,7 @@ pub static MESH_MULTI_DRAW_INDIRECT: GpuTestConfiguration = }, ); }); -#[gpu_test] +#[apply(gpu_test!)] pub static MESH_MULTI_DRAW_INDIRECT_COUNT: GpuTestConfiguration = default_gpu_test_config(DrawType::MultiIndirectCount).run_sync(|ctx| { mesh_draw( diff --git a/tests/tests/wgpu-gpu/multiview/mod.rs b/tests/tests/wgpu-gpu/multiview/mod.rs index f4f2afe93..60b305156 100644 --- a/tests/tests/wgpu-gpu/multiview/mod.rs +++ b/tests/tests/wgpu-gpu/multiview/mod.rs @@ -2,7 +2,8 @@ use std::num::NonZero; use wgpu::{Features, Limits}; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -12,7 +13,7 @@ pub fn all_tests(vec: &mut Vec) { vec.push(DRAW_MULTIVIEW_MULTISAMPLE); } -#[gpu_test] +#[apply(gpu_test!)] static DRAW_MULTIVIEW_SINGLE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -24,7 +25,7 @@ static DRAW_MULTIVIEW_SINGLE: GpuTestConfiguration = GpuTestConfiguration::new() ) .run_async(|ctx| run_test(ctx, 0b1, 1)); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_MULTIVIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -36,7 +37,7 @@ static DRAW_MULTIVIEW: GpuTestConfiguration = GpuTestConfiguration::new() ) .run_async(|ctx| run_test(ctx, 0b11, 1)); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_MULTIVIEW_NONCONTIGUOUS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters { required_features: Features::MULTIVIEW | Features::SELECTIVE_MULTIVIEW, @@ -64,7 +65,7 @@ static DRAW_MULTIVIEW_NONCONTIGUOUS: GpuTestConfiguration = GpuTestConfiguration }) .run_async(|ctx| run_test(ctx, 0b1001, 1)); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_MULTIVIEW_MULTISAMPLE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/naga_capabilities.rs b/tests/tests/wgpu-gpu/naga_capabilities.rs index d6c4e3114..e44dabc58 100644 --- a/tests/tests/wgpu-gpu/naga_capabilities.rs +++ b/tests/tests/wgpu-gpu/naga_capabilities.rs @@ -1,5 +1,5 @@ use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -30,7 +30,7 @@ pub fn validate_capabilities(ctx: TestingContext) { assert_eq!(diff, Caps::empty()); } -#[gpu_test] +#[apply(gpu_test!)] static VALIDATE_CAPABILITIES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/occlusion_query/mod.rs b/tests/tests/wgpu-gpu/occlusion_query/mod.rs index 1a888aff4..2cb979e71 100644 --- a/tests/tests/wgpu-gpu/occlusion_query/mod.rs +++ b/tests/tests/wgpu-gpu/occlusion_query/mod.rs @@ -1,11 +1,13 @@ use wgpu::InstanceFlags; -use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{ + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, +}; pub fn all_tests(vec: &mut Vec) { vec.push(OCCLUSION_QUERY); } -#[gpu_test] +#[apply(gpu_test!)] static OCCLUSION_QUERY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/oob_indexing.rs b/tests/tests/wgpu-gpu/oob_indexing.rs index ef06ec8a0..c29e97b60 100644 --- a/tests/tests/wgpu-gpu/oob_indexing.rs +++ b/tests/tests/wgpu-gpu/oob_indexing.rs @@ -1,5 +1,7 @@ use wgpu::{Backend, Backends}; -use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{ + apply, gpu_test, FailureCase, GpuTestConfiguration, TestParameters, TestingContext, +}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -12,7 +14,7 @@ pub fn all_tests(vec: &mut Vec) { /// Tests that writing and reading to the max length of a container (vec, mat, array) /// in the workgroup, private and function address spaces + let declarations /// will instead write to and read from the last element. -#[gpu_test] +#[apply(gpu_test!)] static RESTRICT_WORKGROUP_PRIVATE_FUNCTION_LET: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -254,7 +256,7 @@ impl TestResources { /// /// This test is specific to D3D12 since Vulkan and Metal behave differently and /// the WGSL spec allows for multiple behaviors when it comes to OOB accesses. -#[gpu_test] +#[apply(gpu_test!)] static D3D12_RESTRICT_DYNAMIC_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -509,7 +511,7 @@ async fn d3d12_restrict_dynamic_buffers(ctx: TestingContext) { /// equals the binding size and neither problem occurs. The test is expected to /// fail on D3D12 until the backend clamps the SRV/UAV to the binding size and /// communicates that size to the shader for `arrayLength`. -#[gpu_test] +#[apply(gpu_test!)] static DYNAMIC_STORAGE_BUFFER_BINDING_SIZE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/oom.rs b/tests/tests/wgpu-gpu/oom.rs index 9970d5c34..773c3b06e 100644 --- a/tests/tests/wgpu-gpu/oom.rs +++ b/tests/tests/wgpu-gpu/oom.rs @@ -6,7 +6,7 @@ use wgpu::{ TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, VertexFormat, }; use wgpu_test::GpuTestInitializer; -use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, TestParameters}; +use wgpu_test::{apply, gpu_test, FailureCase, GpuTestConfiguration, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -35,7 +35,7 @@ const QUERY_SET_OOM_DETECTION_IMPL: Backends = Backends::DX12; /// Nr of resources tests will try to create before failing. const LOOP_BOUND: u32 = 1_000_000; -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -74,7 +74,7 @@ static TEXTURE_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() panic!("Failed to OOM after {LOOP_BOUND} iterations."); }); -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -105,7 +105,7 @@ static BUFFER_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() panic!("Failed to OOM after {LOOP_BOUND} iterations."); }); -#[gpu_test] +#[apply(gpu_test!)] static MAPPING_BUFFER_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -136,7 +136,7 @@ static MAPPING_BUFFER_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new panic!("Failed to OOM after {LOOP_BOUND} iterations."); }); -#[gpu_test] +#[apply(gpu_test!)] static QUERY_SET_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -167,7 +167,7 @@ static QUERY_SET_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() panic!("Failed to OOM after {LOOP_BOUND} iterations."); }); -#[gpu_test] +#[apply(gpu_test!)] static BLAS_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -209,7 +209,7 @@ static BLAS_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() panic!("Failed to OOM after {LOOP_BOUND} iterations."); }); -#[gpu_test] +#[apply(gpu_test!)] static TLAS_OOM_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/pass_ops/mod.rs b/tests/tests/wgpu-gpu/pass_ops/mod.rs index c16559136..d9483746c 100644 --- a/tests/tests/wgpu-gpu/pass_ops/mod.rs +++ b/tests/tests/wgpu-gpu/pass_ops/mod.rs @@ -1,5 +1,5 @@ use wgpu_test::{ - fail, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, + apply, fail, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -12,7 +12,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static DONT_CARE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(dont_care); @@ -115,7 +115,7 @@ async fn dont_care(ctx: TestingContext) { .await; } -#[gpu_test] +#[apply(gpu_test!)] static DONT_CARE_COLOR_STRICT_WEBGPU_COMPLIANCE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -160,7 +160,7 @@ static DONT_CARE_COLOR_STRICT_WEBGPU_COMPLIANCE: GpuTestConfiguration = GpuTestC ); }); -#[gpu_test] +#[apply(gpu_test!)] static DONT_CARE_DEPTH_STRICT_WEBGPU_COMPLIANCE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -204,7 +204,7 @@ static DONT_CARE_DEPTH_STRICT_WEBGPU_COMPLIANCE: GpuTestConfiguration = GpuTestC ); }); -#[gpu_test] +#[apply(gpu_test!)] static DONT_CARE_STENCIL_STRICT_WEBGPU_COMPLIANCE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( diff --git a/tests/tests/wgpu-gpu/passthrough/mod.rs b/tests/tests/wgpu-gpu/passthrough/mod.rs index 33e9658b3..916445ade 100644 --- a/tests/tests/wgpu-gpu/passthrough/mod.rs +++ b/tests/tests/wgpu-gpu/passthrough/mod.rs @@ -8,7 +8,8 @@ use wgpu::{ PipelineLayoutDescriptor, RenderPipelineDescriptor, VertexState, }; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; use wgpu_types::CreateShaderModuleDescriptorPassthrough; @@ -95,7 +96,7 @@ fn metal_test(ctx: TestingContext) { test_with_module(ctx, module.clone(), module); } -#[gpu_test] +#[apply(gpu_test!)] static METAL_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -206,7 +207,7 @@ fn metallib_test(ctx: TestingContext) { test_with_module(ctx, module.clone(), module); } -#[gpu_test] +#[apply(gpu_test!)] static METALLIB_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -240,7 +241,7 @@ fn hlsl_test(ctx: TestingContext) { test_with_module(ctx, module.clone(), module); } -#[gpu_test] +#[apply(gpu_test!)] static HLSL_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -326,7 +327,7 @@ fn dxil_test(ctx: TestingContext) { test_with_module(ctx, vertex, fragment); } -#[gpu_test] +#[apply(gpu_test!)] static DXIL_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -391,7 +392,7 @@ fn spirv_test(ctx: TestingContext) { test_with_module(ctx, module.clone(), module); } -#[gpu_test] +#[apply(gpu_test!)] static SPIRV_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -454,7 +455,7 @@ fn glsl_test(ctx: TestingContext) { test_with_module(ctx, vertex, fragment); } -#[gpu_test] +#[apply(gpu_test!)] static GLSL_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -478,7 +479,7 @@ fn wgsl_test(ctx: TestingContext) { test_with_module(ctx, module.clone(), module); } -#[gpu_test] +#[apply(gpu_test!)] static WGSL_PASSTHROUGH_SHADER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -520,7 +521,7 @@ fn all_passthrough_shaders_binary(ctx: TestingContext) { test_with_module(ctx, vertex, fragment); } -#[gpu_test] +#[apply(gpu_test!)] static ALL_PASSTHROUGH_SHADERS_BINARY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().features(Features::PASSTHROUGH_SHADERS)) .run_sync(all_passthrough_shaders_binary); @@ -554,7 +555,7 @@ fn all_passthrough_shader_source(ctx: TestingContext) { test_with_module(ctx, vertex, fragment); } -#[gpu_test] +#[apply(gpu_test!)] static ALL_PASSTHROUGH_SHADERS_SOURCE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().features(Features::PASSTHROUGH_SHADERS)) .run_sync(all_passthrough_shader_source); @@ -615,7 +616,7 @@ fn explicit_layout_validation(ctx: TestingContext) { }); } -#[gpu_test] +#[apply(gpu_test!)] static PASSTHROUGH_SHADERS_EXPLICIT_LAYOUT_VALIDATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( diff --git a/tests/tests/wgpu-gpu/per_vertex/mod.rs b/tests/tests/wgpu-gpu/per_vertex/mod.rs index de55f7bd7..70c891260 100644 --- a/tests/tests/wgpu-gpu/per_vertex/mod.rs +++ b/tests/tests/wgpu-gpu/per_vertex/mod.rs @@ -1,5 +1,5 @@ use wgpu::util::DeviceExt; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(PER_VERTEX); @@ -30,7 +30,7 @@ pub fn all_tests(vec: &mut Vec) { // return vec4(z[0], z[1], z[2], 1.0); // -#[gpu_test] +#[apply(gpu_test!)] static PER_VERTEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/pipeline.rs b/tests/tests/wgpu-gpu/pipeline.rs index 7ee1941e2..4ad735f29 100644 --- a/tests/tests/wgpu-gpu/pipeline.rs +++ b/tests/tests/wgpu-gpu/pipeline.rs @@ -1,4 +1,4 @@ -use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -39,7 +39,7 @@ const TRIVIAL_FRAGMENT_SHADER_DESC: wgpu::ShaderModuleDescriptor = wgpu::ShaderM // Create an invalid shader and a compute pipeline that uses it // with a default bindgroup layout, and then ask for that layout. // Validation should fail, but wgpu should not panic. -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) @@ -67,7 +67,7 @@ static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -98,7 +98,7 @@ static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) @@ -133,7 +133,7 @@ static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -184,7 +184,7 @@ static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static NO_TARGETLESS_RENDER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/pipeline_cache.rs b/tests/tests/wgpu-gpu/pipeline_cache.rs index e409c7a8a..a67b8df67 100644 --- a/tests/tests/wgpu-gpu/pipeline_cache.rs +++ b/tests/tests/wgpu-gpu/pipeline_cache.rs @@ -1,6 +1,6 @@ use std::{fmt::Write, num::NonZeroU64}; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(PIPELINE_CACHE); @@ -11,7 +11,7 @@ pub fn all_tests(vec: &mut Vec) { /// It would be nice if we could also assert that reusing a pipeline cache would make compilation /// be faster however, some drivers use a fallback pipeline cache, which makes this inconsistent /// (both intra- and inter-run). -#[gpu_test] +#[apply(gpu_test!)] static PIPELINE_CACHE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/planar_texture/mod.rs b/tests/tests/wgpu-gpu/planar_texture/mod.rs index 72adad460..2734e9467 100644 --- a/tests/tests/wgpu-gpu/planar_texture/mod.rs +++ b/tests/tests/wgpu-gpu/planar_texture/mod.rs @@ -1,7 +1,7 @@ //! Tests for nv12 texture creation and sampling. use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -222,7 +222,7 @@ fn test_planar_texture_rendering( /// Ensures that creation and sampling of an NV12 format texture works as /// expected. -#[gpu_test] +#[apply(gpu_test!)] static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -263,7 +263,7 @@ static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati /// Ensures that creation and sampling of a P010 format texture works as /// expected. -#[gpu_test] +#[apply(gpu_test!)] static P010_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -305,7 +305,7 @@ static P010_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati }); /// Ensures that rendering on to NV12 format texture works as expected. -#[gpu_test] +#[apply(gpu_test!)] static NV12_TEXTURE_RENDERING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -349,7 +349,7 @@ static NV12_TEXTURE_RENDERING: GpuTestConfiguration = GpuTestConfiguration::new( }); /// Ensures that copying NV12 texture to NV12 texture works as expected -#[gpu_test] +#[apply(gpu_test!)] static NV12_TEXTURE_COPYING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -400,7 +400,7 @@ static NV12_TEXTURE_COPYING: GpuTestConfiguration = GpuTestConfiguration::new() /// single-plane destination (Plane0 → R8Unorm, Plane1 → Rg8Unorm) round-trips /// byte-for-byte. Exercises the planar→single-plane copy-compatibility /// extension in `copy_texture_to_texture`. -#[gpu_test] +#[apply(gpu_test!)] static NV12_PLANE_TO_SINGLE_PLANE_COPY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().features(wgpu::Features::TEXTURE_FORMAT_NV12)) .run_async(|ctx| async move { @@ -605,7 +605,7 @@ static NV12_PLANE_TO_SINGLE_PLANE_COPY: GpuTestConfiguration = GpuTestConfigurat }); /// Ensures that copying P010 texture to P010 texture works as expected -#[gpu_test] +#[apply(gpu_test!)] static P010_TEXTURE_COPYING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/poll.rs b/tests/tests/wgpu-gpu/poll.rs index 08035db6a..512c1b4be 100644 --- a/tests/tests/wgpu-gpu/poll.rs +++ b/tests/tests/wgpu-gpu/poll.rs @@ -8,7 +8,8 @@ use wgpu::{ }; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -72,7 +73,7 @@ fn generate_dummy_work(ctx: &TestingContext) -> CommandBuffer { cmd_buf.finish() } -#[gpu_test] +#[apply(gpu_test!)] static WAIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -97,7 +98,7 @@ static WAIT: GpuTestConfiguration = GpuTestConfiguration::new() /// proposes propagating the failure by losing the device. If that is implemented, this test /// should be updated accordingly. Care may be needed to avoid flakiness in cases where no /// termination occurs. -#[gpu_test] +#[apply(gpu_test!)] static WAIT_INDEFINITELY_LONG_RUNNING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -191,7 +192,7 @@ fn main(@builtin(global_invocation_id) gid: vec3) { ctx.async_poll(PollType::wait_indefinitely()).await.unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static WAIT_WITH_TIMEOUT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -206,7 +207,7 @@ static WAIT_WITH_TIMEOUT: GpuTestConfiguration = GpuTestConfiguration::new() .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static WAIT_WITH_TIMEOUT_MAX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -221,7 +222,7 @@ static WAIT_WITH_TIMEOUT_MAX: GpuTestConfiguration = GpuTestConfiguration::new() .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static DOUBLE_WAIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -242,7 +243,7 @@ static DOUBLE_WAIT: GpuTestConfiguration = GpuTestConfiguration::new() .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static WAIT_ON_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -257,7 +258,7 @@ static WAIT_ON_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new() .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static WAIT_ON_SUBMISSION_WITH_TIMEOUT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -272,7 +273,7 @@ static WAIT_ON_SUBMISSION_WITH_TIMEOUT: GpuTestConfiguration = GpuTestConfigurat .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static WAIT_ON_SUBMISSION_WITH_TIMEOUT_MAX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -287,7 +288,7 @@ static WAIT_ON_SUBMISSION_WITH_TIMEOUT_MAX: GpuTestConfiguration = GpuTestConfig .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static DOUBLE_WAIT_ON_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -308,7 +309,7 @@ static DOUBLE_WAIT_ON_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::n .unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static WAIT_OUT_OF_ORDER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -335,7 +336,7 @@ static WAIT_OUT_OF_ORDER: GpuTestConfiguration = GpuTestConfiguration::new() /// /// We can't catch panics on Wasm, since they get reported directly to the /// console. -#[gpu_test] +#[apply(gpu_test!)] static WAIT_AFTER_BAD_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( wgpu_test::TestParameters::default() @@ -383,7 +384,7 @@ async fn wait_after_bad_submission(ctx: TestingContext) { /// > `fence`. /// /// Regression test for . -#[gpu_test] +#[apply(gpu_test!)] static WAIT_ON_FAILED_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(wgpu_test::TestParameters::default()) .run_async(wait_on_failed_submission); diff --git a/tests/tests/wgpu-gpu/primitive_index.rs b/tests/tests/wgpu-gpu/primitive_index.rs index c58b6b119..af0897623 100644 --- a/tests/tests/wgpu-gpu/primitive_index.rs +++ b/tests/tests/wgpu-gpu/primitive_index.rs @@ -3,7 +3,8 @@ use wgpu::{ MeshState, RenderPipelineDescriptor, ShaderModuleDescriptor, TextureFormat, VertexState, }; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(tests: &mut Vec) { @@ -58,7 +59,7 @@ fn fragment(@builtin(primitive_index) index: u32) -> @location(0) vec4 { }); } -#[gpu_test] +#[apply(gpu_test!)] static PRIMITIVE_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().features(Features::PRIMITIVE_INDEX)) .run_async(primitive_index); @@ -155,17 +156,17 @@ fn mesh_params() -> TestParameters { )) } -#[gpu_test] +#[apply(gpu_test!)] static PRIMITIVE_INDEX_MESH_FRAGMENT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(mesh_params()) .run_async(async |ctx| mesh_primitive_index(ctx, true, true).await); -#[gpu_test] +#[apply(gpu_test!)] static PRIMITIVE_INDEX_MESH_NOT_FRAGMENT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(mesh_params().expect_fail(FailureCase::always())) .run_async(async |ctx| mesh_primitive_index(ctx, true, false).await); -#[gpu_test] +#[apply(gpu_test!)] static PRIMITIVE_INDEX_FRAGMENT_NOT_MESH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(mesh_params().expect_fail(FailureCase::always())) .run_async(async |ctx| mesh_primitive_index(ctx, false, true).await); diff --git a/tests/tests/wgpu-gpu/query_set.rs b/tests/tests/wgpu-gpu/query_set.rs index a1aed7cba..66478a356 100644 --- a/tests/tests/wgpu-gpu/query_set.rs +++ b/tests/tests/wgpu-gpu/query_set.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(DROP_FAILED_TIMESTAMP_QUERY_SET); } -#[gpu_test] +#[apply(gpu_test!)] static DROP_FAILED_TIMESTAMP_QUERY_SET: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/queue_transfer.rs b/tests/tests/wgpu-gpu/queue_transfer.rs index ffff6f2d9..cae7a64ea 100644 --- a/tests/tests/wgpu-gpu/queue_transfer.rs +++ b/tests/tests/wgpu-gpu/queue_transfer.rs @@ -1,7 +1,7 @@ //! Tests for buffer copy validation. use wgpu::PollType; -use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -11,7 +11,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static QUEUE_WRITE_TEXTURE_THEN_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -61,7 +61,7 @@ static QUEUE_WRITE_TEXTURE_THEN_DESTROY: GpuTestConfiguration = GpuTestConfigura ctx.device.poll(PollType::wait_indefinitely()).unwrap(); }); -#[gpu_test] +#[apply(gpu_test!)] static QUEUE_WRITE_TEXTURE_OVERFLOW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -110,7 +110,7 @@ static QUEUE_WRITE_TEXTURE_OVERFLOW: GpuTestConfiguration = GpuTestConfiguration ); }); -#[gpu_test] +#[apply(gpu_test!)] static QUEUE_WRITE_TEXTURE_BUFFER_OOB: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| { // Test that transfers overrunning the end of the source buffer, or diff --git a/tests/tests/wgpu-gpu/ray_tracing/as_aabb.rs b/tests/tests/wgpu-gpu/ray_tracing/as_aabb.rs index d9e173e66..0816e4cdf 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/as_aabb.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/as_aabb.rs @@ -12,7 +12,7 @@ use wgpu::{ }; use wgpu::{BindGroupDescriptor, BindGroupEntry, BindingResource, BufferDescriptor}; use wgpu_test::{ - fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; #[repr(C)] @@ -41,7 +41,7 @@ fn aabb_size_desc(primitive_count: u32) -> BlasAABBGeometrySizeDescriptor { } } -#[gpu_test] +#[apply(gpu_test!)] static AABB_BLAS_BUILD_AND_TRACE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -158,7 +158,7 @@ fn aabb_blas_build_and_trace(ctx: TestingContext) { ctx.queue.submit([encoder.finish()]); } -#[gpu_test] +#[apply(gpu_test!)] static AABB_UNALIGNED_PRIMITIVE_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -207,7 +207,7 @@ fn aabb_unaligned_primitive_offset(ctx: TestingContext) { fail(&ctx.device, || encoder.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static AABB_INVALID_STRIDE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -258,7 +258,7 @@ fn aabb_invalid_stride(ctx: TestingContext) { fail(&ctx.device, || encoder.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static AABB_GEOMETRY_KIND_MISMATCH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -358,7 +358,7 @@ fn aabb_geometry_kind_mismatch(ctx: TestingContext) { fail(&ctx.device, || encoder.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static AABB_INSUFFICIENT_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -407,7 +407,7 @@ fn aabb_insufficient_buffer(ctx: TestingContext) { fail(&ctx.device, || encoder.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static AABB_PRIMITIVE_COUNT_EXCEEDS_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -467,7 +467,7 @@ fn aabb_primitive_count_exceeds_creation(ctx: TestingContext) { fail(&ctx.device, || encoder.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static AABB_FLAGS_MISMATCH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/ray_tracing/as_build.rs b/tests/tests/wgpu-gpu/ray_tracing/as_build.rs index 3d5228c02..88010133f 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/as_build.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/as_build.rs @@ -4,7 +4,7 @@ use crate::ray_tracing::{acceleration_structure_limits, AsBuildContext}; use wgpu::util::{BufferInitDescriptor, DeviceExt}; use wgpu::*; use wgpu_test::{ - fail, fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, + apply, fail, fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -28,7 +28,7 @@ pub fn all_tests(tests: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static UNBUILT_BLAS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -61,7 +61,7 @@ fn unbuilt_blas(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static UNBUILT_BLAS_COMPACTION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -89,7 +89,7 @@ fn unbuilt_blas_compaction(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static BLAS_COMPACTION_WITHOUT_FLAGS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -124,7 +124,7 @@ fn blas_compaction_without_flags(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static UNPREPARED_BLAS_COMPACTION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -153,7 +153,7 @@ fn unprepared_blas_compaction(ctx: TestingContext) { fail(&ctx.device, || ctx.queue.compact_blas(&as_ctx.blas), None); } -#[gpu_test] +#[apply(gpu_test!)] static BLAS_COMPACTION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -210,7 +210,7 @@ fn blas_compaction(ctx: TestingContext) { fail(&ctx.device, || fail_encoder.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static OUT_OF_ORDER_AS_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -292,7 +292,7 @@ fn out_of_order_as_build(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static OUT_OF_ORDER_AS_BUILD_USE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -475,7 +475,7 @@ fn out_of_order_as_build_use(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static EMPTY_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -497,7 +497,7 @@ fn empty_build(ctx: TestingContext) { ctx.queue.submit([encoder_safe.finish()]); } -#[gpu_test] +#[apply(gpu_test!)] static BUILD_WITH_TRANSFORM: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -583,7 +583,7 @@ fn build_with_transform(ctx: TestingContext) { ctx.queue.submit([encoder_build.finish()]); } -#[gpu_test] +#[apply(gpu_test!)] static ONLY_BLAS_VERTEX_RETURN: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -707,7 +707,7 @@ fn only_blas_vertex_return(ctx: TestingContext) { } } -#[gpu_test] +#[apply(gpu_test!)] static ONLY_TLAS_VERTEX_RETURN: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -747,7 +747,7 @@ fn only_tlas_vertex_return(ctx: TestingContext) { fail(&ctx.device, || encoder_tlas.finish(), None); } -#[gpu_test] +#[apply(gpu_test!)] static EXTRA_FORMAT_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -761,7 +761,7 @@ static EXTRA_FORMAT_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() ) .run_sync(|ctx| test_as_build_format_stride(ctx, VertexFormat::Snorm16x4, 6, false)); -#[gpu_test] +#[apply(gpu_test!)] static MISALIGNED_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -773,7 +773,7 @@ static MISALIGNED_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() // Larger than the minimum size, but not aligned as required .run_sync(|ctx| test_as_build_format_stride(ctx, VertexFormat::Float32x3, 13, true)); -#[gpu_test] +#[apply(gpu_test!)] static TOO_SMALL_STRIDE_BUILD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -849,7 +849,7 @@ fn test_as_build_format_stride( } } -#[gpu_test] +#[apply(gpu_test!)] static BLAS_FIRST_VERTEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/ray_tracing/as_create.rs b/tests/tests/wgpu-gpu/ray_tracing/as_create.rs index 8f424c5f1..312523e62 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/as_create.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/as_create.rs @@ -5,8 +5,7 @@ use wgpu::{ BlasTriangleGeometrySizeDescriptor, CreateBlasDescriptor, }; use wgpu::{IndexFormat, VertexFormat}; -use wgpu_macros::gpu_test; -use wgpu_test::{fail, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(tests: &mut Vec) { tests.extend([ @@ -16,7 +15,7 @@ pub fn all_tests(tests: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static BLAS_INVALID_VERTEX_FORMAT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -58,7 +57,7 @@ fn invalid_vertex_format_blas_create(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static BLAS_MISMATCHED_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -129,7 +128,7 @@ fn mismatched_index_blas_create(ctx: TestingContext) { ); } -#[gpu_test] +#[apply(gpu_test!)] static UNSUPPORTED_ACCELERATION_STRUCTURE_RESOURCES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().test_features_limits()) diff --git a/tests/tests/wgpu-gpu/ray_tracing/as_use_after_free.rs b/tests/tests/wgpu-gpu/ray_tracing/as_use_after_free.rs index e5213b3e3..365b10386 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/as_use_after_free.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/as_use_after_free.rs @@ -10,8 +10,7 @@ use wgpu::{ ComputePassDescriptor, ComputePipelineDescriptor, CreateBlasDescriptor, CreateTlasDescriptor, PollType, TlasInstance, VertexFormat, }; -use wgpu_macros::gpu_test; -use wgpu_test::{GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(tests: &mut Vec) { tests.push(ACCELERATION_STRUCTURE_USE_AFTER_FREE); @@ -144,7 +143,7 @@ fn acceleration_structure_use_after_free(ctx: TestingContext) { ctx.queue.submit(Some(encoder.finish())); } -#[gpu_test] +#[apply(gpu_test!)] static ACCELERATION_STRUCTURE_USE_AFTER_FREE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/ray_tracing/limits.rs b/tests/tests/wgpu-gpu/ray_tracing/limits.rs index c1ee870f8..608cc8683 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/limits.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/limits.rs @@ -7,14 +7,13 @@ use wgpu::{ BlasTriangleGeometrySizeDescriptor, CreateBlasDescriptor, CreateTlasDescriptor, Limits, ShaderStages, VertexFormat, }; -use wgpu_macros::gpu_test; -use wgpu_test::{fail, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(tests: &mut Vec) { tests.push(LIMITS_HIT); } -#[gpu_test] +#[apply(gpu_test!)] static LIMITS_HIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/ray_tracing/scene/mod.rs b/tests/tests/wgpu-gpu/ray_tracing/scene/mod.rs index 9b1760a0c..519237840 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/scene/mod.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/scene/mod.rs @@ -1,6 +1,6 @@ use std::{iter, mem}; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; use wgpu::util::DeviceExt; @@ -106,7 +106,7 @@ fn acceleration_structure_build(ctx: &TestingContext, use_index_buffer: bool) { .unwrap(); } -#[gpu_test] +#[apply(gpu_test!)] static ACCELERATION_STRUCTURE_BUILD_NO_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -119,7 +119,7 @@ static ACCELERATION_STRUCTURE_BUILD_NO_INDEX: GpuTestConfiguration = GpuTestConf acceleration_structure_build(&ctx, false); }); -#[gpu_test] +#[apply(gpu_test!)] static ACCELERATION_STRUCTURE_BUILD_WITH_INDEX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/ray_tracing/shader.rs b/tests/tests/wgpu-gpu/ray_tracing/shader.rs index 0d3843971..0f59260df 100644 --- a/tests/tests/wgpu-gpu/ray_tracing/shader.rs +++ b/tests/tests/wgpu-gpu/ray_tracing/shader.rs @@ -5,9 +5,9 @@ use wgpu::{ CommandEncoderDescriptor, ComputePassDescriptor, ComputePipelineDescriptor, InstanceFlags, }; use wgpu::{AccelerationStructureFlags, BufferUsages}; -use wgpu_macros::gpu_test; -use wgpu_test::GpuTestInitializer; -use wgpu_test::{GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{ + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, +}; const STRUCT_SIZE: wgpu::BufferAddress = 176; @@ -16,7 +16,7 @@ pub fn all_tests(tests: &mut Vec) { tests.push(PREVENT_INVALID_RAY_QUERY_CALLS); } -#[gpu_test] +#[apply(gpu_test!)] static ACCESS_ALL_STRUCT_MEMBERS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -106,7 +106,7 @@ fn access_all_struct_members(ctx: TestingContext) { ctx.queue.submit([encoder_compute.finish()]); } -#[gpu_test] +#[apply(gpu_test!)] static PREVENT_INVALID_RAY_QUERY_CALLS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( // Don't disable metal shader validation in `TestParameters` because diff --git a/tests/tests/wgpu-gpu/regression/issue_3349.rs b/tests/tests/wgpu-gpu/regression/issue_3349.rs index 4dfb1c45c..e52493867 100644 --- a/tests/tests/wgpu-gpu/regression/issue_3349.rs +++ b/tests/tests/wgpu-gpu/regression/issue_3349.rs @@ -1,7 +1,7 @@ use wgpu::util::DeviceExt; use wgpu_test::{ - gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters, - TestingContext, + apply, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, + TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -27,7 +27,7 @@ pub fn all_tests(vec: &mut Vec) { /// bottom right: Fragment Shader / Immediate data /// /// We then validate the data is correct from every position. -#[gpu_test] +#[apply(gpu_test!)] static MULTI_STAGE_DATA_BINDING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/regression/issue_3457.rs b/tests/tests/wgpu-gpu/regression/issue_3457.rs index 52c0f9155..d9dffb410 100644 --- a/tests/tests/wgpu-gpu/regression/issue_3457.rs +++ b/tests/tests/wgpu-gpu/regression/issue_3457.rs @@ -1,4 +1,4 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; use wgpu::*; @@ -18,7 +18,7 @@ pub fn all_tests(vec: &mut Vec) { /// /// We use non-consecutive vertex attribute locations (0 and 5) in order to also test /// that we unset the correct locations (see PR #3706). -#[gpu_test] +#[apply(gpu_test!)] static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { diff --git a/tests/tests/wgpu-gpu/regression/issue_4024.rs b/tests/tests/wgpu-gpu/regression/issue_4024.rs index 9b7d34b20..45508408d 100644 --- a/tests/tests/wgpu-gpu/regression/issue_4024.rs +++ b/tests/tests/wgpu-gpu/regression/issue_4024.rs @@ -1,7 +1,7 @@ use std::sync::Arc; use parking_lot::Mutex; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; use wgpu::*; @@ -16,7 +16,7 @@ pub fn all_tests(vec: &mut Vec) { /// /// We previously immediately invoked on_submitted_work_done callbacks if there was no active submission /// to add them to. This is incorrect, as we do not immediately invoke map_async callbacks. -#[gpu_test] +#[apply(gpu_test!)] static QUEUE_SUBMITTED_CALLBACK_ORDERING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { diff --git a/tests/tests/wgpu-gpu/regression/issue_4122.rs b/tests/tests/wgpu-gpu/regression/issue_4122.rs index 419b3cd84..8b61b93af 100644 --- a/tests/tests/wgpu-gpu/regression/issue_4122.rs +++ b/tests/tests/wgpu-gpu/regression/issue_4122.rs @@ -1,7 +1,7 @@ use std::ops::Range; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -91,7 +91,7 @@ async fn fill_test(ctx: &TestingContext, range: Range, size: u64) -> bool { /// certain conditions. See https://github.com/gfx-rs/wgpu/issues/4122 for more information. /// /// This test will fail on nvidia if the bug is not properly worked around. -#[gpu_test] +#[apply(gpu_test!)] static CLEAR_BUFFER_RANGE_RESPECTED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { diff --git a/tests/tests/wgpu-gpu/regression/issue_4485.rs b/tests/tests/wgpu-gpu/regression/issue_4485.rs index b7c8284ab..12c04d863 100644 --- a/tests/tests/wgpu-gpu/regression/issue_4485.rs +++ b/tests/tests/wgpu-gpu/regression/issue_4485.rs @@ -1,5 +1,6 @@ use wgpu_test::{ - gpu_test, image, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, image, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -14,7 +15,7 @@ pub fn all_tests(vec: &mut Vec) { /// The shader will fail to compile on Dx12 with FXC without this fix. /// /// This also tests that shaders generated with this fix execute correctly. -#[gpu_test] +#[apply(gpu_test!)] static CONTINUE_SWITCH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().force_fxc(true).enable_noop()) .run_async(|ctx| async move { test_impl(&ctx).await }); diff --git a/tests/tests/wgpu-gpu/regression/issue_4514.rs b/tests/tests/wgpu-gpu/regression/issue_4514.rs index dca272cf4..6f8036eb1 100644 --- a/tests/tests/wgpu-gpu/regression/issue_4514.rs +++ b/tests/tests/wgpu-gpu/regression/issue_4514.rs @@ -1,5 +1,6 @@ use wgpu_test::{ - gpu_test, image, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, image, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -14,7 +15,7 @@ pub fn all_tests(vec: &mut Vec) { /// /// So far no specific buggy glsl consumers have been identified and it isn't known whether the /// bug is avoided there. -#[gpu_test] +#[apply(gpu_test!)] static DEGENERATE_SWITCH: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().force_fxc(true).enable_noop()) .run_async(|ctx| async move { test_impl(&ctx).await }); diff --git a/tests/tests/wgpu-gpu/regression/issue_5231_9343.rs b/tests/tests/wgpu-gpu/regression/issue_5231_9343.rs index 2a12e7f39..a471d8429 100644 --- a/tests/tests/wgpu-gpu/regression/issue_5231_9343.rs +++ b/tests/tests/wgpu-gpu/regression/issue_5231_9343.rs @@ -1,6 +1,7 @@ use wgpu::*; -use wgpu_macros::gpu_test; -use wgpu_test::{GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext}; +use wgpu_test::{ + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, +}; pub fn all_tests(vec: &mut Vec) { vec.push(READ_ONLY_DEPTH_WITHOUT_TEXTURE_BINDING); @@ -18,7 +19,7 @@ pub fn all_tests(vec: &mut Vec) { /// texture to `DEPTH_STENCIL_READ | RESOURCE`. This is normally a valid usage combination, /// but when the texture view does not have `TEXTURE_BINDING` usage, the `RESOURCE` usage /// is not allowed, and dx12 raises an error. -#[gpu_test] +#[apply(gpu_test!)] static READ_ONLY_DEPTH_WITHOUT_TEXTURE_BINDING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -38,7 +39,7 @@ static READ_ONLY_DEPTH_WITHOUT_TEXTURE_BINDING: GpuTestConfiguration = GpuTestCo /// Test that a read-only depth attachment can simultaneously be sampled as a texture /// binding within the same render pass. This exercises the `DEPTH_STENCIL_READ | RESOURCE` /// usage combination that wgpu-core sets up in render.rs. -#[gpu_test] +#[apply(gpu_test!)] static READ_ONLY_DEPTH_WITH_SAMPLED_BINDING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/regression/issue_5553.rs b/tests/tests/wgpu-gpu/regression/issue_5553.rs index 68a32b371..45cd04ee4 100644 --- a/tests/tests/wgpu-gpu/regression/issue_5553.rs +++ b/tests/tests/wgpu-gpu/regression/issue_5553.rs @@ -1,4 +1,4 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; use wgpu::*; @@ -13,7 +13,7 @@ pub fn all_tests(vec: &mut Vec) { /// automatically remove any user-defined outputs from the vertex shader that are not present in /// the fragment inputs. This is necessary for generating correct hlsl: /// https://github.com/gfx-rs/wgpu/issues/5553 -#[gpu_test] +#[apply(gpu_test!)] static ALLOW_INPUT_NOT_CONSUMED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { diff --git a/tests/tests/wgpu-gpu/regression/issue_6317.rs b/tests/tests/wgpu-gpu/regression/issue_6317.rs index fd42885be..50eb5c3f3 100644 --- a/tests/tests/wgpu-gpu/regression/issue_6317.rs +++ b/tests/tests/wgpu-gpu/regression/issue_6317.rs @@ -1,12 +1,11 @@ use wgpu::{DownlevelFlags, Limits}; -use wgpu_macros::gpu_test; -use wgpu_test::{fail, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(NON_FATAL_ERRORS_IN_QUEUE_SUBMIT); } -#[gpu_test] +#[apply(gpu_test!)] static NON_FATAL_ERRORS_IN_QUEUE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/regression/issue_6467.rs b/tests/tests/wgpu-gpu/regression/issue_6467.rs index 84d680d01..f7626bdf7 100644 --- a/tests/tests/wgpu-gpu/regression/issue_6467.rs +++ b/tests/tests/wgpu-gpu/regression/issue_6467.rs @@ -1,5 +1,5 @@ use wgpu::util::DeviceExt; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(ZERO_WORKGROUP_COUNT); @@ -11,7 +11,7 @@ pub fn all_tests(vec: &mut Vec) { /// Since this is a public API that may be given untrusted values in a browser, this must be protected again. /// /// The following test should successfully do nothing on all platforms. -#[gpu_test] +#[apply(gpu_test!)] static ZERO_WORKGROUP_COUNT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/regression/issue_6827.rs b/tests/tests/wgpu-gpu/regression/issue_6827.rs index fc3c3184c..977256709 100644 --- a/tests/tests/wgpu-gpu/regression/issue_6827.rs +++ b/tests/tests/wgpu-gpu/regression/issue_6827.rs @@ -1,19 +1,20 @@ use std::sync::Arc; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(tests: &mut Vec) { tests.extend([TEST_SINGLE_WRITE, TEST_SCATTER]); } -#[gpu_test] +#[apply(gpu_test!)] static TEST_SINGLE_WRITE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| async move { run_test(ctx, false).await }); -#[gpu_test] +#[apply(gpu_test!)] static TEST_SCATTER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/regression/issue_9115.rs b/tests/tests/wgpu-gpu/regression/issue_9115.rs index 83c6794b2..d85bcdd07 100644 --- a/tests/tests/wgpu-gpu/regression/issue_9115.rs +++ b/tests/tests/wgpu-gpu/regression/issue_9115.rs @@ -1,7 +1,7 @@ use wgpu::util::DeviceExt; use wgpu_test::{ - gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, TestParameters, - TestingContext, + apply, gpu_test, image::ReadbackBuffers, GpuTestConfiguration, GpuTestInitializer, + TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -13,7 +13,7 @@ pub fn all_tests(vec: &mut Vec) { /// The backend incorrectly encountered the uniform's struct type when processing immediates. /// /// See . -#[gpu_test] +#[apply(gpu_test!)] static IMMEDIATES_WITH_UNIFORM_IN_SINGLE_MODULE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/render_pass_ownership.rs b/tests/tests/wgpu-gpu/render_pass_ownership.rs index 874d92521..d3d52fb83 100644 --- a/tests/tests/wgpu-gpu/render_pass_ownership.rs +++ b/tests/tests/wgpu-gpu/render_pass_ownership.rs @@ -13,7 +13,8 @@ use std::num::NonZeroU64; use wgpu::util::DeviceExt as _; use wgpu_test::{ - gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -47,7 +48,7 @@ fn fs_main() -> @location(0) vec4 { return vec4(1.0, 0.0, 1.0, 1.0); }"; -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PASS_RESOURCE_OWNERSHIP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().test_features_limits()) .run_async(render_pass_resource_ownership); @@ -122,7 +123,7 @@ async fn render_pass_resource_ownership(ctx: TestingContext) { assert_render_pass_executed_normally(encoder, gpu_buffer, cpu_buffer, buffer_size, ctx).await; } -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PASS_QUERY_SET_OWNERSHIP_PIPELINE_STATISTICS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -194,7 +195,7 @@ async fn render_pass_query_set_ownership_pipeline_statistics(ctx: TestingContext assert_render_pass_executed_normally(encoder, gpu_buffer, cpu_buffer, buffer_size, ctx).await; } -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PASS_QUERY_SET_OWNERSHIP_TIMESTAMPS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().test_features_limits().features( @@ -273,7 +274,7 @@ async fn render_pass_query_set_ownership_timestamps(ctx: TestingContext) { assert_render_pass_executed_normally(encoder, gpu_buffer, cpu_buffer, buffer_size, ctx).await; } -#[gpu_test] +#[apply(gpu_test!)] static RENDER_PASS_KEEP_ENCODER_ALIVE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/render_target.rs b/tests/tests/wgpu-gpu/render_target.rs index 055b8304f..062c9964c 100644 --- a/tests/tests/wgpu-gpu/render_target.rs +++ b/tests/tests/wgpu-gpu/render_target.rs @@ -3,7 +3,7 @@ use wgpu::{ vertex_attr_array, }; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -16,22 +16,22 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static DRAW_TO_2D_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| run_test(ctx, wgpu::TextureViewDimension::D2, false)); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_TO_2D_ARRAY_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| run_test(ctx, wgpu::TextureViewDimension::D2Array, false)); -#[gpu_test] +#[apply(gpu_test!)] static RESOLVE_TO_2D_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| run_test(ctx, wgpu::TextureViewDimension::D2, true)); -#[gpu_test] +#[apply(gpu_test!)] static RESOLVE_TO_2D_ARRAY_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| run_test(ctx, wgpu::TextureViewDimension::D2Array, true)); @@ -249,7 +249,7 @@ async fn run_test( assert!(succeeded); } -#[gpu_test] +#[apply(gpu_test!)] static DRAW_TO_3D_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/resolve_query_set_init.rs b/tests/tests/wgpu-gpu/resolve_query_set_init.rs index d0f61ef63..969d883aa 100644 --- a/tests/tests/wgpu-gpu/resolve_query_set_init.rs +++ b/tests/tests/wgpu-gpu/resolve_query_set_init.rs @@ -5,7 +5,8 @@ use wgpu::*; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -29,7 +30,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static UNWRITTEN_OCCLUSION_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| async move { @@ -52,7 +53,7 @@ static UNWRITTEN_OCCLUSION_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConfi /// A query that was properly begun and ended (but with no actual draws, so the /// result is 0) should also resolve to zero. -#[gpu_test] +#[apply(gpu_test!)] static USED_EMPTY_OCCLUSION_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| async move { @@ -113,7 +114,7 @@ static USED_EMPTY_OCCLUSION_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConf /// Slots 0 and 3 are written before the resolve. /// Slot 1 is written after the resolve. /// Slot 2 is never written. -#[gpu_test] +#[apply(gpu_test!)] static SAME_ENCODER_RESOLVES_CORRECTLY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -150,7 +151,7 @@ static SAME_ENCODER_RESOLVES_CORRECTLY: GpuTestConfiguration = GpuTestConfigurat }); /// Write queries in submit 1, resolve them in submit 2. -#[gpu_test] +#[apply(gpu_test!)] static WRITTEN_IN_PRIOR_SUBMIT_RESOLVES_CORRECTLY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -190,7 +191,7 @@ static WRITTEN_IN_PRIOR_SUBMIT_RESOLVES_CORRECTLY: GpuTestConfiguration = /// Slot 0 written in submit 1. /// Slot 1 written in submit 2 before the resolve. /// Slot 2 is never written. -#[gpu_test] +#[apply(gpu_test!)] static WRITTEN_IN_PRIOR_SUBMIT_AND_SAME_ENCODER_RESOLVES_CORRECTLY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -231,7 +232,7 @@ static WRITTEN_IN_PRIOR_SUBMIT_AND_SAME_ENCODER_RESOLVES_CORRECTLY: GpuTestConfi assert_eq!(result[2], 0, "slot 2 (unwritten) must be zero"); }); -#[gpu_test] +#[apply(gpu_test!)] static UNWRITTEN_TIMESTAMP_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().features(Features::TIMESTAMP_QUERY)) .run_async(|ctx| async move { @@ -251,7 +252,7 @@ static UNWRITTEN_TIMESTAMP_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConfi ); }); -#[gpu_test] +#[apply(gpu_test!)] static WRITTEN_TIMESTAMP_RESOLVES_TO_NONZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -303,7 +304,7 @@ static WRITTEN_TIMESTAMP_RESOLVES_TO_NONZERO: GpuTestConfiguration = GpuTestConf ); }); -#[gpu_test] +#[apply(gpu_test!)] static INSIDE_PASS_WRITTEN_TIMESTAMP_RESOLVES_TO_NONZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -353,7 +354,7 @@ static INSIDE_PASS_WRITTEN_TIMESTAMP_RESOLVES_TO_NONZERO: GpuTestConfiguration = assert_eq!(result[1], 0, "slot 1 (unwritten) must be zero"); }); -#[gpu_test] +#[apply(gpu_test!)] static ENCODER_WRITTEN_TIMESTAMP_RESOLVES_TO_NONZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -377,7 +378,7 @@ static ENCODER_WRITTEN_TIMESTAMP_RESOLVES_TO_NONZERO: GpuTestConfiguration = assert_eq!(result[1], 0, "slot 1 (unwritten) must be zero"); }); -#[gpu_test] +#[apply(gpu_test!)] static UNWRITTEN_PIPELINE_STATISTICS_RESOLVES_TO_ZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -406,7 +407,7 @@ static UNWRITTEN_PIPELINE_STATISTICS_RESOLVES_TO_ZERO: GpuTestConfiguration = ); }); -#[gpu_test] +#[apply(gpu_test!)] static WRITTEN_PIPELINE_STATISTICS_RESOLVES_TO_NONZERO: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( diff --git a/tests/tests/wgpu-gpu/resource_descriptor_accessor.rs b/tests/tests/wgpu-gpu/resource_descriptor_accessor.rs index 5a25ab0cb..b69441344 100644 --- a/tests/tests/wgpu-gpu/resource_descriptor_accessor.rs +++ b/tests/tests/wgpu-gpu/resource_descriptor_accessor.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(BUFFER_SIZE_AND_USAGE); } -#[gpu_test] +#[apply(gpu_test!)] static BUFFER_SIZE_AND_USAGE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/resource_error.rs b/tests/tests/wgpu-gpu/resource_error.rs index 7d35adaa5..d752e745c 100644 --- a/tests/tests/wgpu-gpu/resource_error.rs +++ b/tests/tests/wgpu-gpu/resource_error.rs @@ -1,10 +1,12 @@ -use wgpu_test::{fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{ + apply, fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, +}; pub fn all_tests(vec: &mut Vec) { vec.extend([BAD_BUFFER_MAP, BAD_TEXTURE_CREATE_VIEW, BAD_TEXTURE_WRITE]); } -#[gpu_test] +#[apply(gpu_test!)] static BAD_BUFFER_MAP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -37,7 +39,7 @@ static BAD_BUFFER_MAP: GpuTestConfiguration = GpuTestConfiguration::new() valid(&ctx.device, || buffer.destroy()); }); -#[gpu_test] +#[apply(gpu_test!)] static BAD_TEXTURE_CREATE_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -73,7 +75,7 @@ static BAD_TEXTURE_CREATE_VIEW: GpuTestConfiguration = GpuTestConfiguration::new valid(&ctx.device, || texture.destroy()); }); -#[gpu_test] +#[apply(gpu_test!)] static BAD_TEXTURE_WRITE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/samplers.rs b/tests/tests/wgpu-gpu/samplers.rs index 4673e0961..f8ecc19c3 100644 --- a/tests/tests/wgpu-gpu/samplers.rs +++ b/tests/tests/wgpu-gpu/samplers.rs @@ -3,7 +3,7 @@ //! Do some tests to ensure things are working correctly and nothing gets mad. use wgpu_test::{ - did_oom, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, + apply, did_oom, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -20,7 +20,7 @@ pub fn all_tests(vec: &mut Vec) { // on some devices. const PROBABLY_PROBLEMATIC_SAMPLER_COUNT: u32 = 8 * 1024; -#[gpu_test] +#[apply(gpu_test!)] static SAMPLER_DEDUPLICATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(sampler_deduplication); @@ -71,7 +71,7 @@ fn sampler_deduplication(ctx: TestingContext) { drop(samplers); } -#[gpu_test] +#[apply(gpu_test!)] static SAMPLER_CREATION_FAILURE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(sampler_creation_failure); @@ -178,7 +178,7 @@ enum GroupType { Multi, } -#[gpu_test] +#[apply(gpu_test!)] static SAMPLER_SINGLE_BIND_GROUP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -188,7 +188,7 @@ static SAMPLER_SINGLE_BIND_GROUP: GpuTestConfiguration = GpuTestConfiguration::n ) .run_sync(|ctx| sampler_bind_group(ctx, GroupType::Single)); -#[gpu_test] +#[apply(gpu_test!)] static SAMPLER_MULTI_BIND_GROUP: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/scissor_tests/mod.rs b/tests/tests/wgpu-gpu/scissor_tests/mod.rs index fa602170d..f3e7839e6 100644 --- a/tests/tests/wgpu-gpu/scissor_tests/mod.rs +++ b/tests/tests/wgpu-gpu/scissor_tests/mod.rs @@ -1,4 +1,4 @@ -use wgpu_test::{gpu_test, image, GpuTestConfiguration, GpuTestInitializer, TestingContext}; +use wgpu_test::{apply, gpu_test, image, GpuTestConfiguration, GpuTestInitializer, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -117,7 +117,7 @@ async fn scissor_test_impl( .await; } -#[gpu_test] +#[apply(gpu_test!)] static SCISSOR_TEST_FULL_RECT: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { scissor_test_impl( @@ -133,7 +133,7 @@ static SCISSOR_TEST_FULL_RECT: GpuTestConfiguration = .await }); -#[gpu_test] +#[apply(gpu_test!)] static SCISSOR_TEST_EMPTY_RECT: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { scissor_test_impl( @@ -149,7 +149,7 @@ static SCISSOR_TEST_EMPTY_RECT: GpuTestConfiguration = .await; }); -#[gpu_test] +#[apply(gpu_test!)] static SCISSOR_TEST_EMPTY_RECT_WITH_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new() .run_async(|ctx| async move { scissor_test_impl( @@ -165,7 +165,7 @@ static SCISSOR_TEST_EMPTY_RECT_WITH_OFFSET: GpuTestConfiguration = GpuTestConfig .await }); -#[gpu_test] +#[apply(gpu_test!)] static SCISSOR_TEST_CUSTOM_RECT: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { let mut expected_result = [0; BUFFER_SIZE]; diff --git a/tests/tests/wgpu-gpu/shader/array_size_overrides.rs b/tests/tests/wgpu-gpu/shader/array_size_overrides.rs index 9409d3232..a3a1739af 100644 --- a/tests/tests/wgpu-gpu/shader/array_size_overrides.rs +++ b/tests/tests/wgpu-gpu/shader/array_size_overrides.rs @@ -1,7 +1,7 @@ use std::mem::size_of_val; use wgpu::util::DeviceExt; use wgpu::{BufferDescriptor, BufferUsages, MapMode, PollType}; -use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, fail_if, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(ARRAY_SIZE_OVERRIDES); @@ -50,7 +50,7 @@ const SHADER: &str = r#" } "#; -#[gpu_test] +#[apply(gpu_test!)] static ARRAY_SIZE_OVERRIDES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader/compilation_messages/mod.rs b/tests/tests/wgpu-gpu/shader/compilation_messages/mod.rs index 337ff81fd..5970a7857 100644 --- a/tests/tests/wgpu-gpu/shader/compilation_messages/mod.rs +++ b/tests/tests/wgpu-gpu/shader/compilation_messages/mod.rs @@ -1,6 +1,8 @@ use wgpu::include_wgsl; -use wgpu_test::{fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{ + apply, fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters, +}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -11,7 +13,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static SHADER_COMPILE_SUCCESS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -25,7 +27,7 @@ static SHADER_COMPILE_SUCCESS: GpuTestConfiguration = GpuTestConfiguration::new( } }); -#[gpu_test] +#[apply(gpu_test!)] static SHADER_COMPILE_ERROR: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -64,7 +66,7 @@ const ENABLE_EXTENSION_SHADER_SOURCE: &str = r#" fn main() {} "#; -#[gpu_test] +#[apply(gpu_test!)] static ENABLE_EXTENSION_AVAILABLE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -85,7 +87,7 @@ static ENABLE_EXTENSION_AVAILABLE: GpuTestConfiguration = GpuTestConfiguration:: }); }); -#[gpu_test] +#[apply(gpu_test!)] static ENABLE_EXTENSION_UNAVAILABLE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader/data_builtins.rs b/tests/tests/wgpu-gpu/shader/data_builtins.rs index d17691b94..71207b5d7 100644 --- a/tests/tests/wgpu-gpu/shader/data_builtins.rs +++ b/tests/tests/wgpu-gpu/shader/data_builtins.rs @@ -1,7 +1,7 @@ use wgpu::{DownlevelFlags, Limits}; use crate::shader::{shader_input_output_test, InputStorageType, ShaderTest}; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([UNPACK4xU8, UNPACK4xI8, PACK4xU8, PACK4xI8]); @@ -33,7 +33,7 @@ fn create_unpack4xU8_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static UNPACK4xU8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -77,7 +77,7 @@ fn create_unpack4xI8_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static UNPACK4xI8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -106,7 +106,7 @@ fn create_pack4xU8_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static PACK4xU8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -154,7 +154,7 @@ fn create_pack4xI8_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static PACK4xI8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader/numeric_builtins.rs b/tests/tests/wgpu-gpu/shader/numeric_builtins.rs index 1416f9b37..de8fb097a 100644 --- a/tests/tests/wgpu-gpu/shader/numeric_builtins.rs +++ b/tests/tests/wgpu-gpu/shader/numeric_builtins.rs @@ -1,7 +1,7 @@ use wgpu::{DownlevelFlags, Limits}; use crate::shader::{shader_input_output_test, InputStorageType, ShaderTest}; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -46,7 +46,7 @@ fn create_numeric_builtin_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static NUMERIC_BUILTINS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -89,7 +89,7 @@ fn create_int64_atomic_min_max_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static INT64_ATOMIC_MIN_MAX: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -144,7 +144,7 @@ fn create_int64_atomic_all_ops_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static INT64_ATOMIC_ALL_OPS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -188,7 +188,7 @@ fn create_float32_atomic_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static FLOAT32_ATOMIC: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -296,7 +296,7 @@ fn create_int64_polyfill_test() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static INT64_POLYFILL: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader/struct_layout.rs b/tests/tests/wgpu-gpu/shader/struct_layout.rs index 99f56d49d..68d73419c 100644 --- a/tests/tests/wgpu-gpu/shader/struct_layout.rs +++ b/tests/tests/wgpu-gpu/shader/struct_layout.rs @@ -3,7 +3,7 @@ use std::fmt::Write; use wgpu::{Backends, DownlevelFlags, Features, Limits}; use crate::shader::{shader_input_output_test, InputStorageType, ShaderTest, MAX_BUFFER_SIZE}; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -22,7 +22,7 @@ pub fn all_tests(vec: &mut Vec) { // Note that some specific subtests are marked as failing on GL due to // https://github.com/gfx-rs/wgpu/issues/4371. -#[gpu_test] +#[apply(gpu_test!)] static UNIFORM_INPUT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -37,7 +37,7 @@ static UNIFORM_INPUT: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static STORAGE_INPUT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -52,7 +52,7 @@ static STORAGE_INPUT: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static IMMEDIATES_INPUT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -599,7 +599,7 @@ fn create_struct_layout_tests(storage_type: InputStorageType) -> Vec tests } -#[gpu_test] +#[apply(gpu_test!)] static UNIFORM_INPUT_INT64: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -615,7 +615,7 @@ static UNIFORM_INPUT_INT64: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static STORAGE_INPUT_INT64: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -631,7 +631,7 @@ static STORAGE_INPUT_INT64: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static IMMEDIATES_INPUT_INT64: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -752,7 +752,7 @@ fn create_64bit_struct_layout_tests() -> Vec { tests } -#[gpu_test] +#[apply(gpu_test!)] static UNIFORM_INPUT_F16: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -768,7 +768,7 @@ static UNIFORM_INPUT_F16: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static STORAGE_INPUT_F16: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -784,7 +784,7 @@ static STORAGE_INPUT_F16: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static UNIFORM_INPUT_I16: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -800,7 +800,7 @@ static UNIFORM_INPUT_I16: GpuTestConfiguration = GpuTestConfiguration::new() ) }); -#[gpu_test] +#[apply(gpu_test!)] static STORAGE_INPUT_I16: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader/workgroup_size_overrides.rs b/tests/tests/wgpu-gpu/shader/workgroup_size_overrides.rs index 8aa622cd5..734b8dfc9 100644 --- a/tests/tests/wgpu-gpu/shader/workgroup_size_overrides.rs +++ b/tests/tests/wgpu-gpu/shader/workgroup_size_overrides.rs @@ -1,7 +1,7 @@ use std::mem::size_of_val; use wgpu::util::DeviceExt; use wgpu::{BufferDescriptor, BufferUsages, MapMode, PollType}; -use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, fail_if, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(WORKGROUP_SIZE_OVERRIDES); @@ -19,7 +19,7 @@ const SHADER: &str = r#" } "#; -#[gpu_test] +#[apply(gpu_test!)] static WORKGROUP_SIZE_OVERRIDES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().limits(wgpu::Limits::default())) .run_async(move |ctx| async move { diff --git a/tests/tests/wgpu-gpu/shader/zero_init_workgroup_mem.rs b/tests/tests/wgpu-gpu/shader/zero_init_workgroup_mem.rs index 5a3584725..0ee5869ff 100644 --- a/tests/tests/wgpu-gpu/shader/zero_init_workgroup_mem.rs +++ b/tests/tests/wgpu-gpu/shader/zero_init_workgroup_mem.rs @@ -8,13 +8,13 @@ use wgpu::{ ShaderStages, }; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(ZERO_INIT_WORKGROUP_MEMORY); } -#[gpu_test] +#[apply(gpu_test!)] static ZERO_INIT_WORKGROUP_MEMORY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader_barycentric/mod.rs b/tests/tests/wgpu-gpu/shader_barycentric/mod.rs index fab72f4fd..16c2ad1b4 100644 --- a/tests/tests/wgpu-gpu/shader_barycentric/mod.rs +++ b/tests/tests/wgpu-gpu/shader_barycentric/mod.rs @@ -1,5 +1,5 @@ use wgpu::util::DeviceExt; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(BARYCENTRIC); @@ -30,7 +30,7 @@ pub fn all_tests(vec: &mut Vec) { // return vec4(bary * 1.1 - 0.05, 1.0); // -#[gpu_test] +#[apply(gpu_test!)] static BARYCENTRIC: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -39,7 +39,7 @@ static BARYCENTRIC: GpuTestConfiguration = GpuTestConfiguration::new() ) .run_async(|ctx| barycentric(ctx, false)); -#[gpu_test] +#[apply(gpu_test!)] static BARYCENTRIC_NO_PERSPECTIVE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs b/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs index 8061ae01e..e632c23e1 100644 --- a/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs +++ b/tests/tests/wgpu-gpu/shader_primitive_index/mod.rs @@ -1,5 +1,5 @@ use wgpu::util::DeviceExt; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.extend([DRAW, DRAW_INDEXED]); @@ -40,7 +40,7 @@ pub fn all_tests(vec: &mut Vec) { // buffer [3, 4, 5, 0, 1, 2]. This also swaps the resulting pixel colors. // -#[gpu_test] +#[apply(gpu_test!)] static DRAW: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -64,7 +64,7 @@ static DRAW: GpuTestConfiguration = GpuTestConfiguration::new() .await; }); -#[gpu_test] +#[apply(gpu_test!)] static DRAW_INDEXED: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/shader_view_format/mod.rs b/tests/tests/wgpu-gpu/shader_view_format/mod.rs index 367e16501..dce8cb7ba 100644 --- a/tests/tests/wgpu-gpu/shader_view_format/mod.rs +++ b/tests/tests/wgpu-gpu/shader_view_format/mod.rs @@ -1,11 +1,11 @@ use wgpu::{util::DeviceExt, DownlevelFlags, Limits, TextureFormat}; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(REINTERPRET_SRGB); } -#[gpu_test] +#[apply(gpu_test!)] static REINTERPRET_SRGB: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/subgroup_operations/mod.rs b/tests/tests/wgpu-gpu/subgroup_operations/mod.rs index 9b4330e68..8a9e64fc3 100644 --- a/tests/tests/wgpu-gpu/subgroup_operations/mod.rs +++ b/tests/tests/wgpu-gpu/subgroup_operations/mod.rs @@ -1,6 +1,6 @@ use std::num::NonZeroU64; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(SUBGROUP_OPERATIONS); @@ -9,7 +9,7 @@ pub fn all_tests(vec: &mut Vec) { const THREAD_COUNT: u64 = 128; const TEST_COUNT: u32 = 37; -#[gpu_test] +#[apply(gpu_test!)] static SUBGROUP_OPERATIONS: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/texture_binding/mod.rs b/tests/tests/wgpu-gpu/texture_binding/mod.rs index c8ad18a8f..fea60aec0 100644 --- a/tests/tests/wgpu-gpu/texture_binding/mod.rs +++ b/tests/tests/wgpu-gpu/texture_binding/mod.rs @@ -6,14 +6,15 @@ use wgpu::{ PollType, TexelCopyBufferInfo, TexelCopyBufferLayout, TexelCopyTextureInfo, TextureAspect, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, }; -use wgpu_macros::gpu_test; -use wgpu_test::{GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext}; +use wgpu_test::{ + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, +}; pub fn all_tests(vec: &mut Vec) { vec.extend([TEXTURE_BINDING, SINGLE_SCALAR_LOAD]); } -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_BINDING: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -70,7 +71,7 @@ fn texture_binding(ctx: TestingContext) { ctx.queue.submit([encoder.finish()]); } -#[gpu_test] +#[apply(gpu_test!)] static SINGLE_SCALAR_LOAD: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/texture_blit.rs b/tests/tests/wgpu-gpu/texture_blit.rs index e2b0a6c6e..11d9792ea 100644 --- a/tests/tests/wgpu-gpu/texture_blit.rs +++ b/tests/tests/wgpu-gpu/texture_blit.rs @@ -1,4 +1,4 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -7,7 +7,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_BLIT_WITH_LINEAR_FILTER_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { @@ -59,7 +59,7 @@ static TEXTURE_BLIT_WITH_LINEAR_FILTER_TEST: GpuTestConfiguration = GpuTestConfi ); }); -#[gpu_test] +#[apply(gpu_test!)] static TEXTURE_BLIT_WITH_NEAREST_FILTER_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/texture_bounds.rs b/tests/tests/wgpu-gpu/texture_bounds.rs index 561e36354..8da49f01f 100644 --- a/tests/tests/wgpu-gpu/texture_bounds.rs +++ b/tests/tests/wgpu-gpu/texture_bounds.rs @@ -1,12 +1,12 @@ //! Tests for texture copy bounds checks. -use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, TestParameters}; +use wgpu_test::{apply, fail_if, gpu_test, GpuTestConfiguration, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(BAD_COPY_ORIGIN_TEST); } -#[gpu_test] +#[apply(gpu_test!)] static BAD_COPY_ORIGIN_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/texture_view_creation.rs b/tests/tests/wgpu-gpu/texture_view_creation.rs index 5bf7ae1fa..3d68cf720 100644 --- a/tests/tests/wgpu-gpu/texture_view_creation.rs +++ b/tests/tests/wgpu-gpu/texture_view_creation.rs @@ -1,5 +1,7 @@ use wgpu::*; -use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{ + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, +}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -9,7 +11,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static STENCIL_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -42,7 +44,7 @@ static STENCIL_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration:: } }); -#[gpu_test] +#[apply(gpu_test!)] static DEPTH_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -74,7 +76,7 @@ static DEPTH_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::ne } }); -#[gpu_test] +#[apply(gpu_test!)] static SHARED_USAGE_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/timestamp_normalization/utils.rs b/tests/tests/wgpu-gpu/timestamp_normalization/utils.rs index 3ea566dd9..8e872cec7 100644 --- a/tests/tests/wgpu-gpu/timestamp_normalization/utils.rs +++ b/tests/tests/wgpu-gpu/timestamp_normalization/utils.rs @@ -6,7 +6,7 @@ use nanorand::Rng; use wgpu::{util::DeviceExt, Limits}; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.extend([U64_MUL_U32, SHIFT_RIGHT_U96]); @@ -59,7 +59,7 @@ fn assert_u64_mul_u32(left: u64, right: u32, computed: Uint96) { ); } -#[gpu_test] +#[apply(gpu_test!)] static U64_MUL_U32: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -140,7 +140,7 @@ fn assert_shift_right_u96(value: Uint96, shift: u32, computed: Uint96) { ); } -#[gpu_test] +#[apply(gpu_test!)] static SHIFT_RIGHT_U96: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/timestamp_query.rs b/tests/tests/wgpu-gpu/timestamp_query.rs index 321cca5fd..e5c20d56e 100644 --- a/tests/tests/wgpu-gpu/timestamp_query.rs +++ b/tests/tests/wgpu-gpu/timestamp_query.rs @@ -3,7 +3,8 @@ use wgpu::{ QUERY_RESOLVE_BUFFER_ALIGNMENT, }; use wgpu_test::{ - gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, + TestingContext, }; pub fn all_tests(vec: &mut Vec) { @@ -22,7 +23,7 @@ const ITERATIONS: u32 = 10; const QUERIES_PER_ITERATION: u32 = 2; const TOTAL_QUERIES: u32 = QUERIES_PER_ITERATION * ITERATIONS; -#[gpu_test] +#[apply(gpu_test!)] static TIMESTAMP_QUERY: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/transfer.rs b/tests/tests/wgpu-gpu/transfer.rs index 0e2adbbc2..bd23328f2 100644 --- a/tests/tests/wgpu-gpu/transfer.rs +++ b/tests/tests/wgpu-gpu/transfer.rs @@ -1,10 +1,10 @@ -use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(COPY_OVERFLOW_Z); } -#[gpu_test] +#[apply(gpu_test!)] static COPY_OVERFLOW_Z: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/transient.rs b/tests/tests/wgpu-gpu/transient.rs index 50d81b9d8..720160fad 100644 --- a/tests/tests/wgpu-gpu/transient.rs +++ b/tests/tests/wgpu-gpu/transient.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(RESOLVE_WITH_TRANSIENT); } -#[gpu_test] +#[apply(gpu_test!)] static RESOLVE_WITH_TRANSIENT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default()) .run_async(|ctx| async move { diff --git a/tests/tests/wgpu-gpu/transition_resources.rs b/tests/tests/wgpu-gpu/transition_resources.rs index f46e5c9bb..b4301b4af 100644 --- a/tests/tests/wgpu-gpu/transition_resources.rs +++ b/tests/tests/wgpu-gpu/transition_resources.rs @@ -1,10 +1,10 @@ -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.push(TRANSITION_RESOURCES); } -#[gpu_test] +#[apply(gpu_test!)] static TRANSITION_RESOURCES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_sync(|ctx| { diff --git a/tests/tests/wgpu-gpu/vertex_formats/mod.rs b/tests/tests/wgpu-gpu/vertex_formats/mod.rs index 100d72604..72ed83428 100644 --- a/tests/tests/wgpu-gpu/vertex_formats/mod.rs +++ b/tests/tests/wgpu-gpu/vertex_formats/mod.rs @@ -4,7 +4,7 @@ use std::num::NonZeroU64; use wgpu::util::{BufferInitDescriptor, DeviceExt}; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.extend([VERTEX_FORMATS_ALL, VERTEX_FORMATS_10_10_10_2]); @@ -413,7 +413,7 @@ async fn vertex_formats_common(ctx: TestingContext, tests: &[Test<'_>]) { assert!(!failed); } -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_FORMATS_ALL: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -429,7 +429,7 @@ static VERTEX_FORMATS_ALL: GpuTestConfiguration = GpuTestConfiguration::new() // Some backends can handle Unorm-10-10-2, but GL backends seem to throw this error: // Validation Error: GL_INVALID_ENUM in glVertexAttribFormat(type = GL_UNSIGNED_INT_10_10_10_2) -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_FORMATS_10_10_10_2: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/vertex_indices/mod.rs b/tests/tests/wgpu-gpu/vertex_indices/mod.rs index 8b2c3f76a..a3974b8cb 100644 --- a/tests/tests/wgpu-gpu/vertex_indices/mod.rs +++ b/tests/tests/wgpu-gpu/vertex_indices/mod.rs @@ -9,7 +9,7 @@ use itertools::Itertools; use strum::IntoEnumIterator; use wgpu::util::{BufferInitDescriptor, DeviceExt, RenderEncoder}; use wgpu::RenderBundleDescriptor; -use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, TestParameters, TestingContext}; pub fn all_tests(vec: &mut Vec) { vec.push(VERTEX_INDICES); @@ -467,7 +467,7 @@ async fn vertex_index_common(ctx: TestingContext) { assert!(!failed); } -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_INDICES: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/vertex_state.rs b/tests/tests/wgpu-gpu/vertex_state.rs index b8995469c..843b80067 100644 --- a/tests/tests/wgpu-gpu/vertex_state.rs +++ b/tests/tests/wgpu-gpu/vertex_state.rs @@ -3,14 +3,14 @@ use wgpu::{ vertex_attr_array, }; use wgpu_test::{ - gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, + apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; pub fn all_tests(vec: &mut Vec) { vec.push(SET_ARRAY_STRIDE_TO_0); } -#[gpu_test] +#[apply(gpu_test!)] static SET_ARRAY_STRIDE_TO_0: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() diff --git a/tests/tests/wgpu-gpu/write_texture.rs b/tests/tests/wgpu-gpu/write_texture.rs index dce6c51c7..bfee69a80 100644 --- a/tests/tests/wgpu-gpu/write_texture.rs +++ b/tests/tests/wgpu-gpu/write_texture.rs @@ -1,7 +1,7 @@ //! Tests for texture copy use wgpu::*; -use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; +use wgpu_test::{apply, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters}; pub fn all_tests(vec: &mut Vec) { vec.extend([ @@ -12,7 +12,7 @@ pub fn all_tests(vec: &mut Vec) { ]); } -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_SUBSET_2D: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { // Deliberately non-square so a width/height swap is caught. `width` is @@ -111,7 +111,7 @@ static WRITE_TEXTURE_SUBSET_2D: GpuTestConfiguration = } }); -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_SUBSET_3D: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move { // Deliberately non-square (and a depth distinct from both) so any @@ -210,7 +210,7 @@ static WRITE_TEXTURE_SUBSET_3D: GpuTestConfiguration = } }); -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_NO_OOB: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().enable_noop()) .run_async(|ctx| async move { @@ -257,7 +257,7 @@ static WRITE_TEXTURE_NO_OOB: GpuTestConfiguration = GpuTestConfiguration::new() // Test a writeTexture operation that will use the staging buffer. // If run with the address sanitizer, this serves as a regression // test for https://github.com/gfx-rs/wgpu/pull/7893. -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_VIA_STAGING_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() .run_async(|ctx| async move { let width = 89; diff --git a/tests/tests/wgpu-gpu/zero_init.rs b/tests/tests/wgpu-gpu/zero_init.rs index 02b54ab07..b111f5175 100644 --- a/tests/tests/wgpu-gpu/zero_init.rs +++ b/tests/tests/wgpu-gpu/zero_init.rs @@ -9,7 +9,7 @@ use core::num::NonZeroU64; use wgpu::util::DeviceExt as _; use wgpu::*; use wgpu_test::{ - gpu_test, image::ReadbackBuffers, FailureCase, GpuTestConfiguration, GpuTestInitializer, + apply, gpu_test, image::ReadbackBuffers, FailureCase, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext, }; @@ -75,7 +75,7 @@ pub fn all_tests(vec: &mut Vec) { } // Checks if discarding a color target resets its init state, causing a zero read of this texture when copied in after submit of the encoder. -#[gpu_test] +#[apply(gpu_test!)] static DISCARDING_COLOR_TARGET_RESETS_TEXTURE_INIT_STATE_CHECK_VISIBLE_ON_COPY_AFTER_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().expect_fail(FailureCase::webgl2())) @@ -92,7 +92,7 @@ static DISCARDING_COLOR_TARGET_RESETS_TEXTURE_INIT_STATE_CHECK_VISIBLE_ON_COPY_A case.assert_buffers_are_zero().await; }); -#[gpu_test] +#[apply(gpu_test!)] static DISCARDING_COLOR_TARGET_RESETS_TEXTURE_INIT_STATE_CHECK_VISIBLE_ON_COPY_IN_SAME_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().expect_fail(FailureCase::webgl2())) @@ -106,7 +106,7 @@ static DISCARDING_COLOR_TARGET_RESETS_TEXTURE_INIT_STATE_CHECK_VISIBLE_ON_COPY_I case.assert_buffers_are_zero().await; }); -#[gpu_test] +#[apply(gpu_test!)] static DISCARDING_DEPTH_TARGET_RESETS_TEXTURE_INIT_STATE_CHECK_VISIBLE_ON_COPY_IN_SAME_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -134,7 +134,7 @@ static DISCARDING_DEPTH_TARGET_RESETS_TEXTURE_INIT_STATE_CHECK_VISIBLE_ON_COPY_I } }); -#[gpu_test] +#[apply(gpu_test!)] static DISCARDING_EITHER_DEPTH_OR_STENCIL_ASPECT_TEST: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -399,7 +399,7 @@ impl<'ctx> DiscardTestCase<'ctx> { // Tests that a full-extent, single-aspect `write_texture` does not cause // *other* aspects of a multi-aspect texture to be considered initialized. -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_STENCIL_LEAVES_DEPTH_UNINIT_DEPTH32FLOAT_STENCIL8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -422,7 +422,7 @@ static WRITE_TEXTURE_STENCIL_LEAVES_DEPTH_UNINIT_DEPTH32FLOAT_STENCIL8: GpuTestC // Note: there aren't corresponding `WRITE_TEXTURE_DEPTH_LEAVES_STENCIL_UNINIT_*` // cases because the depth aspect of the combined depth/stencil formats cannot // be the destination of a `write_texture` call. -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_STENCIL_LEAVES_DEPTH_UNINIT_DEPTH24PLUS_STENCIL8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -493,7 +493,7 @@ static WRITE_TEXTURE_STENCIL_LEAVES_DEPTH_UNINIT_DEPTH24PLUS_STENCIL8: GpuTestCo ); }); -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_PLANE0_LEAVES_PLANE1_UNINIT_NV12: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -515,7 +515,7 @@ static WRITE_TEXTURE_PLANE0_LEAVES_PLANE1_UNINIT_NV12: GpuTestConfiguration = .await; }); -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_PLANE1_LEAVES_PLANE0_UNINIT_NV12: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -537,7 +537,7 @@ static WRITE_TEXTURE_PLANE1_LEAVES_PLANE0_UNINIT_NV12: GpuTestConfiguration = .await; }); -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_PLANE0_LEAVES_PLANE1_UNINIT_P010: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -559,7 +559,7 @@ static WRITE_TEXTURE_PLANE0_LEAVES_PLANE1_UNINIT_P010: GpuTestConfiguration = .await; }); -#[gpu_test] +#[apply(gpu_test!)] static WRITE_TEXTURE_PLANE1_LEAVES_PLANE0_UNINIT_P010: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -584,7 +584,7 @@ static WRITE_TEXTURE_PLANE1_LEAVES_PLANE0_UNINIT_P010: GpuTestConfiguration = // The write_texture tests exhaustively cover all the relevant format/aspect combinations. // These copy_buffer_to_texture tests only sanity-check one depth/stencil format and one // multi-planar format. -#[gpu_test] +#[apply(gpu_test!)] static COPY_BUFFER_TO_TEXTURE_STENCIL_LEAVES_DEPTH_UNINIT_DEPTH32FLOAT_STENCIL8: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -604,7 +604,7 @@ static COPY_BUFFER_TO_TEXTURE_STENCIL_LEAVES_DEPTH_UNINIT_DEPTH32FLOAT_STENCIL8: .await; }); -#[gpu_test] +#[apply(gpu_test!)] static COPY_BUFFER_TO_TEXTURE_PLANE0_LEAVES_PLANE1_UNINIT_NV12: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -855,7 +855,7 @@ async fn check_write_aspect_leaves_other_uninit( } // Test that buffer ranges are properly initialized when used with a dynamic offset binding. -#[gpu_test] +#[apply(gpu_test!)] static DYNAMIC_OFFSET_BUFFER_BINDING_INIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -1008,7 +1008,7 @@ const D3_DEPTH: u32 = 4; // A read from a fresh 3D texture as a copy *source* at `origin.z >= 1` must // trigger initialization of the full texture. -#[gpu_test] +#[apply(gpu_test!)] static COPY_TEXTURE_TO_BUFFER_3D_SOURCE_ORIGIN_Z_UNINIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().limits(Limits::downlevel_defaults())) @@ -1016,7 +1016,7 @@ static COPY_TEXTURE_TO_BUFFER_3D_SOURCE_ORIGIN_Z_UNINIT: GpuTestConfiguration = check_3d_copy_source_init(&ctx, ReadMethod::CopyTextureToBuffer).await; }); -#[gpu_test] +#[apply(gpu_test!)] static COPY_TEXTURE_TO_TEXTURE_3D_SOURCE_ORIGIN_Z_UNINIT: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().limits(Limits::downlevel_defaults())) @@ -1026,7 +1026,7 @@ static COPY_TEXTURE_TO_TEXTURE_3D_SOURCE_ORIGIN_Z_UNINIT: GpuTestConfiguration = // The first depth slice must be initialized to zero before a partial copy into a fresh 3D // texture with destination `origin.z >= 1`. -#[gpu_test] +#[apply(gpu_test!)] static COPY_BUFFER_TO_TEXTURE_3D_DEST_ORIGIN_Z_PARTIAL: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().limits(Limits::downlevel_defaults())) @@ -1034,7 +1034,7 @@ static COPY_BUFFER_TO_TEXTURE_3D_DEST_ORIGIN_Z_PARTIAL: GpuTestConfiguration = check_3d_copy_dest_init(&ctx, WriteMethod::CopyBufferToTexture).await; }); -#[gpu_test] +#[apply(gpu_test!)] static COPY_TEXTURE_TO_TEXTURE_3D_DEST_ORIGIN_Z_PARTIAL: GpuTestConfiguration = GpuTestConfiguration::new() .parameters(TestParameters::default().limits(Limits::downlevel_defaults())) @@ -1286,7 +1286,7 @@ const VB_TAIL_SHADER: &str = " "; // `MAP_WRITE` + `VERTEX` requires `MAPPABLE_PRIMARY_BUFFERS`. -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_BUFFER_TAIL_INIT_PLAIN: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -1299,7 +1299,7 @@ static VERTEX_BUFFER_TAIL_INIT_PLAIN: GpuTestConfiguration = GpuTestConfiguratio } }); -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_BUFFER_TAIL_INIT_MAP_WRITE: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( TestParameters::default() @@ -1312,7 +1312,7 @@ static VERTEX_BUFFER_TAIL_INIT_MAP_WRITE: GpuTestConfiguration = GpuTestConfigur } }); -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_BUFFER_TAIL_INIT_MAPPED_AT_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( @@ -1326,7 +1326,7 @@ static VERTEX_BUFFER_TAIL_INIT_MAPPED_AT_CREATION: GpuTestConfiguration = } }); -#[gpu_test] +#[apply(gpu_test!)] static VERTEX_BUFFER_TAIL_INIT_MAP_WRITE_MAPPED_AT_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() .parameters( diff --git a/wgpu-macros/Cargo.toml b/wgpu-macros/Cargo.toml deleted file mode 100644 index 70d21dac0..000000000 --- a/wgpu-macros/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "wgpu-macros" -version.workspace = true -edition.workspace = true -description = "Macros for wgpu" -homepage.workspace = true -repository.workspace = true -keywords.workspace = true -license.workspace = true -rust-version.workspace = true -exclude = ["Cargo.lock"] -publish = false - -[lib] -proc-macro = true - -[dependencies] -heck.workspace = true -quote.workspace = true -syn = { workspace = true, features = ["full"] } - -[lints] -workspace = true diff --git a/wgpu-macros/src/lib.rs b/wgpu-macros/src/lib.rs deleted file mode 100644 index 740948abc..000000000 --- a/wgpu-macros/src/lib.rs +++ /dev/null @@ -1,30 +0,0 @@ -use heck::ToSnakeCase; -use proc_macro::TokenStream; -use quote::quote; -use syn::Ident; - -/// Creates a test that will run on all gpus on a given system. -/// -/// Apply this macro to a static variable with a type that can be converted to a `GpuTestConfiguration`. -#[proc_macro_attribute] -pub fn gpu_test(_attr: TokenStream, item: TokenStream) -> TokenStream { - let input_static = syn::parse_macro_input!(item as syn::ItemStatic); - let vis = input_static.vis; - let expr = &input_static.expr; - let ident = &input_static.ident; - let ident_str = ident.to_string(); - let ident_lower = ident_str.to_snake_case(); - - let register_test_name = Ident::new(&format!("{ident}"), ident.span()); - - quote! { - #[allow(non_snake_case)] - #vis fn #register_test_name() -> ::wgpu_test::GpuTestConfiguration { - struct S; - - // Allow any type that can be converted to a GpuTestConfiguration - ::wgpu_test::GpuTestConfiguration::from(#expr).name_from_init_function_typename::(#ident_lower) - } - } - .into() -}