From 0d7e96e84960038647e420f15875ee911d36cf08 Mon Sep 17 00:00:00 2001 From: Imbris Date: Sun, 28 Feb 2021 01:11:22 -0500 Subject: [PATCH] Small fixes to gpu profiling --- voxygen/src/render/renderer.rs | 8 +++++--- voxygen/src/render/scope.rs | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index 3530dabbcf..175d536ebc 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -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 { 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 diff --git a/voxygen/src/render/scope.rs b/voxygen/src/render/scope.rs index 67abe277ec..e7135281f0 100644 --- a/voxygen/src/render/scope.rs +++ b/voxygen/src/render/scope.rs @@ -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,