Struct Scope

Source
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>

Source

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

Starts a new profiler scope nested within this one.

Source§

impl<'a> Scope<'a, CommandEncoder>

Source

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.

Source

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.

Trait Implementations§

Source§

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

Source§

type Target = R

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

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

Source§

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

Mutably dereferences the value.
Source§

impl<R: ProfilerCommandRecorder> Drop for Scope<'_, R>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a, Recorder> Freeze for Scope<'a, Recorder>

§

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

§

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

§

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

§

impl<'a, Recorder> Unpin for Scope<'a, Recorder>

§

impl<'a, Recorder> !UnwindSafe for Scope<'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> 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

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