Skip to content

Commit

Permalink
Enable wgpu profiling spans when using bevy's trace feature (bevyengi…
Browse files Browse the repository at this point in the history
…ne#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
  • Loading branch information
superdump authored and james7132 committed Oct 28, 2022
1 parent 8ea7b5e commit df0c0f8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dds = ["ddsfile"]
zlib = ["flate2"]
zstd = ["ruzstd"]

trace = []
trace = ["profiling"]
tracing-tracy = []
wgpu_trace = ["wgpu/trace"]
ci_limits = []
Expand Down Expand Up @@ -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 }

0 comments on commit df0c0f8

Please sign in to comment.