Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the wgpu_trace feature with a field in bevy_render::settings::WgpuSettings #14842

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ trace_tracy_memory = [
# Tracing support
trace = ["bevy_internal/trace"]

# Save a trace of all wgpu calls
wgpu_trace = ["bevy_internal/wgpu_trace"]

# EXR image format support
exr = ["bevy_internal/exr"]

Expand Down
1 change: 0 additions & 1 deletion crates/bevy_internal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ trace = [
trace_chrome = ["bevy_log/tracing-chrome"]
trace_tracy = ["bevy_render?/tracing-tracy", "bevy_log/tracing-tracy"]
trace_tracy_memory = ["bevy_log/trace_tracy_memory"]
wgpu_trace = ["bevy_render/wgpu_trace"]
detailed_trace = ["bevy_utils/detailed_trace"]

sysinfo_plugin = ["bevy_diagnostic/sysinfo_plugin"]
Expand Down
1 change: 0 additions & 1 deletion crates/bevy_render/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ zstd = ["ruzstd"]

trace = ["profiling"]
tracing-tracy = []
wgpu_trace = []
ci_limits = []
webgl = ["wgpu/webgl"]
webgpu = ["wgpu/webgpu"]
Expand Down
12 changes: 1 addition & 11 deletions crates/bevy_render/src/renderer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,6 @@ pub async fn initialize_renderer(
);
}

#[cfg(feature = "wgpu_trace")]
let trace_path = {
let path = std::path::Path::new("wgpu_trace");
// ignore potential error, wgpu will log it
let _ = std::fs::create_dir(path);
Some(path)
};
#[cfg(not(feature = "wgpu_trace"))]
let trace_path = None;

// Maybe get features and limits based on what is supported by the adapter/backend
let mut features = wgpu::Features::empty();
let mut limits = options.limits.clone();
Expand Down Expand Up @@ -357,7 +347,7 @@ pub async fn initialize_renderer(
required_limits: limits,
memory_hints: options.memory_hints.clone(),
},
trace_path,
options.trace_path.as_deref(),
)
.await
.unwrap();
Expand Down
5 changes: 4 additions & 1 deletion crates/bevy_render/src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::renderer::{
RenderAdapter, RenderAdapterInfo, RenderDevice, RenderInstance, RenderQueue,
};
use std::borrow::Cow;
use std::{borrow::Cow, path::PathBuf};

pub use wgpu::{
Backends, Dx12Compiler, Features as WgpuFeatures, Gles3MinorVersion, InstanceFlags,
Expand Down Expand Up @@ -52,6 +52,8 @@ pub struct WgpuSettings {
pub instance_flags: InstanceFlags,
/// This hints to the WGPU device about the preferred memory allocation strategy.
pub memory_hints: MemoryHints,
/// The path to pass to wgpu for API call tracing. This only has an effect if wgpu's tracing functionality is enabled.
pub trace_path: Option<PathBuf>,
}

impl Default for WgpuSettings {
Expand Down Expand Up @@ -116,6 +118,7 @@ impl Default for WgpuSettings {
gles3_minor_version,
instance_flags,
memory_hints: MemoryHints::default(),
trace_path: None,
}
}
}
Expand Down
1 change: 0 additions & 1 deletion docs/cargo_features.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,4 @@ The default feature set enables most of the expected features of a game engine,
|wayland|Wayland display server support|
|webgpu|Enable support for WebGPU in Wasm. When enabled, this feature will override the `webgl2` feature and you won't be able to run Wasm builds with WebGL2, only with WebGPU.|
|webp|WebP image format support|
|wgpu_trace|Save a trace of all wgpu calls|
|zlib|For KTX2 supercompression|
11 changes: 8 additions & 3 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ When a suspected wgpu error occurs, you should capture a wgpu trace so that Bevy

To capture a wgpu trace:

1. Create a new `wgpu_trace` folder in the root of your cargo workspace
2. Add the "wgpu_trace" feature to the bevy crate. (ex: `cargo run --example features wgpu_trace`)
3. Zip up the wgpu_trace folder and attach it to the relevant issue. New wgpu issues should generally be created [in the wgpu repository](https://github.com/gfx-rs/wgpu). Please include the wgpu revision in your bug reports. You can find the revision in the `Cargo.lock` file in your workspace.
1. Create a new folder in which to store your wgpu trace
2. Pass the folder path to `bevy_render::RenderPlugin`, using the `render_creation` field.
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
* If you're manually creating the renderer resources, pass the path to wgpu when creating the `RenderDevice` and `RenderQueue`.
* Otherwise, pass the path to Bevy via the `trace_path` field in `bevy_render::settings::WgpuSettings`.
3. Enable wgpu's trace feature and run your application
1. Add `wgpu = "*"` to your Cargo.toml
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
2. Execute `cargo run --features wgpu/trace`
LikeLakers2 marked this conversation as resolved.
Show resolved Hide resolved
4. Zip up the folder and attach it to the relevant issue. New wgpu issues should generally be created [in the wgpu repository](https://github.com/gfx-rs/wgpu). Please include the wgpu revision in your bug reports. You can find the revision in the `Cargo.lock` file in your workspace.
Loading