Starting compute pass prof
This commit is contained in:
+9
-2
@@ -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<T>,
|
||||
}
|
||||
|
||||
pub struct Scope
|
||||
@@ -53,6 +56,8 @@ pub struct ProfilingEncoder<'enc>
|
||||
query_set_allocator: QuerySetAllocator,
|
||||
scopes: Vec<Scope>,
|
||||
index_stack: Vec<usize>,
|
||||
|
||||
compute_pass: Option<ComputePass<'static>>,
|
||||
}
|
||||
|
||||
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(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user