Support wgpu-tracing with same mechanism as wgpu examples (#5450)

Gets the WGPU_TRACE env variable and gives it as an optional argument
to request_device. Same mechanism as the wgpu-examples:


11b51693d3/examples/src/framework.rs (L316)
This commit is contained in:
EriKWDev 2024-12-09 11:58:33 +01:00 committed by GitHub
parent 046034f902
commit 39d6b3367b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -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?
};