Struct wgpu_profiler::ManualOwningScope
source · pub struct ManualOwningScope<'a, Recorder: ProfilerCommandRecorder> {
pub profiler: &'a GpuProfiler,
pub recorder: Recorder,
pub scope: Option<GpuProfilerQuery>,
}
Expand description
Scope that takes ownership of the encoder/pass.
Does NOT call GpuProfiler::end_query()
on drop.
This construct is just for completeness in cases where working with scopes is preferred but one can’t rely on the Drop call in the right place.
This is useful when the owned value needs to be recovered after the end of the scope.
In particular, to submit a wgpu::CommandEncoder
to a queue, ownership of the encoder is necessary.
Fields§
§profiler: &'a GpuProfiler
§recorder: Recorder
§scope: Option<GpuProfilerQuery>
Implementations§
source§impl<'a, R: ProfilerCommandRecorder> ManualOwningScope<'a, R>
impl<'a, R: ProfilerCommandRecorder> ManualOwningScope<'a, R>
sourcepub fn end_query(self) -> R
pub fn end_query(self) -> R
Ends the scope allowing the extraction of the owned ProfilerCommandRecorder
.
source§impl<'a, R: ProfilerCommandRecorder> ManualOwningScope<'a, R>
impl<'a, R: ProfilerCommandRecorder> ManualOwningScope<'a, R>
source§impl<'a> ManualOwningScope<'a, CommandEncoder>
impl<'a> ManualOwningScope<'a, CommandEncoder>
sourcepub fn scoped_render_pass<'b>(
&'b mut self,
label: impl Into<String>,
device: &Device,
pass_descriptor: RenderPassDescriptor<'b, '_>
) -> OwningScope<'b, RenderPass<'b>>
pub fn scoped_render_pass<'b>( &'b mut self, label: impl Into<String>, device: &Device, pass_descriptor: RenderPassDescriptor<'b, '_> ) -> OwningScope<'b, RenderPass<'b>>
Start a render pass wrapped in a OwningScope
.
Ignores passed wgpu::RenderPassDescriptor::timestamp_writes
and replaces it with
timestamp_writes
managed by GpuProfiler
.
Note that in order to take measurements, this does not require the
wgpu::Features::TIMESTAMP_QUERY_INSIDE_PASSES
feature, only wgpu::Features::TIMESTAMP_QUERY
.
sourcepub fn scoped_compute_pass<'b>(
&'b mut self,
label: impl Into<String>,
device: &Device
) -> OwningScope<'b, ComputePass<'b>>
pub fn scoped_compute_pass<'b>( &'b mut self, label: impl Into<String>, device: &Device ) -> OwningScope<'b, ComputePass<'b>>
Start a compute pass wrapped in a OwningScope
.
Uses passed label both for profiler scope and compute pass label.
timestamp_writes
managed by GpuProfiler
.
Note that in order to take measurements, this does not require the
wgpu::Features::TIMESTAMP_QUERY_INSIDE_PASSES
feature, only wgpu::Features::TIMESTAMP_QUERY
.