Small fixes to gpu profiling

This commit is contained in:
Imbris 2021-02-28 01:11:22 -05:00 committed by Avi Weinstock
parent 9d076d3a89
commit 0d7e96e849
2 changed files with 5 additions and 5 deletions

View File

@ -160,7 +160,7 @@ impl Renderer {
// TODO: make optional based on enabling profiling
// NOTE: requires recreating the device/queue is this setting changes
// alternatively it could be a compile time feature toggle
| super::scope::required_features(),
| wgpu_profiler::GpuProfiler::REQUIRED_WGPU_FEATURES,
limits,
},
None,
@ -330,7 +330,7 @@ impl Renderer {
&depth_sampler,
);
let mut profiler = wgpu_profiler::GpuProfiler::new(4, queue.get_timestamp_period());
let mut profiler = wgpu_profiler::GpuProfiler::new(1, queue.get_timestamp_period());
profiler.enable_timer = mode.profiler_enabled;
profiler.enable_debug_marker = mode.profiler_enabled;
@ -1042,8 +1042,10 @@ impl Renderer {
//pub fn create_screenshot(&mut self) -> Result<image::DynamicImage,
// RenderError> {
pub fn create_screenshot(&mut self) {
// TODO: check if enabled
// TODO: check if profiler enabled
// TODO: save alongside a screenshot
// Ensure timestamp query data buffers are mapped
self.device.poll(wgpu::Maintain::Wait);
// Take profiler snapshot
let profiling_data = if let Some(data) = self.profiler.process_finished_frame() {
data

View File

@ -1,7 +1,5 @@
use wgpu_profiler::{GpuProfiler, ProfilerCommandRecorder};
pub fn required_features() -> wgpu::Features { wgpu::Features::TIMESTAMP_QUERY }
pub struct Scope<'a, W: ProfilerCommandRecorder> {
profiler: &'a mut GpuProfiler,
wgpu_thing: &'a mut W,