diff --git a/src/gpu_profiler.rs b/src/gpu_profiler.rs index 14aafe8..46e08e2 100644 --- a/src/gpu_profiler.rs +++ b/src/gpu_profiler.rs @@ -1,5 +1,6 @@ use std::fmt::Debug; use std::iter::Peekable; +use std::marker::PhantomData; use std::ops::Deref; use std::ops::DerefMut; @@ -8,6 +9,7 @@ use egui::Ui; use wgpu::Buffer; use wgpu::BufferUsages; use wgpu::CommandEncoder; +use wgpu::ComputePass; use wgpu::Device; use wgpu::QUERY_RESOLVE_BUFFER_ALIGNMENT; use wgpu::QuerySet; @@ -32,10 +34,11 @@ macro_rules! begin_scope { pub(crate) use begin_frame; pub(crate) use begin_scope; -pub struct ScopeEncoder<'enc, 'prof_enc> +pub struct ScopeEncoder<'enc, 'prof_enc, T> { encoder: &'prof_enc mut ProfilingEncoder<'enc>, scope_index: usize, + _phantom: PhantomData, } pub struct Scope @@ -53,6 +56,8 @@ pub struct ProfilingEncoder<'enc> query_set_allocator: QuerySetAllocator, scopes: Vec, index_stack: Vec, + + compute_pass: Option>, } pub struct GpuProfile @@ -86,19 +91,21 @@ impl<'enc> ProfilingEncoder<'enc> scopes: Vec::new(), device: device.clone(), index_stack: Vec::new(), + compute_pass: None, } } pub fn begin_frame<'prof_enc>( &'prof_enc mut self, frame_name: Option<&'static str>, - ) -> ScopeEncoder<'enc, 'prof_enc> + ) -> ScopeEncoder<'enc, 'prof_enc, CommandEncoder> { let scope_index = self.begin_scope(None, frame_name.unwrap_or("Frame")); self.index_stack.push(scope_index); ScopeEncoder { encoder: self, scope_index, + _phantom: Default::default(), } }