add optional wgpu tracing feature

This commit is contained in:
Carter Anderson 2020-08-16 01:11:17 -07:00
parent f85867139b
commit 5fdf36dbb1
3 changed files with 8 additions and 1 deletions

View file

@ -15,6 +15,7 @@ exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"]
[features]
default = ["bevy_audio", "bevy_gltf", "bevy_wgpu", "bevy_winit", "png", "hdr", "mp3"]
profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"]
wgpu_trace = ["bevy_wgpu/trace"]
# Image format support for texture loading (PNG and HDR are enabled by default)
png = ["bevy_render/png"]

View file

@ -11,6 +11,7 @@ keywords = ["bevy"]
[features]
default = ["bevy_winit"]
trace = ["wgpu/trace"]
[dependencies]
# bevy

View file

@ -27,6 +27,11 @@ impl WgpuRenderer {
.await
.expect("Unable to find a GPU! Make sure you have installed required drivers!");
#[cfg(feature = "trace")]
let trace_path = Some(std::path::Path::new("wgpu_trace"));
#[cfg(not(feature = "trace"))]
let trace_path = None;
let (device, queue) = adapter
.request_device(
&wgpu::DeviceDescriptor {
@ -34,7 +39,7 @@ impl WgpuRenderer {
limits: wgpu::Limits::default(),
shader_validation: true,
},
None,
trace_path,
)
.await
.unwrap();