Skip to content

Commit 4b28caf

Browse files
committed
Add back WGPU_TRACE support via the new wgpu-trace feature
1 parent f62f1d1 commit 4b28caf

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

Cargo.lock

+31-6
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ name = "arrayvec"
273273
version = "0.7.6"
274274
source = "registry+https://github.com/rust-lang/crates.io-index"
275275
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
276+
dependencies = [
277+
"serde",
278+
]
276279

277280
[[package]]
278281
name = "as-raw-xcb-connection"
@@ -1251,7 +1254,7 @@ dependencies = [
12511254
"pollster",
12521255
"profiling",
12531256
"raw-window-handle 0.6.2",
1254-
"ron",
1257+
"ron 0.10.1",
12551258
"serde",
12561259
"static_assertions",
12571260
"wasm-bindgen",
@@ -1278,7 +1281,7 @@ dependencies = [
12781281
"log",
12791282
"nohash-hasher",
12801283
"profiling",
1281-
"ron",
1284+
"ron 0.10.1",
12821285
"serde",
12831286
"unicode-segmentation",
12841287
]
@@ -1298,6 +1301,7 @@ dependencies = [
12981301
"type-map",
12991302
"web-time",
13001303
"wgpu",
1304+
"wgpu-core",
13011305
"winit",
13021306
]
13031307

@@ -2029,6 +2033,7 @@ dependencies = [
20292033
"cfg-if",
20302034
"crunchy",
20312035
"num-traits",
2036+
"serde",
20322037
]
20332038

20342039
[[package]]
@@ -2038,6 +2043,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
20382043
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
20392044
dependencies = [
20402045
"foldhash",
2046+
"serde",
20412047
]
20422048

20432049
[[package]]
@@ -2340,6 +2346,7 @@ checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058"
23402346
dependencies = [
23412347
"equivalent",
23422348
"hashbrown",
2349+
"serde",
23432350
]
23442351

23452352
[[package]]
@@ -2663,6 +2670,7 @@ dependencies = [
26632670
"num-traits",
26642671
"once_cell",
26652672
"rustc-hash",
2673+
"serde",
26662674
"spirv",
26672675
"strum",
26682676
"thiserror 2.0.11",
@@ -3577,6 +3585,19 @@ dependencies = [
35773585
"windows-sys 0.52.0",
35783586
]
35793587

3588+
[[package]]
3589+
name = "ron"
3590+
version = "0.9.0"
3591+
source = "registry+https://github.com/rust-lang/crates.io-index"
3592+
checksum = "63f3aa105dea217ef30d89581b65a4d527a19afc95ef5750be3890e8d3c5b837"
3593+
dependencies = [
3594+
"base64",
3595+
"bitflags 2.9.0",
3596+
"serde",
3597+
"serde_derive",
3598+
"unicode-ident",
3599+
]
3600+
35803601
[[package]]
35813602
name = "ron"
35823603
version = "0.10.1"
@@ -3728,18 +3749,18 @@ dependencies = [
37283749

37293750
[[package]]
37303751
name = "serde"
3731-
version = "1.0.214"
3752+
version = "1.0.219"
37323753
source = "registry+https://github.com/rust-lang/crates.io-index"
3733-
checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5"
3754+
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
37343755
dependencies = [
37353756
"serde_derive",
37363757
]
37373758

37383759
[[package]]
37393760
name = "serde_derive"
3740-
version = "1.0.214"
3761+
version = "1.0.219"
37413762
source = "registry+https://github.com/rust-lang/crates.io-index"
3742-
checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766"
3763+
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
37433764
dependencies = [
37443765
"proc-macro2",
37453766
"quote",
@@ -4772,6 +4793,7 @@ dependencies = [
47724793
"bit-set 0.8.0",
47734794
"bit-vec 0.8.0",
47744795
"bitflags 2.9.0",
4796+
"bytemuck",
47754797
"cfg_aliases",
47764798
"document-features",
47774799
"hashbrown",
@@ -4783,7 +4805,9 @@ dependencies = [
47834805
"portable-atomic",
47844806
"profiling",
47854807
"raw-window-handle 0.6.2",
4808+
"ron 0.9.0",
47864809
"rustc-hash",
4810+
"serde",
47874811
"smallvec",
47884812
"thiserror 2.0.11",
47894813
"wgpu-core-deps-apple",
@@ -4887,6 +4911,7 @@ dependencies = [
48874911
"bytemuck",
48884912
"js-sys",
48894913
"log",
4914+
"serde",
48904915
"thiserror 2.0.11",
48914916
"web-sys",
48924917
]

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ wasm-bindgen-futures = "0.4"
105105
web-sys = "0.3.73"
106106
web-time = "1.1.0" # Timekeeping for native and web
107107
wgpu = { version = "25.0.0", default-features = false }
108+
wgpu-core = { version = "25.0.1", default-features = false }
108109
windows-sys = "0.59"
109110
winit = { version = "0.30.7", default-features = false }
110111

crates/egui-wgpu/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ wayland = ["winit?/wayland"]
4242
## Enables x11 support for winit.
4343
x11 = ["winit?/x11"]
4444

45+
## Enables tracing support for wgpu. Requires setting the `WGPU_TRACE` environment variable to a directory to work.
46+
wgpu-trace = ["wgpu-core/trace"]
47+
4548
## Make the renderer `Sync` on wasm, exploiting that by default wasm isn't multithreaded.
4649
## It may make code easier, expecially when targeting both native and web.
4750
## On native most wgpu objects are send and sync, on the web they are not (by nature of the WebGPU specification).
@@ -62,6 +65,7 @@ thiserror.workspace = true
6265
type-map.workspace = true
6366
web-time.workspace = true
6467
wgpu = { workspace = true, features = ["wgsl"] }
68+
wgpu-core.workspace = true
6569

6670
# Optional dependencies:
6771

crates/egui-wgpu/src/setup.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ impl Default for WgpuSetupCreateNew {
176176
wgpu::Limits::default()
177177
};
178178

179+
let mut _trace = wgpu::Trace::Off;
180+
#[cfg(feature = "wgpu-trace")]
181+
if let Some(path) = std::env::var("WGPU_TRACE")
182+
.ok()
183+
.map(std::path::PathBuf::from)
184+
{
185+
_trace = wgpu::Trace::Directory(path);
186+
}
187+
179188
wgpu::DeviceDescriptor {
180189
label: Some("egui wgpu device"),
181190
required_features: wgpu::Features::default(),
@@ -186,7 +195,7 @@ impl Default for WgpuSetupCreateNew {
186195
..base_limits
187196
},
188197
memory_hints: wgpu::MemoryHints::default(),
189-
trace: wgpu::Trace::Off,
198+
trace: _trace,
190199
}
191200
}),
192201
}

0 commit comments

Comments
 (0)