pub struct Scope<'a, Recorder: ProfilerCommandRecorder> {
pub profiler: &'a GpuProfiler,
pub recorder: &'a mut Recorder,
pub scope: Option<GpuProfilerQuery>,
}
Expand description
Scope that takes a (mutable) reference to the encoder/pass.
Calls GpuProfiler::end_query()
on drop.
Fields§
§profiler: &'a GpuProfiler
§recorder: &'a mut Recorder
§scope: Option<GpuProfilerQuery>
Implementations§
Source§impl<'a, R: ProfilerCommandRecorder> Scope<'a, R>
impl<'a, R: ProfilerCommandRecorder> Scope<'a, R>
Source§impl<'a> Scope<'a, CommandEncoder>
impl<'a> Scope<'a, CommandEncoder>
Sourcepub fn scoped_render_pass(
&mut self,
label: impl Into<String>,
pass_descriptor: RenderPassDescriptor<'_>,
) -> OwningScope<'_, RenderPass<'_>>
pub fn scoped_render_pass( &mut self, label: impl Into<String>, pass_descriptor: RenderPassDescriptor<'_>, ) -> OwningScope<'_, RenderPass<'_>>
Start a render pass wrapped in a OwningScope
.
Ignores passed wgpu::RenderPassDescriptor::timestamp_writes
and replaces it with
timestamp_writes
managed by GpuProfiler
if profiling is enabled.
This also sets the wgpu::RenderPassDescriptor::label
if it’s None
(default).
Note that in order to take measurements, this requires the wgpu::Features::TIMESTAMP_QUERY
feature.
wgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS
& wgpu::Features::TIMESTAMP_QUERY_INSIDE_PASSES
are not required.
Sourcepub fn scoped_compute_pass(
&mut self,
label: impl Into<String>,
) -> OwningScope<'_, ComputePass<'_>>
pub fn scoped_compute_pass( &mut self, label: impl Into<String>, ) -> OwningScope<'_, ComputePass<'_>>
Start a compute pass wrapped in a OwningScope
.
Uses passed label both for profiler scope and compute pass label.
timestamp_writes
managed by GpuProfiler
if profiling is enabled.
Note that in order to take measurements, this requires the wgpu::Features::TIMESTAMP_QUERY
feature.
wgpu::Features::TIMESTAMP_QUERY_INSIDE_ENCODERS
& wgpu::Features::TIMESTAMP_QUERY_INSIDE_PASSES
are not required.