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>

source

pub fn end_query(self) -> R

Ends the scope allowing the extraction of the owned ProfilerCommandRecorder.

source§

impl<'a, R: ProfilerCommandRecorder> ManualOwningScope<'a, R>

source

pub fn scope( &mut self, label: impl Into<String>, device: &Device ) -> Scope<'_, R>

Starts a new profiler scope nested within this one.

source§

impl<'a> ManualOwningScope<'a, CommandEncoder>

source

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.

source

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.

Trait Implementations§

source§

impl<'a, R: ProfilerCommandRecorder> Deref for ManualOwningScope<'a, R>

§

type Target = R

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a, R: ProfilerCommandRecorder> DerefMut for ManualOwningScope<'a, R>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'a, Recorder> Freeze for ManualOwningScope<'a, Recorder>
where Recorder: Freeze,

§

impl<'a, Recorder> !RefUnwindSafe for ManualOwningScope<'a, Recorder>

§

impl<'a, Recorder> Send for ManualOwningScope<'a, Recorder>
where Recorder: Send,

§

impl<'a, Recorder> Sync for ManualOwningScope<'a, Recorder>
where Recorder: Sync,

§

impl<'a, Recorder> Unpin for ManualOwningScope<'a, Recorder>
where Recorder: Unpin,

§

impl<'a, Recorder> !UnwindSafe for ManualOwningScope<'a, Recorder>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,