Skip to content

Commit 6b6bc69

Browse files
authored
Check for webgl2 validation errors and catch issues (#3296)
1 parent 5241633 commit 6b6bc69

File tree

22 files changed

+173
-59
lines changed

22 files changed

+173
-59
lines changed

wgpu/examples/boids/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,10 @@ fn main() {
329329
framework::run::<Example>("boids");
330330
}
331331

332+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
333+
332334
#[test]
335+
#[wasm_bindgen_test::wasm_bindgen_test]
333336
fn boids() {
334337
framework::test::<Example>(framework::FrameworkRefTest {
335338
image_path: "/examples/boids/screenshot.png",

wgpu/examples/bunnymark/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,10 @@ fn main() {
357357
framework::run::<Example>("bunnymark");
358358
}
359359

360+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
361+
360362
#[test]
363+
#[wasm_bindgen_test::wasm_bindgen_test]
361364
fn bunnymark() {
362365
framework::test::<Example>(framework::FrameworkRefTest {
363366
image_path: "/examples/bunnymark/screenshot.png",

wgpu/examples/capture/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ mod tests {
225225
use super::*;
226226
use wgpu::BufferView;
227227

228+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
229+
228230
#[test]
231+
#[wasm_bindgen_test::wasm_bindgen_test]
229232
fn ensure_generated_data_matches_expected() {
230233
assert_generated_data_matches_expected();
231234
}

wgpu/examples/conservative-raster/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,10 @@ fn main() {
314314
framework::run::<Example>("conservative-raster");
315315
}
316316

317+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
318+
317319
#[test]
320+
#[wasm_bindgen_test::wasm_bindgen_test]
318321
fn conservative_raster() {
319322
framework::test::<Example>(framework::FrameworkRefTest {
320323
image_path: "/examples/conservative-raster/screenshot.png",

wgpu/examples/cube/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,10 @@ fn main() {
406406
framework::run::<Example>("cube");
407407
}
408408

409+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
410+
409411
#[test]
412+
#[wasm_bindgen_test::wasm_bindgen_test]
410413
fn cube() {
411414
framework::test::<Example>(framework::FrameworkRefTest {
412415
image_path: "/examples/cube/screenshot.png",
@@ -420,6 +423,7 @@ fn cube() {
420423
}
421424

422425
#[test]
426+
#[wasm_bindgen_test::wasm_bindgen_test]
423427
fn cube_lines() {
424428
framework::test::<Example>(framework::FrameworkRefTest {
425429
image_path: "/examples/cube/screenshot-lines.png",

wgpu/examples/hello-compute/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ use std::sync::Arc;
66
use super::*;
77
use common::{initialize_test, TestParameters};
88

9+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
10+
911
#[test]
12+
#[wasm_bindgen_test::wasm_bindgen_test]
1013
fn test_compute_1() {
1114
initialize_test(
1215
TestParameters::default()
@@ -27,6 +30,7 @@ fn test_compute_1() {
2730
}
2831

2932
#[test]
33+
#[wasm_bindgen_test::wasm_bindgen_test]
3034
fn test_compute_2() {
3135
initialize_test(
3236
TestParameters::default()
@@ -47,6 +51,7 @@ fn test_compute_2() {
4751
}
4852

4953
#[test]
54+
#[wasm_bindgen_test::wasm_bindgen_test]
5055
fn test_compute_overflow() {
5156
initialize_test(
5257
TestParameters::default()
@@ -66,6 +71,7 @@ fn test_compute_overflow() {
6671
}
6772

6873
#[test]
74+
// Wasm doesn't support threads
6975
fn test_multithreaded_compute() {
7076
initialize_test(
7177
TestParameters::default()

wgpu/examples/mipmap/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,10 @@ fn main() {
487487
framework::run::<Example>("mipmap");
488488
}
489489

490+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
491+
490492
#[test]
493+
#[wasm_bindgen_test::wasm_bindgen_test]
491494
fn mipmap() {
492495
framework::test::<Example>(framework::FrameworkRefTest {
493496
image_path: "/examples/mipmap/screenshot.png",

wgpu/examples/msaa-line/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ fn main() {
310310
framework::run::<Example>("msaa-line");
311311
}
312312

313+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
314+
313315
#[test]
316+
#[wasm_bindgen_test::wasm_bindgen_test]
314317
fn msaa_line() {
315318
framework::test::<Example>(framework::FrameworkRefTest {
316319
image_path: "/examples/msaa-line/screenshot.png",

wgpu/examples/shadow/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,10 @@ fn main() {
841841
framework::run::<Example>("shadow");
842842
}
843843

844+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
845+
844846
#[test]
847+
#[wasm_bindgen_test::wasm_bindgen_test]
845848
fn shadow() {
846849
framework::test::<Example>(framework::FrameworkRefTest {
847850
image_path: "/examples/shadow/screenshot.png",
@@ -850,6 +853,7 @@ fn shadow() {
850853
optional_features: wgpu::Features::default(),
851854
base_test_parameters: framework::test_common::TestParameters::default()
852855
.downlevel_flags(wgpu::DownlevelFlags::COMPARISON_SAMPLERS)
856+
.specific_failure(Some(wgpu::Backends::GL), None, Some("ANGLE"), false)
853857
// rpi4 on VK doesn't work: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3916
854858
.specific_failure(Some(wgpu::Backends::VULKAN), None, Some("V3D"), false)
855859
// llvmpipe versions in CI are flaky: https://github.com/gfx-rs/wgpu/issues/2594

wgpu/examples/skybox/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,20 +465,29 @@ fn main() {
465465
framework::run::<Skybox>("skybox");
466466
}
467467

468+
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
469+
468470
#[test]
471+
#[wasm_bindgen_test::wasm_bindgen_test]
469472
fn skybox() {
470473
framework::test::<Skybox>(framework::FrameworkRefTest {
471474
image_path: "/examples/skybox/screenshot.png",
472475
width: 1024,
473476
height: 768,
474477
optional_features: wgpu::Features::default(),
475-
base_test_parameters: framework::test_common::TestParameters::default(),
478+
base_test_parameters: framework::test_common::TestParameters::default().specific_failure(
479+
Some(wgpu::Backends::GL),
480+
None,
481+
Some("ANGLE"),
482+
false,
483+
),
476484
tolerance: 3,
477485
max_outliers: 207, // bounded by swiftshader
478486
});
479487
}
480488

481489
#[test]
490+
#[wasm_bindgen_test::wasm_bindgen_test]
482491
fn skybox_bc1() {
483492
framework::test::<Skybox>(framework::FrameworkRefTest {
484493
image_path: "/examples/skybox/screenshot-bc1.png",
@@ -492,6 +501,7 @@ fn skybox_bc1() {
492501
}
493502

494503
#[test]
504+
#[wasm_bindgen_test::wasm_bindgen_test]
495505
fn skybox_etc2() {
496506
framework::test::<Skybox>(framework::FrameworkRefTest {
497507
image_path: "/examples/skybox/screenshot-etc2.png",
@@ -505,6 +515,7 @@ fn skybox_etc2() {
505515
}
506516

507517
#[test]
518+
#[wasm_bindgen_test::wasm_bindgen_test]
508519
fn skybox_astc() {
509520
framework::test::<Skybox>(framework::FrameworkRefTest {
510521
image_path: "/examples/skybox/screenshot-astc.png",

0 commit comments

Comments
 (0)