From df0c0f85333cfa8c8b16596a3a3ed52373036b0f Mon Sep 17 00:00:00 2001 From: Robert Swain Date: Mon, 4 Jul 2022 09:14:04 +0000 Subject: [PATCH] Enable wgpu profiling spans when using bevy's trace feature (#5182) # Objective - Enable `wgpu` profiling spans ## Solution - `wgpu` uses the `profiling` crate to add profiling span instrumentation to their code - `profiling` offers multiple 'backends' for profiling, including `tracing` - When the `bevy` `trace` feature is used, add the `profiling` crate with its `profile-with-tracing` feature to enable appropriate profiling spans in `wgpu` using `tracing` which fits nicely into our infrastructure - Bump our default `tracing` subscriber filter to `wgpu=info` from `wgpu=error` so that the profiling spans are not filtered out as they are created at the `info` level. --- ## Changelog - Added: `tracing` profiling support for `wgpu` when using bevy's `trace` feature - Changed: The default `tracing` filter statement for `wgpu` has been changed from the `error` level to the `info` level to not filter out the wgpu profiling spans --- crates/bevy_render/Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 9d0f6e11973a30..a1643eafd58950 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -20,7 +20,7 @@ dds = ["ddsfile"] zlib = ["flate2"] zstd = ["ruzstd"] -trace = [] +trace = ["profiling"] tracing-tracy = [] wgpu_trace = ["wgpu/trace"] ci_limits = [] @@ -71,3 +71,5 @@ ruzstd = { version = "0.2.4", optional = true } # For transcoding of UASTC/ETC1S universal formats, and for .basis file support basis-universal = { version = "0.2.0", optional = true } encase = { version = "0.3", features = ["glam"] } +# For wgpu profiling using tracing. Use `RUST_LOG=info` to also capture the wgpu spans. +profiling = { version = "1", features = ["profile-with-tracing"], optional = true }