Label no-op supporting tests

This commit is contained in:
Connor Fitzgerald 2025-07-14 00:27:13 -04:00
parent 09d0c94576
commit 3e153fb8ec
50 changed files with 683 additions and 497 deletions

View File

@ -6,7 +6,7 @@ use std::{ffi::OsStr, fs, path::Path};
/// Runs through all example shaders and ensures they are valid wgsl.
// While we _can_ run this test under miri, it is extremely slow (>5 minutes),
// and naga isn't the primary target for miri testing, so we disable it.
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
#[test]
pub fn parse_example_wgsl() {
let example_path = Path::new(env!("CARGO_MANIFEST_DIR"))

View File

@ -820,7 +820,8 @@ fn write_output_wgsl(
// While we _can_ run this test under miri, it is extremely slow (>5 minutes),
// and naga isn't the primary target for miri testing, so we disable it.
#[cfg(all(feature = "wgsl-in", not(miri)))]
#[cfg(feature = "wgsl-in")]
#[cfg_attr(miri, ignore)]
#[test]
fn convert_snapshots_wgsl() {
let _ = env_logger::try_init();
@ -846,7 +847,8 @@ fn convert_snapshots_wgsl() {
}
// miri doesn't allow us to shell out to `spirv-as`
#[cfg(all(feature = "spv-in", not(miri)))]
#[cfg(feature = "spv-in")]
#[cfg_attr(miri, ignore)]
#[test]
fn convert_snapshots_spv() {
use std::process::Command;
@ -897,7 +899,8 @@ fn convert_snapshots_spv() {
// While we _can_ run this test under miri, it is extremely slow (>5 minutes),
// and naga isn't the primary target for miri testing, so we disable it.
#[cfg(all(feature = "glsl-in", not(miri)))]
#[cfg(feature = "glsl-in")]
#[cfg_attr(miri, ignore)]
#[allow(unused_variables)]
#[test]
fn convert_snapshots_glsl() {

View File

@ -245,7 +245,7 @@ impl Corpus {
}
}
#[cfg(not(miri))]
#[cfg_attr(miri, ignore)]
#[test]
fn test_api() {
env_logger::init();

View File

@ -1,6 +1,7 @@
#![cfg(not(miri))]
// Tests that ensure that various constructs that should not compile do not compile.
#[cfg_attr(miri, ignore)]
#[test]
fn compile_fail() {
let t = trybuild::TestCases::new();

View File

@ -40,7 +40,11 @@ const ENTRY: wgpu::BindGroupLayoutEntry = wgpu::BindGroupLayoutEntry {
#[gpu_test]
static BIND_GROUP_LAYOUT_DEDUPLICATION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_async(bgl_dedupe);
async fn bgl_dedupe(ctx: TestingContext) {
@ -120,7 +124,11 @@ async fn bgl_dedupe(ctx: TestingContext) {
#[gpu_test]
static BIND_GROUP_LAYOUT_DEDUPLICATION_WITH_DROPPED_USER_HANDLE: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(bgl_dedupe_with_dropped_user_handle);
// https://github.com/gfx-rs/wgpu/issues/4824
@ -203,7 +211,11 @@ fn bgl_dedupe_with_dropped_user_handle(ctx: TestingContext) {
#[gpu_test]
static GET_DERIVED_BGL: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(get_derived_bgl);
fn get_derived_bgl(ctx: TestingContext) {
@ -277,7 +289,11 @@ fn get_derived_bgl(ctx: TestingContext) {
#[gpu_test]
static SEPARATE_PIPELINES_HAVE_INCOMPATIBLE_DERIVED_BGLS: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(separate_pipelines_have_incompatible_derived_bgls);
fn separate_pipelines_have_incompatible_derived_bgls(ctx: TestingContext) {
@ -341,7 +357,11 @@ fn separate_pipelines_have_incompatible_derived_bgls(ctx: TestingContext) {
#[gpu_test]
static DERIVED_BGLS_INCOMPATIBLE_WITH_REGULAR_BGLS: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(derived_bgls_incompatible_with_regular_bgls);
fn derived_bgls_incompatible_with_regular_bgls(ctx: TestingContext) {
@ -412,7 +432,11 @@ fn derived_bgls_incompatible_with_regular_bgls(ctx: TestingContext) {
#[gpu_test]
static BIND_GROUP_LAYOUT_DEDUPLICATION_DERIVED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(bgl_dedupe_derived);
fn bgl_dedupe_derived(ctx: TestingContext) {

View File

@ -176,14 +176,15 @@ static MULTIPLE_BINDINGS_WITH_DIFFERENT_SIZES: GpuTestConfiguration = GpuTestCon
.parameters(
TestParameters::default()
.limits(wgpu::Limits::downlevel_defaults())
.expect_fail(FailureCase::always()), // https://github.com/gfx-rs/wgpu/issues/7359
.expect_fail(FailureCase::always())
.enable_noop(), // https://github.com/gfx-rs/wgpu/issues/7359
)
.run_sync(multiple_bindings_with_differing_sizes);
#[gpu_test]
static BIND_GROUP_NONFILTERING_LAYOUT_NONFILTERING_SAMPLER: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
try_sampler_nonfiltering_layout(
ctx,
@ -201,7 +202,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_NONFILTERING_SAMPLER: GpuTestConfiguration
#[gpu_test]
static BIND_GROUP_NONFILTERING_LAYOUT_MIN_SAMPLER: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
try_sampler_nonfiltering_layout(
ctx,
@ -219,7 +220,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MIN_SAMPLER: GpuTestConfiguration =
#[gpu_test]
static BIND_GROUP_NONFILTERING_LAYOUT_MAG_SAMPLER: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
try_sampler_nonfiltering_layout(
ctx,
@ -237,7 +238,7 @@ static BIND_GROUP_NONFILTERING_LAYOUT_MAG_SAMPLER: GpuTestConfiguration =
#[gpu_test]
static BIND_GROUP_NONFILTERING_LAYOUT_MIPMAP_SAMPLER: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
try_sampler_nonfiltering_layout(
ctx,

View File

@ -95,78 +95,84 @@ async fn test_empty_buffer_range(ctx: &TestingContext, buffer_size: u64, label:
#[gpu_test]
static EMPTY_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().expect_fail(FailureCase::always()))
.parameters(
TestParameters::default()
.expect_fail(FailureCase::always())
.enable_noop(),
)
.run_async(|ctx| async move {
test_empty_buffer_range(&ctx, 2048, "regular buffer").await;
test_empty_buffer_range(&ctx, 0, "zero-sized buffer").await;
});
#[gpu_test]
static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move {
// This test writes 16 bytes at the beginning of buffer mapped mapped with
// an offset of 32 bytes. Then the buffer is copied into another buffer that
// is read back and we check that the written bytes are correctly placed at
// offset 32..48.
// The goal is to check that get_mapped_range did not accidentally double-count
// the mapped offset.
static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
// This test writes 16 bytes at the beginning of buffer mapped mapped with
// an offset of 32 bytes. Then the buffer is copied into another buffer that
// is read back and we check that the written bytes are correctly placed at
// offset 32..48.
// The goal is to check that get_mapped_range did not accidentally double-count
// the mapped offset.
let write_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 256,
usage: wgpu::BufferUsages::MAP_WRITE | wgpu::BufferUsages::COPY_SRC,
mapped_at_creation: false,
});
let read_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 256,
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
write_buf
.slice(32..)
.map_async(wgpu::MapMode::Write, move |result| {
result.unwrap();
let write_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 256,
usage: wgpu::BufferUsages::MAP_WRITE | wgpu::BufferUsages::COPY_SRC,
mapped_at_creation: false,
});
let read_buf = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 256,
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
write_buf
.slice(32..)
.map_async(wgpu::MapMode::Write, move |result| {
result.unwrap();
});
{
let slice = write_buf.slice(32..48);
let mut view = slice.get_mapped_range_mut();
for byte in &mut view[..] {
*byte = 2;
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
{
let slice = write_buf.slice(32..48);
let mut view = slice.get_mapped_range_mut();
for byte in &mut view[..] {
*byte = 2;
}
}
}
write_buf.unmap();
write_buf.unmap();
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
encoder.copy_buffer_to_buffer(&write_buf, 0, &read_buf, 0, 256);
encoder.copy_buffer_to_buffer(&write_buf, 0, &read_buf, 0, 256);
ctx.queue.submit(Some(encoder.finish()));
ctx.queue.submit(Some(encoder.finish()));
read_buf
.slice(..)
.map_async(wgpu::MapMode::Read, Result::unwrap);
read_buf
.slice(..)
.map_async(wgpu::MapMode::Read, Result::unwrap);
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
ctx.async_poll(wgpu::PollType::wait()).await.unwrap();
let slice = read_buf.slice(..);
let view = slice.get_mapped_range();
for byte in &view[0..32] {
assert_eq!(*byte, 0);
}
for byte in &view[32..48] {
assert_eq!(*byte, 2);
}
for byte in &view[48..] {
assert_eq!(*byte, 0);
}
});
let slice = read_buf.slice(..);
let view = slice.get_mapped_range();
for byte in &view[0..32] {
assert_eq!(*byte, 0);
}
for byte in &view[32..48] {
assert_eq!(*byte, 2);
}
for byte in &view[48..] {
assert_eq!(*byte, 0);
}
});
/// The WebGPU algorithm [validating shader binding][vsb] requires
/// implementations to check that buffer bindings are large enough to
@ -177,7 +183,7 @@ static MAP_OFFSET: GpuTestConfiguration = GpuTestConfiguration::new().run_async(
/// 16 for that variable's group/index. Pipeline creation should fail.
#[gpu_test]
static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(TestParameters::default().test_features_limits().enable_noop())
.run_sync(|ctx| {
// Create a shader module that statically uses a storage buffer.
let shader_module = ctx
@ -247,7 +253,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_LAYOUT: GpuTestConfiguration = GpuTestConfigu
/// binding. Command recording should fail.
#[gpu_test]
static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(TestParameters::default().test_features_limits().enable_noop())
.run_sync(|ctx| {
// This test tries to use a bindgroup layout with a
// min_binding_size of 16 to an index whose WGSL type requires 32
@ -344,7 +350,7 @@ static MINIMUM_BUFFER_BINDING_SIZE_DISPATCH: GpuTestConfiguration = GpuTestConfi
#[gpu_test]
static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let size = 16;
@ -370,7 +376,7 @@ static CLEAR_OFFSET_OUTSIDE_RESOURCE_BOUNDS: GpuTestConfiguration = GpuTestConfi
#[gpu_test]
static CLEAR_OFFSET_PLUS_SIZE_OUTSIDE_U64_BOUNDS: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,

View File

@ -2,7 +2,7 @@
use wgpu::BufferAddress;
use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(COPY_ALIGNMENT);
@ -26,49 +26,51 @@ fn try_copy(
}
#[gpu_test]
static COPY_ALIGNMENT: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
try_copy(&ctx, 0, 0, None);
try_copy(
&ctx,
4,
16 + 1,
Some("copy size 17 does not respect `copy_buffer_alignment`"),
);
try_copy(
&ctx,
64,
20 + 2,
Some("copy size 22 does not respect `copy_buffer_alignment`"),
);
try_copy(
&ctx,
256,
44 + 3,
Some("copy size 47 does not respect `copy_buffer_alignment`"),
);
try_copy(&ctx, 1024, 8 + 4, None);
static COPY_ALIGNMENT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
try_copy(&ctx, 0, 0, None);
try_copy(
&ctx,
4,
16 + 1,
Some("copy size 17 does not respect `copy_buffer_alignment`"),
);
try_copy(
&ctx,
64,
20 + 2,
Some("copy size 22 does not respect `copy_buffer_alignment`"),
);
try_copy(
&ctx,
256,
44 + 3,
Some("copy size 47 does not respect `copy_buffer_alignment`"),
);
try_copy(&ctx, 1024, 8 + 4, None);
try_copy(&ctx, 0, 4, None);
try_copy(
&ctx,
4 + 1,
8,
Some("buffer offset 5 is not aligned to block size or `copy_buffer_alignment`"),
);
try_copy(
&ctx,
64 + 2,
12,
Some("buffer offset 66 is not aligned to block size or `copy_buffer_alignment`"),
);
try_copy(
&ctx,
256 + 3,
16,
Some("buffer offset 259 is not aligned to block size or `copy_buffer_alignment`"),
);
try_copy(&ctx, 1024 + 4, 4, None);
});
try_copy(&ctx, 0, 4, None);
try_copy(
&ctx,
4 + 1,
8,
Some("buffer offset 5 is not aligned to block size or `copy_buffer_alignment`"),
);
try_copy(
&ctx,
64 + 2,
12,
Some("buffer offset 66 is not aligned to block size or `copy_buffer_alignment`"),
);
try_copy(
&ctx,
256 + 3,
16,
Some("buffer offset 259 is not aligned to block size or `copy_buffer_alignment`"),
);
try_copy(&ctx, 1024 + 4, 4, None);
});
const BUFFER_SIZE: BufferAddress = 1234;

View File

@ -59,20 +59,26 @@ fn try_create(ctx: TestingContext, usages: &[(bool, &[wgpu::BufferUsages])]) {
}
#[gpu_test]
static BUFFER_USAGE: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
try_create(
ctx,
&[
(false, ALWAYS_VALID),
(true, NEEDS_MAPPABLE_PRIMARY_BUFFERS),
(true, ALWAYS_FAIL),
],
);
});
static BUFFER_USAGE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
try_create(
ctx,
&[
(false, ALWAYS_VALID),
(true, NEEDS_MAPPABLE_PRIMARY_BUFFERS),
(true, ALWAYS_FAIL),
],
);
});
#[gpu_test]
static BUFFER_USAGE_MAPPABLE_PRIMARY_BUFFERS: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::MAPPABLE_PRIMARY_BUFFERS))
.parameters(
TestParameters::default()
.features(wgpu::Features::MAPPABLE_PRIMARY_BUFFERS)
.enable_noop(),
)
.run_sync(|ctx| {
try_create(
ctx,
@ -169,7 +175,11 @@ async fn map_test(
#[gpu_test]
static BUFFER_MAP_ASYNC_MAP_STATE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::MAPPABLE_PRIMARY_BUFFERS))
.parameters(
TestParameters::default()
.features(wgpu::Features::MAPPABLE_PRIMARY_BUFFERS)
.enable_noop(),
)
.run_async(move |ctx| async move {
for usage_type in ["invalid", "read", "write"] {
for map_mode_type in [Ma::Read, Ma::Write] {

View File

@ -1,12 +1,13 @@
use wgpu_test::{gpu_test, GpuTestInitializer, TestingContext};
use wgpu_test::{gpu_test, GpuTestInitializer, TestParameters, TestingContext};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(CLONEABLE_BUFFERS);
}
#[gpu_test]
static CLONEABLE_BUFFERS: GpuTestConfiguration =
wgpu_test::GpuTestConfiguration::new().run_sync(cloneable_buffers);
static CLONEABLE_BUFFERS: GpuTestConfiguration = wgpu_test::GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(cloneable_buffers);
// Test a basic case of cloneable types where you clone the buffer to be able
// to access the buffer inside the callback as well as outside.

View File

@ -175,7 +175,11 @@ async fn compute_pass_query_set_ownership_timestamps(ctx: TestingContext) {
#[gpu_test]
static COMPUTE_PASS_KEEP_ENCODER_ALIVE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_async(compute_pass_keep_encoder_alive);
async fn compute_pass_keep_encoder_alive(ctx: TestingContext) {

View File

@ -26,7 +26,11 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
#[gpu_test]
static CROSS_DEVICE_BIND_GROUP_USAGE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().expect_fail(FailureCase::always()))
.parameters(
TestParameters::default()
.expect_fail(FailureCase::always())
.enable_noop(),
)
.run_async(|ctx| async move {
// Create a bind group using a layout from another device. This should be a validation
// error but currently crashes.
@ -53,7 +57,7 @@ static CROSS_DEVICE_BIND_GROUP_USAGE: GpuTestConfiguration = GpuTestConfiguratio
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[gpu_test]
static DEVICE_LIFETIME_CHECK: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
ctx.instance.poll_all(false);
@ -80,7 +84,7 @@ static DEVICE_LIFETIME_CHECK: GpuTestConfiguration = GpuTestConfiguration::new()
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[gpu_test]
static MULTIPLE_DEVICES: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
use pollster::FutureExt as _;
ctx.adapter
@ -162,7 +166,11 @@ async fn request_device_error_message() {
// should turn into no-ops, per spec.
#[gpu_test]
static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::CLEAR_TEXTURE))
.parameters(
TestParameters::default()
.features(wgpu::Features::CLEAR_TEXTURE)
.enable_noop(),
)
.run_sync(|ctx| {
// Create some resources on the device that we will attempt to use *after* losing
// the device.
@ -474,7 +482,7 @@ static DEVICE_DESTROY_THEN_MORE: GpuTestConfiguration = GpuTestConfiguration::ne
#[gpu_test]
static DEVICE_DESTROY_THEN_LOST: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
// This test checks that when device.destroy is called, the provided
// DeviceLostClosure is called with reason DeviceLostReason::Destroyed.
@ -509,7 +517,7 @@ static DEVICE_DESTROY_THEN_LOST: GpuTestConfiguration = GpuTestConfiguration::ne
#[gpu_test]
static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
// This test addresses a bug found in multiple backends where `wgpu_core` and `wgpu_hal`
// backends made different assumptions about the element order of vectors of bind group
@ -636,7 +644,7 @@ static DIFFERENT_BGL_ORDER_BW_SHADER_AND_API: GpuTestConfiguration = GpuTestConf
#[gpu_test]
static DEVICE_DESTROY_THEN_BUFFER_CLEANUP: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
// When a device is destroyed, its resources should be released,
// without causing a deadlock.
@ -675,7 +683,7 @@ static DEVICE_DESTROY_THEN_BUFFER_CLEANUP: GpuTestConfiguration = GpuTestConfigu
#[gpu_test]
static DEVICE_AND_QUEUE_HAVE_DIFFERENT_IDS: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let TestingContext {
adapter,

View File

@ -74,7 +74,7 @@ static RESET_BIND_GROUPS: GpuTestConfiguration = GpuTestConfiguration::new()
.limits(wgpu::Limits {
max_push_constant_size: 4,
..wgpu::Limits::downlevel_defaults()
}),
}).enable_noop(),
)
.run_async(|ctx| async move {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
@ -116,7 +116,8 @@ static ZERO_SIZED_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new()
.limits(wgpu::Limits {
max_push_constant_size: 4,
..wgpu::Limits::downlevel_defaults()
}),
})
.enable_noop(),
)
.run_async(|ctx| async move {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);

View File

@ -343,12 +343,18 @@ macro_rules! make_test {
($name:ident, $test_data:expr, $expect_noop:expr, $features:expr) => {
#[gpu_test]
static $name: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
.parameters({
let params = TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::INDIRECT_EXECUTION)
.features($features)
.limits(wgpu::Limits::downlevel_defaults()),
)
.limits(wgpu::Limits::downlevel_defaults());
if $expect_noop {
params.enable_noop()
} else {
params
}
})
.run_async(|ctx| run_test(ctx, $test_data, $expect_noop));
};
}

View File

@ -55,7 +55,7 @@ fn blend_state_with_dual_source_blending() -> BlendState {
#[gpu_test]
static DUAL_SOURCE_BLENDING_FEATURE_DISABLED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_async(dual_source_blending_disabled);
async fn dual_source_blending_disabled(ctx: TestingContext) {
@ -118,7 +118,11 @@ async fn dual_source_blending_disabled(ctx: TestingContext) {
#[gpu_test]
static DUAL_SOURCE_BLENDING_FEATURE_ENABLED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::DUAL_SOURCE_BLENDING))
.parameters(
TestParameters::default()
.features(wgpu::Features::DUAL_SOURCE_BLENDING)
.enable_noop(),
)
.run_async(dual_source_blending_enabled);
async fn dual_source_blending_enabled(ctx: TestingContext) {

View File

@ -15,17 +15,23 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
}
#[gpu_test]
static DROP_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
let encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
drop(encoder);
});
static DROP_ENCODER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
drop(encoder);
});
#[gpu_test]
static DROP_QUEUE_BEFORE_CREATING_COMMAND_ENCODER: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().expect_fail(FailureCase::always()))
.parameters(
TestParameters::default()
.expect_fail(FailureCase::always())
.enable_noop(),
)
.run_sync(|ctx| {
// Use the device after the queue is dropped. Currently this panics
// but it probably shouldn't.
@ -38,7 +44,7 @@ static DROP_QUEUE_BEFORE_CREATING_COMMAND_ENCODER: GpuTestConfiguration =
#[gpu_test]
static DROP_ENCODER_AFTER_ERROR: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let mut encoder = ctx
.device
@ -82,11 +88,15 @@ static DROP_ENCODER_AFTER_ERROR: GpuTestConfiguration = GpuTestConfiguration::ne
#[gpu_test]
static ENCODER_OPERATIONS_FAIL_WHILE_PASS_ALIVE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(
wgpu::Features::CLEAR_TEXTURE
| wgpu::Features::TIMESTAMP_QUERY
| wgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS,
))
.parameters(
TestParameters::default()
.features(
wgpu::Features::CLEAR_TEXTURE
| wgpu::Features::TIMESTAMP_QUERY
| wgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS,
)
.enable_noop(),
)
.run_sync(encoder_operations_fail_while_pass_alive);
fn encoder_operations_fail_while_pass_alive(ctx: TestingContext) {

View File

@ -53,7 +53,7 @@ fn create_texture_binding(device: &wgpu::Device, format: wgpu::TextureFormat, fi
#[gpu_test]
static FLOAT32_FILTERABLE_WITHOUT_FEATURE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let device = &ctx.device;
// Unorm textures are always filterable
@ -80,7 +80,11 @@ static FLOAT32_FILTERABLE_WITHOUT_FEATURE: GpuTestConfiguration = GpuTestConfigu
#[gpu_test]
static FLOAT32_FILTERABLE_WITH_FEATURE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::FLOAT32_FILTERABLE))
.parameters(
TestParameters::default()
.features(wgpu::Features::FLOAT32_FILTERABLE)
.enable_noop(),
)
.run_sync(|ctx| {
let device = &ctx.device;
// With the feature enabled, it does work!

View File

@ -172,7 +172,7 @@ async fn test_format(
#[gpu_test]
static IMAGE_ATOMICS_NOT_ENABLED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 256,
@ -200,7 +200,7 @@ static IMAGE_ATOMICS_NOT_ENABLED: GpuTestConfiguration = GpuTestConfiguration::n
#[gpu_test]
static IMAGE_ATOMICS_NOT_SUPPORTED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_ATOMIC))
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_ATOMIC).enable_noop())
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 256,

View File

@ -1,8 +1,10 @@
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(INITIALIZE);
}
#[gpu_test]
static INITIALIZE: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|_ctx| {});
static INITIALIZE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|_ctx| {});

View File

@ -13,8 +13,9 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
}
#[gpu_test]
static BUFFER_DESTROY: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static BUFFER_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: Some("buffer"),
size: 256,
@ -80,8 +81,9 @@ static BUFFER_DESTROY: GpuTestConfiguration =
});
#[gpu_test]
static TEXTURE_DESTROY: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static TEXTURE_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
@ -118,7 +120,9 @@ static TEXTURE_DESTROY: GpuTestConfiguration =
static BUFFER_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
// https://github.com/gfx-rs/wgpu/issues/7854
TestParameters::default().skip(FailureCase::backend_adapter(Backends::VULKAN, "llvmpipe")),
TestParameters::default()
.skip(FailureCase::backend_adapter(Backends::VULKAN, "llvmpipe"))
.enable_noop(),
)
.run_sync(|ctx| {
let buffer_source = ctx
@ -158,7 +162,9 @@ static BUFFER_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration
static TEXTURE_DESTROY_BEFORE_SUBMIT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
// https://github.com/gfx-rs/wgpu/issues/7854
TestParameters::default().skip(FailureCase::backend_adapter(Backends::VULKAN, "llvmpipe")),
TestParameters::default()
.skip(FailureCase::backend_adapter(Backends::VULKAN, "llvmpipe"))
.enable_noop(),
)
.run_sync(|ctx| {
let descriptor = wgpu::TextureDescriptor {

View File

@ -310,7 +310,8 @@ static SIMPLE_DRAW_CHECK_MEM_LEAKS: wgpu_test::GpuTestConfiguration =
.parameters(
wgpu_test::TestParameters::default()
.test_features_limits()
.features(wgpu::Features::VERTEX_WRITABLE_STORAGE),
.features(wgpu::Features::VERTEX_WRITABLE_STORAGE)
.enable_noop(),
)
.run_async(|ctx| {
draw_test_with_reports(ctx, &[0, 1, 2, 3, 4, 5], |cmb| {

View File

@ -14,7 +14,11 @@ pub fn all_tests(tests: &mut Vec<GpuTestInitializer>) {
#[gpu_test]
static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_FORMAT_NV12))
.parameters(
TestParameters::default()
.features(wgpu::Features::TEXTURE_FORMAT_NV12)
.enable_noop(),
)
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 256,
@ -135,7 +139,11 @@ static NV12_TEXTURE_CREATION_SAMPLING: GpuTestConfiguration = GpuTestConfigurati
#[gpu_test]
static NV12_TEXTURE_VIEW_PLANE_ON_NON_PLANAR_FORMAT: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_FORMAT_NV12))
.parameters(
TestParameters::default()
.features(wgpu::Features::TEXTURE_FORMAT_NV12)
.enable_noop(),
)
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 256,
@ -166,7 +174,11 @@ static NV12_TEXTURE_VIEW_PLANE_ON_NON_PLANAR_FORMAT: GpuTestConfiguration =
#[gpu_test]
static NV12_TEXTURE_VIEW_PLANE_OUT_OF_BOUNDS: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_FORMAT_NV12))
.parameters(
TestParameters::default()
.features(wgpu::Features::TEXTURE_FORMAT_NV12)
.enable_noop(),
)
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 256,
@ -198,7 +210,11 @@ static NV12_TEXTURE_VIEW_PLANE_OUT_OF_BOUNDS: GpuTestConfiguration = GpuTestConf
#[gpu_test]
static NV12_TEXTURE_BAD_FORMAT_VIEW_PLANE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_FORMAT_NV12))
.parameters(
TestParameters::default()
.features(wgpu::Features::TEXTURE_FORMAT_NV12)
.enable_noop(),
)
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 256,
@ -230,7 +246,11 @@ static NV12_TEXTURE_BAD_FORMAT_VIEW_PLANE: GpuTestConfiguration = GpuTestConfigu
#[gpu_test]
static NV12_TEXTURE_BAD_SIZE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().features(wgpu::Features::TEXTURE_FORMAT_NV12))
.parameters(
TestParameters::default()
.features(wgpu::Features::TEXTURE_FORMAT_NV12)
.enable_noop(),
)
.run_sync(|ctx| {
let size = wgpu::Extent3d {
width: 255,

View File

@ -42,7 +42,7 @@ const TRIVIAL_FRAGMENT_SHADER_DESC: wgpu::ShaderModuleDescriptor = wgpu::ShaderM
#[gpu_test]
static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
@ -72,7 +72,11 @@ static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration =
#[gpu_test]
static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(|ctx| {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
@ -101,7 +105,7 @@ static COMPUTE_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration =
#[gpu_test]
static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
@ -138,7 +142,11 @@ static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_MODULE: GpuTestConfiguration =
#[gpu_test]
static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration =
GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_sync(|ctx| {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
@ -186,7 +194,7 @@ static RENDER_PIPELINE_DEFAULT_LAYOUT_BAD_BGL_INDEX: GpuTestConfiguration =
#[gpu_test]
static NO_TARGETLESS_RENDER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
fail(
&ctx.device,

View File

@ -6,7 +6,9 @@ use wgpu::{
CommandEncoderDescriptor, ComputePassDescriptor, PollType, ShaderStages,
};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestingContext};
use wgpu_test::{
gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext,
};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.extend([
@ -64,16 +66,19 @@ fn generate_dummy_work(ctx: &TestingContext) -> CommandBuffer {
}
#[gpu_test]
static WAIT: GpuTestConfiguration = GpuTestConfiguration::new().run_async(|ctx| async move {
let cmd_buf = generate_dummy_work(&ctx);
static WAIT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let cmd_buf = generate_dummy_work(&ctx);
ctx.queue.submit(Some(cmd_buf));
ctx.async_poll(PollType::wait()).await.unwrap();
});
ctx.queue.submit(Some(cmd_buf));
ctx.async_poll(PollType::wait()).await.unwrap();
});
#[gpu_test]
static DOUBLE_WAIT: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static DOUBLE_WAIT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let cmd_buf = generate_dummy_work(&ctx);
ctx.queue.submit(Some(cmd_buf));
@ -82,8 +87,9 @@ static DOUBLE_WAIT: GpuTestConfiguration =
});
#[gpu_test]
static WAIT_ON_SUBMISSION: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static WAIT_ON_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let cmd_buf = generate_dummy_work(&ctx);
let index = ctx.queue.submit(Some(cmd_buf));
@ -91,8 +97,9 @@ static WAIT_ON_SUBMISSION: GpuTestConfiguration =
});
#[gpu_test]
static DOUBLE_WAIT_ON_SUBMISSION: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static DOUBLE_WAIT_ON_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let cmd_buf = generate_dummy_work(&ctx);
let index = ctx.queue.submit(Some(cmd_buf));
@ -103,8 +110,9 @@ static DOUBLE_WAIT_ON_SUBMISSION: GpuTestConfiguration =
});
#[gpu_test]
static WAIT_OUT_OF_ORDER: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static WAIT_OUT_OF_ORDER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let cmd_buf1 = generate_dummy_work(&ctx);
let cmd_buf2 = generate_dummy_work(&ctx);
@ -120,7 +128,11 @@ static WAIT_OUT_OF_ORDER: GpuTestConfiguration =
/// console.
#[gpu_test]
static WAIT_AFTER_BAD_SUBMISSION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(wgpu_test::TestParameters::default().skip(wgpu_test::FailureCase::webgl2()))
.parameters(
wgpu_test::TestParameters::default()
.skip(wgpu_test::FailureCase::webgl2())
.enable_noop(),
)
.run_async(wait_after_bad_submission);
async fn wait_after_bad_submission(ctx: TestingContext) {

View File

@ -6,7 +6,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
#[gpu_test]
static DROP_FAILED_TIMESTAMP_QUERY_SET: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
// Enter an error scope, so the validation catch-all doesn't
// report the error too early.

View File

@ -1,7 +1,7 @@
//! Tests for buffer copy validation.
use wgpu::PollType;
use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.extend([
@ -13,6 +13,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
#[gpu_test]
static QUEUE_WRITE_TEXTURE_THEN_DESTROY: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
@ -61,8 +62,9 @@ static QUEUE_WRITE_TEXTURE_THEN_DESTROY: GpuTestConfiguration = GpuTestConfigura
});
#[gpu_test]
static QUEUE_WRITE_TEXTURE_OVERFLOW: GpuTestConfiguration =
GpuTestConfiguration::new().run_sync(|ctx| {
static QUEUE_WRITE_TEXTURE_OVERFLOW: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {

View File

@ -66,7 +66,8 @@ static UNBUILT_BLAS_COMPACTION: GpuTestConfiguration = GpuTestConfiguration::new
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(unbuilt_blas_compaction);
@ -128,7 +129,8 @@ static UNPREPARED_BLAS_COMPACTION: GpuTestConfiguration = GpuTestConfiguration::
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(unprepared_blas_compaction);
@ -295,7 +297,8 @@ static OUT_OF_ORDER_AS_BUILD_USE: GpuTestConfiguration = GpuTestConfiguration::n
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(out_of_order_as_build_use);
@ -477,7 +480,8 @@ static EMPTY_BUILD: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(empty_build);
fn empty_build(ctx: TestingContext) {
@ -498,7 +502,8 @@ static BUILD_WITH_TRANSFORM: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(build_with_transform);
@ -710,7 +715,8 @@ static ONLY_TLAS_VERTEX_RETURN: GpuTestConfiguration = GpuTestConfiguration::new
.features(
wgpu::Features::EXPERIMENTAL_RAY_QUERY
| wgpu::Features::EXPERIMENTAL_RAY_HIT_VERTEX_RETURN,
),
)
.enable_noop(),
)
.run_sync(only_tlas_vertex_return);
@ -749,7 +755,8 @@ static EXTRA_FORMAT_BUILD: GpuTestConfiguration = GpuTestConfiguration::new()
.features(
wgpu::Features::EXPERIMENTAL_RAY_QUERY
| wgpu::Features::EXTENDED_ACCELERATION_STRUCTURE_VERTEX_FORMATS,
),
)
.enable_noop(),
)
.run_sync(|ctx| test_as_build_format_stride(ctx, VertexFormat::Snorm16x4, 6, false));
@ -759,7 +766,8 @@ static MISALIGNED_BUILD: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
// Larger than the minimum size, but not aligned as required
.run_sync(|ctx| test_as_build_format_stride(ctx, VertexFormat::Float32x3, 13, true));
@ -770,7 +778,8 @@ static TOO_SMALL_STRIDE_BUILD: GpuTestConfiguration = GpuTestConfiguration::new(
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
// Aligned as required, but smaller than minimum size
.run_sync(|ctx| test_as_build_format_stride(ctx, VertexFormat::Float32x3, 8, true));

View File

@ -18,7 +18,8 @@ static BLAS_INVALID_VERTEX_FORMAT: GpuTestConfiguration = GpuTestConfiguration::
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(invalid_vertex_format_blas_create);
@ -59,7 +60,8 @@ static BLAS_MISMATCHED_INDEX: GpuTestConfiguration = GpuTestConfiguration::new()
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(mismatched_index_blas_create);

View File

@ -26,7 +26,8 @@ static LIMITS_HIT: GpuTestConfiguration = GpuTestConfiguration::new()
max_acceleration_structures_per_shader_stage: 1,
..Limits::default()
})
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(hit_limits);

View File

@ -110,7 +110,8 @@ static ACCELERATION_STRUCTURE_BUILD_NO_INDEX: GpuTestConfiguration = GpuTestConf
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(|ctx| {
acceleration_structure_build(&ctx, false);
@ -122,7 +123,8 @@ static ACCELERATION_STRUCTURE_BUILD_WITH_INDEX: GpuTestConfiguration = GpuTestCo
TestParameters::default()
.test_features_limits()
.limits(acceleration_structure_limits())
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY),
.features(wgpu::Features::EXPERIMENTAL_RAY_QUERY)
.enable_noop(),
)
.run_sync(|ctx| {
acceleration_structure_build(&ctx, true);

View File

@ -1,4 +1,4 @@
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
use wgpu::*;
@ -19,8 +19,9 @@ 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]
static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static PASS_RESET_VERTEX_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let module = ctx
.device
.create_shader_module(include_wgsl!("issue_3457.wgsl"));

View File

@ -1,7 +1,7 @@
use std::sync::Arc;
use parking_lot::Mutex;
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
use wgpu::*;
@ -18,6 +18,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// to add them to. This is incorrect, as we do not immediately invoke map_async callbacks.
#[gpu_test]
static QUEUE_SUBMITTED_CALLBACK_ORDERING: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
// Create a mappable buffer
let buffer = ctx.device.create_buffer(&BufferDescriptor {

View File

@ -91,7 +91,7 @@ async fn fill_test(ctx: &TestingContext, range: Range<u64>, size: u64) -> bool {
/// This test will fail on nvidia if the bug is not properly worked around.
#[gpu_test]
static CLEAR_BUFFER_RANGE_RESPECTED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
// This hits most of the cases in nvidia's clear buffer bug
let mut succeeded = true;

View File

@ -16,7 +16,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// This also tests that shaders generated with this fix execute correctly.
#[gpu_test]
static CONTINUE_SWITCH: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().force_fxc(true))
.parameters(TestParameters::default().force_fxc(true).enable_noop())
.run_async(|ctx| async move { test_impl(&ctx).await });
async fn test_impl(ctx: &TestingContext) {

View File

@ -16,7 +16,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// bug is avoided there.
#[gpu_test]
static DEGENERATE_SWITCH: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().force_fxc(true))
.parameters(TestParameters::default().force_fxc(true).enable_noop())
.run_async(|ctx| async move { test_impl(&ctx).await });
async fn test_impl(ctx: &TestingContext) {

View File

@ -1,4 +1,4 @@
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
use wgpu::*;
@ -14,8 +14,9 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// the fragment inputs. This is necessary for generating correct hlsl:
/// https://github.com/gfx-rs/wgpu/issues/5553
#[gpu_test]
static ALLOW_INPUT_NOT_CONSUMED: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static ALLOW_INPUT_NOT_CONSUMED: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let module = ctx
.device
.create_shader_module(include_wgsl!("issue_5553.wgsl"));

View File

@ -11,7 +11,8 @@ static NON_FATAL_ERRORS_IN_QUEUE_SUBMIT: GpuTestConfiguration = GpuTestConfigura
.parameters(
TestParameters::default()
.downlevel_flags(DownlevelFlags::COMPUTE_SHADERS)
.limits(Limits::downlevel_defaults()),
.limits(Limits::downlevel_defaults())
.enable_noop(),
)
.run_sync(|ctx| {
let shader_with_trivial_bind_group = concat!(

View File

@ -13,7 +13,11 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
/// The following test should successfully do nothing on all platforms.
#[gpu_test]
static ZERO_WORKGROUP_COUNT: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().limits(wgpu::Limits::default()))
.parameters(
TestParameters::default()
.limits(wgpu::Limits::default())
.enable_noop(),
)
.run_async(|ctx| async move {
let module = ctx
.device

View File

@ -268,7 +268,11 @@ async fn render_pass_query_set_ownership_timestamps(ctx: TestingContext) {
#[gpu_test]
static RENDER_PASS_KEEP_ENCODER_ALIVE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().test_features_limits())
.parameters(
TestParameters::default()
.test_features_limits()
.enable_noop(),
)
.run_async(render_pass_keep_encoder_alive);
async fn render_pass_keep_encoder_alive(ctx: TestingContext) {

View File

@ -1,21 +1,23 @@
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(BUFFER_SIZE_AND_USAGE);
}
#[gpu_test]
static BUFFER_SIZE_AND_USAGE: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 1234,
usage: wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
static BUFFER_SIZE_AND_USAGE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let buffer = ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 1234,
usage: wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::COPY_DST,
mapped_at_creation: false,
});
assert_eq!(buffer.size(), 1234);
assert_eq!(
buffer.usage(),
wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::COPY_DST
);
});
assert_eq!(buffer.size(), 1234);
assert_eq!(
buffer.usage(),
wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::COPY_DST
);
});

View File

@ -1,70 +1,74 @@
use wgpu_test::{fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.extend([BAD_BUFFER, BAD_TEXTURE]);
}
#[gpu_test]
static BAD_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
// Create a buffer with bad parameters and call a few methods.
// Validation should fail but there should be not panic.
let buffer = fail(
&ctx.device,
|| {
ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 99999999,
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::STORAGE,
mapped_at_creation: false,
})
},
Some("`map` usage can only be combined with the opposite `copy`"),
);
static BAD_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
// Create a buffer with bad parameters and call a few methods.
// Validation should fail but there should be not panic.
let buffer = fail(
&ctx.device,
|| {
ctx.device.create_buffer(&wgpu::BufferDescriptor {
label: None,
size: 99999999,
usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::STORAGE,
mapped_at_creation: false,
})
},
Some("`map` usage can only be combined with the opposite `copy`"),
);
fail(
&ctx.device,
|| buffer.slice(..).map_async(wgpu::MapMode::Write, |_| {}),
Some("Buffer with '' label is invalid"),
);
fail(
&ctx.device,
|| buffer.unmap(),
Some("Buffer with '' label is invalid"),
);
valid(&ctx.device, || buffer.destroy());
valid(&ctx.device, || buffer.destroy());
});
fail(
&ctx.device,
|| buffer.slice(..).map_async(wgpu::MapMode::Write, |_| {}),
Some("Buffer with '' label is invalid"),
);
fail(
&ctx.device,
|| buffer.unmap(),
Some("Buffer with '' label is invalid"),
);
valid(&ctx.device, || buffer.destroy());
valid(&ctx.device, || buffer.destroy());
});
#[gpu_test]
static BAD_TEXTURE: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
let texture = fail(
&ctx.device,
|| {
ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
width: 0,
height: 12345678,
depth_or_array_layers: 9001,
},
mip_level_count: 2000,
sample_count: 27,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::all(),
view_formats: &[],
})
},
Some("dimension x is zero"),
);
static BAD_TEXTURE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let texture = fail(
&ctx.device,
|| {
ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
width: 0,
height: 12345678,
depth_or_array_layers: 9001,
},
mip_level_count: 2000,
sample_count: 27,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
usage: wgpu::TextureUsages::all(),
view_formats: &[],
})
},
Some("dimension x is zero"),
);
fail(
&ctx.device,
|| {
let _ = texture.create_view(&wgpu::TextureViewDescriptor::default());
},
Some("Texture with '' label is invalid"),
);
valid(&ctx.device, || texture.destroy());
valid(&ctx.device, || texture.destroy());
});
fail(
&ctx.device,
|| {
let _ = texture.create_view(&wgpu::TextureViewDescriptor::default());
},
Some("Texture with '' label is invalid"),
);
valid(&ctx.device, || texture.destroy());
valid(&ctx.device, || texture.destroy());
});

View File

@ -21,8 +21,9 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
const PROBABLY_PROBLEMATIC_SAMPLER_COUNT: u32 = 8 * 1024;
#[gpu_test]
static SAMPLER_DEDUPLICATION: GpuTestConfiguration =
GpuTestConfiguration::new().run_sync(sampler_deduplication);
static SAMPLER_DEDUPLICATION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(sampler_deduplication);
// Create a large number of samplers from the same two descriptors.
//
@ -71,8 +72,9 @@ fn sampler_deduplication(ctx: TestingContext) {
}
#[gpu_test]
static SAMPLER_CREATION_FAILURE: GpuTestConfiguration =
GpuTestConfiguration::new().run_sync(sampler_creation_failure);
static SAMPLER_CREATION_FAILURE: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(sampler_creation_failure);
/// We want to test that sampler creation properly fails when we hit internal sampler
/// cache limits. As we don't actually know what the limit is, we first create as many

View File

@ -8,7 +8,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
#[gpu_test]
static SHADER_COMPILE_SUCCESS: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let sm = ctx
.device
@ -22,7 +22,7 @@ static SHADER_COMPILE_SUCCESS: GpuTestConfiguration = GpuTestConfiguration::new(
#[gpu_test]
static SHADER_COMPILE_ERROR: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default())
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
ctx.device.push_error_scope(wgpu::ErrorFilter::Validation);
let sm = ctx

View File

@ -18,7 +18,8 @@ static TEXTURE_BINDING: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
.test_features_limits()
.downlevel_flags(DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT),
.downlevel_flags(DownlevelFlags::WEBGPU_TEXTURE_FORMAT_SUPPORT)
.enable_noop(),
)
.run_sync(texture_binding);

View File

@ -1,4 +1,4 @@
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.extend([
@ -9,6 +9,7 @@ pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
#[gpu_test]
static TEXTURE_BLIT_WITH_LINEAR_FILTER_TEST: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let source = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
@ -60,6 +61,7 @@ static TEXTURE_BLIT_WITH_LINEAR_FILTER_TEST: GpuTestConfiguration = GpuTestConfi
#[gpu_test]
static TEXTURE_BLIT_WITH_NEAREST_FILTER_TEST: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let source = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,

View File

@ -1,95 +1,97 @@
//! Tests for texture copy bounds checks.
use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration};
use wgpu_test::{fail_if, gpu_test, GpuTestConfiguration, TestParameters};
pub fn all_tests(vec: &mut Vec<wgpu_test::GpuTestInitializer>) {
vec.push(BAD_COPY_ORIGIN_TEST);
}
#[gpu_test]
static BAD_COPY_ORIGIN_TEST: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
let try_origin = |origin, size, should_panic| {
let texture = ctx.device.create_texture(&TEXTURE_DESCRIPTOR);
let data = vec![255; BUFFER_SIZE as usize];
static BAD_COPY_ORIGIN_TEST: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let try_origin = |origin, size, should_panic| {
let texture = ctx.device.create_texture(&TEXTURE_DESCRIPTOR);
let data = vec![255; BUFFER_SIZE as usize];
fail_if(
&ctx.device,
should_panic,
|| {
ctx.queue.write_texture(
wgpu::TexelCopyTextureInfo {
texture: &texture,
mip_level: 0,
origin,
aspect: wgpu::TextureAspect::All,
},
&data,
BUFFER_COPY_LAYOUT,
size,
)
fail_if(
&ctx.device,
should_panic,
|| {
ctx.queue.write_texture(
wgpu::TexelCopyTextureInfo {
texture: &texture,
mip_level: 0,
origin,
aspect: wgpu::TextureAspect::All,
},
&data,
BUFFER_COPY_LAYOUT,
size,
)
},
None,
);
};
try_origin(wgpu::Origin3d { x: 0, y: 0, z: 0 }, TEXTURE_SIZE, false);
try_origin(wgpu::Origin3d { x: 1, y: 0, z: 0 }, TEXTURE_SIZE, true);
try_origin(wgpu::Origin3d { x: 0, y: 1, z: 0 }, TEXTURE_SIZE, true);
try_origin(wgpu::Origin3d { x: 0, y: 0, z: 1 }, TEXTURE_SIZE, true);
try_origin(
wgpu::Origin3d {
x: TEXTURE_SIZE.width - 1,
y: TEXTURE_SIZE.height - 1,
z: TEXTURE_SIZE.depth_or_array_layers - 1,
},
None,
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
false,
);
};
try_origin(wgpu::Origin3d { x: 0, y: 0, z: 0 }, TEXTURE_SIZE, false);
try_origin(wgpu::Origin3d { x: 1, y: 0, z: 0 }, TEXTURE_SIZE, true);
try_origin(wgpu::Origin3d { x: 0, y: 1, z: 0 }, TEXTURE_SIZE, true);
try_origin(wgpu::Origin3d { x: 0, y: 0, z: 1 }, TEXTURE_SIZE, true);
try_origin(
wgpu::Origin3d {
x: TEXTURE_SIZE.width - 1,
y: TEXTURE_SIZE.height - 1,
z: TEXTURE_SIZE.depth_or_array_layers - 1,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
false,
);
try_origin(
wgpu::Origin3d {
x: u32::MAX,
y: 0,
z: 0,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
true,
);
try_origin(
wgpu::Origin3d {
x: u32::MAX,
y: 0,
z: 0,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
true,
);
try_origin(
wgpu::Origin3d {
x: u32::MAX,
y: 0,
z: 0,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
true,
);
});
try_origin(
wgpu::Origin3d {
x: u32::MAX,
y: 0,
z: 0,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
true,
);
try_origin(
wgpu::Origin3d {
x: u32::MAX,
y: 0,
z: 0,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
true,
);
try_origin(
wgpu::Origin3d {
x: u32::MAX,
y: 0,
z: 0,
},
wgpu::Extent3d {
width: 1,
height: 1,
depth_or_array_layers: 1,
},
true,
);
});
const TEXTURE_SIZE: wgpu::Extent3d = wgpu::Extent3d {
width: 64,

View File

@ -14,7 +14,8 @@ static STENCIL_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::
.parameters(
TestParameters::default()
.skip(FailureCase::webgl2()) // WebGL doesn't have stencil only views
.limits(wgpu::Limits::downlevel_defaults()),
.limits(wgpu::Limits::downlevel_defaults())
.enable_noop(),
)
.run_async(|ctx| async move {
for format in [TextureFormat::Stencil8, TextureFormat::Depth24PlusStencil8] {
@ -42,8 +43,9 @@ static STENCIL_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::
});
#[gpu_test]
static DEPTH_ONLY_VIEW_CREATION: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static DEPTH_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
for format in [
TextureFormat::Depth16Unorm,
TextureFormat::Depth24Plus,
@ -74,7 +76,11 @@ static DEPTH_ONLY_VIEW_CREATION: GpuTestConfiguration =
#[gpu_test]
static SHARED_USAGE_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().downlevel_flags(DownlevelFlags::VIEW_FORMATS))
.parameters(
TestParameters::default()
.downlevel_flags(DownlevelFlags::VIEW_FORMATS)
.enable_noop(),
)
.run_async(|ctx| async move {
{
let (texture_format, view_format) =

View File

@ -1,73 +1,75 @@
use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{fail, gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(COPY_OVERFLOW_Z);
}
#[gpu_test]
static COPY_OVERFLOW_Z: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
static COPY_OVERFLOW_Z: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
let t1 = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
dimension: wgpu::TextureDimension::D2,
size: wgpu::Extent3d {
width: 256,
height: 256,
depth_or_array_layers: 1,
},
format: wgpu::TextureFormat::Rgba8Uint,
usage: wgpu::TextureUsages::COPY_DST,
mip_level_count: 1,
sample_count: 1,
view_formats: &[],
});
let t2 = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
dimension: wgpu::TextureDimension::D2,
size: wgpu::Extent3d {
width: 256,
height: 256,
depth_or_array_layers: 1,
},
format: wgpu::TextureFormat::Rgba8Uint,
usage: wgpu::TextureUsages::COPY_DST,
mip_level_count: 1,
sample_count: 1,
view_formats: &[],
});
let t1 = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
dimension: wgpu::TextureDimension::D2,
size: wgpu::Extent3d {
width: 256,
height: 256,
depth_or_array_layers: 1,
},
format: wgpu::TextureFormat::Rgba8Uint,
usage: wgpu::TextureUsages::COPY_DST,
mip_level_count: 1,
sample_count: 1,
view_formats: &[],
});
let t2 = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
dimension: wgpu::TextureDimension::D2,
size: wgpu::Extent3d {
width: 256,
height: 256,
depth_or_array_layers: 1,
},
format: wgpu::TextureFormat::Rgba8Uint,
usage: wgpu::TextureUsages::COPY_DST,
mip_level_count: 1,
sample_count: 1,
view_formats: &[],
});
fail(
&ctx.device,
|| {
// Validation should catch the silly selected z layer range without panicking.
encoder.copy_texture_to_texture(
wgpu::TexelCopyTextureInfo {
texture: &t1,
mip_level: 1,
origin: wgpu::Origin3d::ZERO,
aspect: wgpu::TextureAspect::All,
},
wgpu::TexelCopyTextureInfo {
texture: &t2,
mip_level: 1,
origin: wgpu::Origin3d {
x: 0,
y: 0,
z: 3824276442,
fail(
&ctx.device,
|| {
// Validation should catch the silly selected z layer range without panicking.
encoder.copy_texture_to_texture(
wgpu::TexelCopyTextureInfo {
texture: &t1,
mip_level: 1,
origin: wgpu::Origin3d::ZERO,
aspect: wgpu::TextureAspect::All,
},
aspect: wgpu::TextureAspect::All,
},
wgpu::Extent3d {
width: 100,
height: 3,
depth_or_array_layers: 613286111,
},
);
ctx.queue.submit(Some(encoder.finish()));
},
Some("unable to select texture mip level"),
);
});
wgpu::TexelCopyTextureInfo {
texture: &t2,
mip_level: 1,
origin: wgpu::Origin3d {
x: 0,
y: 0,
z: 3824276442,
},
aspect: wgpu::TextureAspect::All,
},
wgpu::Extent3d {
width: 100,
height: 3,
depth_or_array_layers: 613286111,
},
);
ctx.queue.submit(Some(encoder.finish()));
},
Some("unable to select texture mip level"),
);
});

View File

@ -1,39 +1,41 @@
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(TRANSITION_RESOURCES);
}
#[gpu_test]
static TRANSITION_RESOURCES: GpuTestConfiguration = GpuTestConfiguration::new().run_sync(|ctx| {
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
width: 32,
height: 32,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Unorm,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
view_formats: &[],
static TRANSITION_RESOURCES: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_sync(|ctx| {
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
width: 32,
height: 32,
depth_or_array_layers: 1,
},
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba8Unorm,
usage: wgpu::TextureUsages::RENDER_ATTACHMENT | wgpu::TextureUsages::TEXTURE_BINDING,
view_formats: &[],
});
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
encoder.transition_resources(
std::iter::empty(),
[wgpu::TextureTransition {
texture: &texture,
selector: None,
state: wgpu::TextureUses::COLOR_TARGET,
}]
.into_iter(),
);
ctx.queue.submit([encoder.finish()]);
});
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None });
encoder.transition_resources(
std::iter::empty(),
[wgpu::TextureTransition {
texture: &texture,
selector: None,
state: wgpu::TextureUses::COLOR_TARGET,
}]
.into_iter(),
);
ctx.queue.submit([encoder.finish()]);
});

View File

@ -1,7 +1,7 @@
//! Tests for texture copy
use wgpu::*;
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer};
use wgpu_test::{gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.extend([
@ -199,8 +199,9 @@ static WRITE_TEXTURE_SUBSET_3D: GpuTestConfiguration =
});
#[gpu_test]
static WRITE_TEXTURE_NO_OOB: GpuTestConfiguration =
GpuTestConfiguration::new().run_async(|ctx| async move {
static WRITE_TEXTURE_NO_OOB: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(TestParameters::default().enable_noop())
.run_async(|ctx| async move {
let size = 256;
let tex = ctx.device.create_texture(&wgpu::TextureDescriptor {