Skip to content

Commit c8f6a83

Browse files
inner-daemonsclaude
andcommitted
wgpu-c-backend integration test rig (v30)
Over wgpu v30.0.0, wires wgpu's own examples/tests to run through wgpu-native's C backend so its adapter reporting can be compared to wgpu-core: - wgpu Instance::new: when built with `--cfg wgpu_custom_backend`, defer to wgpu-native's `__wgpu_custom_backend_new_instance` symbol, unless WGPU_NO_CUSTOM_BACKEND=1 selects normal wgpu. wgpu calls out to the backend explicitly; the backend does not register itself. - wgpu-info: restore `custom_backend_matches_wgpu_core`, which asserts the C backend reports identical adapter info/features/limits/downlevel/texture formats as wgpu-core (catches unimplemented features / unexposed limits). `generate(skip_custom)` toggles via the env var. - workspace glue: add wgpu-c-backend as a member, redirect the gfx-rs git dep to local paths, and inject the dep + `extern crate` into crates that use wgpu (so the backend symbol is linked). Applied by run-wgpu-tests.py. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8bf3e5f commit c8f6a83

26 files changed

Lines changed: 194 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
22
resolver = "2"
3-
members = [
3+
members = ["wgpu-c-backend",
44
"cts_runner",
55
"deno_webgpu",
66

@@ -30,7 +30,7 @@ members = [
3030
"xtask",
3131
]
3232
exclude = []
33-
default-members = [
33+
default-members = ["wgpu-c-backend",
3434
"benches",
3535
"examples/features",
3636
"examples/standalone/*",
@@ -341,3 +341,10 @@ debug = true
341341
# Speed up image comparison even in debug builds
342342
[profile.dev.package."nv-flip-sys"]
343343
opt-level = 3
344+
345+
# PATCH
346+
[patch."https://github.com/gfx-rs/wgpu.git"]
347+
wgpu-core = { path = "./wgpu-core" }
348+
wgpu-hal = { path = "./wgpu-hal" }
349+
wgpu-types = { path = "./wgpu-types" }
350+
naga = { path = "./naga" }

benches/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ serde_json.workspace = true
5050
termcolor.workspace = true
5151
tracy-client = { workspace = true, optional = true }
5252
wgpu.workspace = true
53+
54+
[dependencies]
55+
wgpu-c-backend = { path = "../wgpu-c-backend" }

benches/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
//!
2424
//! By default all tests run for 2 seconds, but this can be overridden
2525
//! by individual tests.
26+
extern crate wgpu_c_backend;
2627

2728
use std::{collections::HashMap, io::IsTerminal, time::Duration};
2829

examples/bug-repro/01_texture_atomic_bug/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ rust-version = "1.87"
55
publish = false
66

77
[dependencies]
8+
wgpu-c-backend = { path = "../../../wgpu-c-backend" }
89
env_logger = "0.11"
910
pollster = "0.4"
1011
wgpu = { path = "../../../wgpu" }

examples/bug-repro/01_texture_atomic_bug/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//! The bug does not reproduce with `MTL_SHADER_VALIDATION=1`.
55
//! Known to reproduce on Apple M4 Max, macOS 26.3 (Tahoe).
66
//! Dropped writes appear as various tile-shaped black holes that flicker around each frame.
7+
extern crate wgpu_c_backend;
78

89
use std::sync::Arc;
910

examples/bug-repro/02_present_bugs/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ rust-version = "1.87"
55
publish = false
66

77
[dependencies]
8+
wgpu-c-backend = { path = "../../../wgpu-c-backend" }
89
env_logger = "0.11"
910
pollster = "0.4"
1011
wgpu.workspace = true

examples/bug-repro/02_present_bugs/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! The 2 current bugs being tested are presentation after no usage of surface texture
44
//! and queue destruction immediately after present
5+
extern crate wgpu_c_backend;
56

67
use std::sync::Arc;
78

examples/features/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ webgpu = ["wgpu/webgpu"]
2828
exhaust = ["wgpu/exhaust"]
2929

3030
[dependencies]
31+
wgpu-c-backend = { path = "../../wgpu-c-backend" }
3132
bytemuck.workspace = true
3233
cfg-if.workspace = true
3334
encase = { workspace = true }

examples/features/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(clippy::arc_with_non_send_sync, reason = "False positive on wasm")]
22
#![warn(clippy::allow_attributes)]
3+
extern crate wgpu_c_backend;
34

45
pub mod framework;
56
pub mod utils;

examples/features/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
extern crate wgpu_c_backend;
12
struct ExampleDesc {
23
name: &'static str,
34
function: fn(),

0 commit comments

Comments
 (0)