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
This commit is contained in:
Robert Swain 2022-07-04 09:14:04 +00:00
parent 72e7358636
commit af48c10b3e

View file

@ -20,7 +20,7 @@ dds = ["ddsfile"]
zlib = ["flate2"] zlib = ["flate2"]
zstd = ["ruzstd"] zstd = ["ruzstd"]
trace = [] trace = ["profiling"]
tracing-tracy = [] tracing-tracy = []
wgpu_trace = ["wgpu/trace"] wgpu_trace = ["wgpu/trace"]
ci_limits = [] 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 # For transcoding of UASTC/ETC1S universal formats, and for .basis file support
basis-universal = { version = "0.2.0", optional = true } basis-universal = { version = "0.2.0", optional = true }
encase = { version = "0.3", features = ["glam"] } 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 }