Replace wgpu-macros package with use of macro_rules_attribute. (#9963)

This commit is contained in:
Kevin Reid authored and GitHub committed 2026-07-30 06:16:43 -04:00
1 parent f9f55b7d51
commit d0ecda96cd
132 files changed
+889 -897

No files matched your search

Generated
+2 -10
View File
@@ -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",
]
+1 -6
View File
@@ -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"
+2 -2
View File
@@ -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
@@ -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()
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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",
@@ -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",
@@ -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()
+2 -2
View File
@@ -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
@@ -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.
+1 -1
View File
@@ -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",
+2 -2
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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",
+1 -1
View File
@@ -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",
+4 -4
View File
@@ -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",
+2 -2
View File
@@ -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
@@ -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",
+3 -3
View File
@@ -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",
@@ -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()
+1 -1
View File
@@ -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",
+2 -1
View File
@@ -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
+30 -1
View File
@@ -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::<S>(stringify!([< $static_name:lower >]))
}
}
};
}
#[doc(hidden)]
pub mod macro_support {
pub use paste::paste;
}
+2 -2
View File
@@ -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<GpuTestInitializer>) {
vec.push(STRICT_WEBGPU_COMPLIANCE_ADAPTER);
}
#[gpu_test]
#[apply(gpu_test!)]
static STRICT_WEBGPU_COMPLIANCE_ADAPTER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
+2 -2
View File
@@ -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<GpuTestInitializer>) {
vec.push(BGRA8_UNORM_STORAGE);
@@ -17,7 +17,7 @@ fn main(@builtin(workgroup_id) wgid: vec3<u32>) {
}
";
#[gpu_test]
#[apply(gpu_test!)]
static BGRA8_UNORM_STORAGE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
@@ -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<GpuTestInitializer>) {
@@ -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()
+8 -7
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
@@ -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<GpuTestInitializer>) {
@@ -14,7 +15,7 @@ pub fn all_tests(tests: &mut Vec<GpuTestInitializer>) {
]);
}
#[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,
@@ -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<GpuTestInitializer>) {
@@ -14,7 +14,7 @@ pub fn all_tests(tests: &mut Vec<GpuTestInitializer>) {
]);
}
#[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(
@@ -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<GpuTestInitializer>) {
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()
@@ -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<GpuTestInitializer>) {
@@ -13,7 +13,7 @@ pub fn all_tests(tests: &mut Vec<GpuTestInitializer>) {
]);
}
#[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()
+2 -2
View File
@@ -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<GpuTestInitializer>) {
tests.push(BINDING_ARRAY_TLAS);
}
#[gpu_test]
#[apply(gpu_test!)]
static BINDING_ARRAY_TLAS: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
+10 -9
View File
@@ -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<GpuTestInitializer>) {
@@ -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())
+4 -2
View File
@@ -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<GpuTestInitializer>) {
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| {
+340 -339
View File
@@ -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<GpuTestInitializer>) {
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<wgpu::BindGroupLayoutEntry> {
(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<wgpu::BindGroupLayoutEntry> {
(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<wgpu::VertexBufferLayout<'static>> =
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<wgpu::VertexBufferLayout<'static>> =
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<GpuTestInitializer>) {
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<wgpu::BindGroupLayoutEntry> {
(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<wgpu::BindGroupLayoutEntry> {
(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<wgpu::VertexBufferLayout<'static>> =
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<wgpu::VertexBufferLayout<'static>> =
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"),
);
});
+5 -4
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
+8 -8
View File
@@ -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()
+2 -2
View File
@@ -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<GpuTestInitializer>) {
vec.push(CLIP_DISTANCES);
}
#[gpu_test]
#[apply(gpu_test!)]
static CLIP_DISTANCES: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
+2 -2
View File
@@ -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<GpuTestInitializer>) {
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);
@@ -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<GpuTestInitializer>) {
@@ -26,7 +27,7 @@ var<storage, read_write> buffer: array<vec4f>;
}
";
#[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()
@@ -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<GpuTestInitializer>) {
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| {
+2 -2
View File
@@ -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<GpuTestInitializer>) {
vec.push(CANVAS_GET_CONTEXT_RETURNED_NULL);
@@ -10,7 +10,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// 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 {
+11 -10
View File
@@ -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<GpuTestInitializer>) {
@@ -21,7 +22,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
}
}
#[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 {
@@ -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<GpuTestInitializer>) {
@@ -12,7 +12,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
}
/// 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()
+6 -5
View File
@@ -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<GpuTestInitializer>) {
@@ -64,7 +65,7 @@ fn fragment() -> @location(0) vec4<f32> {
});
}
#[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);
+5 -5
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
+3 -3
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
+5 -5
View File
@@ -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<GpuTestInitializer>) {
]);
}
#[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()
+2 -2
View File
@@ -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");
+9 -9
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
+3 -3
View File
@@ -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<GpuTestInitializer>) {
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()
+5 -5
View File
@@ -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<GpuTestInitializer>) {
]);
}
#[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| {
+3 -3
View File
@@ -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<GpuTestInitializer>) {
@@ -18,7 +18,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
///
/// 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()
+2 -2
View File
@@ -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<GpuTestInitializer>) {
vec.push(INITIALIZE);
}
#[gpu_test]
#[apply(gpu_test!)]
static INITIALIZE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|_ctx| {});
+11 -11
View File
@@ -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<GpuTestInitializer>) {
@@ -19,7 +19,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
]);
}
#[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()
+1 -1
View File
@@ -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(
+13 -13
View File
@@ -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<GpuTestInitializer>) {
@@ -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(
+6 -5
View File
@@ -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<GpuTestInitializer>) {
@@ -12,7 +13,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
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()
+2 -2
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
+4 -2
View File
@@ -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<GpuTestInitializer>) {
vec.push(OCCLUSION_QUERY);
}
#[gpu_test]
#[apply(gpu_test!)]
static OCCLUSION_QUERY: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
+6 -4
View File
@@ -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<wgpu_test::GpuTestInitializer>) {
vec.extend([
@@ -12,7 +14,7 @@ pub fn all_tests(vec: &mut Vec<wgpu_test::GpuTestInitializer>) {
/// 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()
+7 -7
View File
@@ -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<GpuTestInitializer>) {
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()
+5 -5
View File
@@ -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<GpuTestInitializer>) {
]);
}
#[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(
+12 -11
View File
@@ -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(
+2 -2
View File
@@ -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<wgpu_test::GpuTestInitializer>) {
vec.push(PER_VERTEX);
@@ -30,7 +30,7 @@ pub fn all_tests(vec: &mut Vec<wgpu_test::GpuTestInitializer>) {
// return vec4(z[0], z[1], z[2], 1.0);
//
#[gpu_test]
#[apply(gpu_test!)]
static PER_VERTEX: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
+6 -6
View File
@@ -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<GpuTestInitializer>) {
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| {
+2 -2
View File
@@ -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<wgpu_test::GpuTestInitializer>) {
vec.push(PIPELINE_CACHE);
@@ -11,7 +11,7 @@ pub fn all_tests(vec: &mut Vec<wgpu_test::GpuTestInitializer>) {
/// 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()
+7 -7
View File
@@ -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<GpuTestInitializer>) {
@@ -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()
+14 -13
View File
@@ -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<GpuTestInitializer>) {
@@ -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<u32>) {
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 <https://github.com/gfx-rs/wgpu/issues/9498>.
#[gpu_test]
#[apply(gpu_test!)]
static WAIT_ON_FAILED_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(wgpu_test::TestParameters::default())
.run_async(wait_on_failed_submission);
+6 -5
View File
@@ -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<GpuTestInitializer>) {
@@ -58,7 +59,7 @@ fn fragment(@builtin(primitive_index) index: u32) -> @location(0) vec4<f32> {
});
}
#[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);
+2 -2
View File
@@ -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<GpuTestInitializer>) {
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| {
+4 -4
View File
@@ -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<GpuTestInitializer>) {
vec.extend([
@@ -11,7 +11,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
]);
}
#[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
+8 -8
View File
@@ -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()
+16 -16
View File
@@ -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<GpuTestInitializer>) {
]);
}
#[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()
@@ -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<wgpu_test::GpuTestInitializer>) {
tests.extend([
@@ -16,7 +15,7 @@ pub fn all_tests(tests: &mut Vec<wgpu_test::GpuTestInitializer>) {
]);
}
#[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())
@@ -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<wgpu_test::GpuTestInitializer>) {
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()
+2 -3
View File
@@ -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<wgpu_test::GpuTestInitializer>) {
tests.push(LIMITS_HIT);
}
#[gpu_test]
#[apply(gpu_test!)]
static LIMITS_HIT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
@@ -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()
+5 -5
View File
@@ -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<GpuTestInitializer>) {
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
@@ -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<GpuTestInitializer>) {
@@ -27,7 +27,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// 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()
@@ -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<GpuTestInitializer>) {
///
/// 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 {
@@ -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<GpuTestInitializer>) {
///
/// 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 {
@@ -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<GpuTestInitializer>) {
@@ -91,7 +91,7 @@ async fn fill_test(ctx: &TestingContext, range: Range<u64>, 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 {
@@ -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<GpuTestInitializer>) {
@@ -14,7 +15,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// 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 });
@@ -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<GpuTestInitializer>) {
@@ -14,7 +15,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
///
/// 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 });
@@ -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<GpuTestInitializer>) {
vec.push(READ_ONLY_DEPTH_WITHOUT_TEXTURE_BINDING);
@@ -18,7 +19,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// 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()
@@ -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<GpuTestInitializer>) {
/// 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 {
@@ -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<GpuTestInitializer>) {
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()
@@ -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<GpuTestInitializer>) {
vec.push(ZERO_WORKGROUP_COUNT);
@@ -11,7 +11,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// 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()
@@ -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<GpuTestInitializer>) {
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()
@@ -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<GpuTestInitializer>) {
@@ -13,7 +13,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// The backend incorrectly encountered the uniform's struct type when processing immediates.
///
/// See <https://github.com/gfx-rs/wgpu/issues/9115>.
#[gpu_test]
#[apply(gpu_test!)]
static IMMEDIATES_WITH_UNIFORM_IN_SINGLE_MODULE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
@@ -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<GpuTestInitializer>) {
@@ -47,7 +48,7 @@ fn fs_main() -> @location(0) vec4<f32> {
return vec4<f32>(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()
+6 -6
View File
@@ -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<GpuTestInitializer>) {
@@ -16,22 +16,22 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
]);
}
#[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()
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff. Show more