From 22263e798e6167ca0fc56ae0f744c3d25a3171c2 Mon Sep 17 00:00:00 2001 From: "Erik W. Gren" Date: Sun, 8 Dec 2024 10:45:04 +0100 Subject: [PATCH] Support wgpu-tracing with same mechanism as wgpu examples Gets the WGPU_TRACE env variable and gives it as an optional argument to request_device. Same mechanism as the wgpu-examples: https://github.com/gfx-rs/wgpu/blob/11b51693d3dc883b55b5ec0e30c340e43e6fac50/examples/src/framework.rs#L316 --- crates/egui-wgpu/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/egui-wgpu/src/lib.rs b/crates/egui-wgpu/src/lib.rs index e2c22a5cffc..8628bd06652 100644 --- a/crates/egui-wgpu/src/lib.rs +++ b/crates/egui-wgpu/src/lib.rs @@ -159,10 +159,11 @@ impl RenderState { ); } + let trace_path = std::env::var("WGPU_TRACE"); let (device, queue) = { crate::profile_scope!("request_device"); adapter - .request_device(&(*device_descriptor)(&adapter), None) + .request_device(&(*device_descriptor)(&adapter), trace_path.ok().as_ref().map(std::path::Path::new)) .await? };