pub struct GpuProfiler {
    pub enable_debug_marker: bool,
    /* private fields */
}

Fields§

§enable_debug_marker: bool

Implementations§

source§

impl GpuProfiler

source

pub const ALL_WGPU_TIMER_FEATURES: Features = _

Combination of all timer query features GpuProfiler can leverage.

source

pub const REQUIRED_WGPU_FEATURES: Features = GpuProfiler::ALL_WGPU_TIMER_FEATURES

👎Deprecated since 0.9.0: Use ALL_WGPU_TIMER_FEATURES instead

Combination of all timer query features GpuProfiler can leverage.

source

pub fn new( _adapter: &Adapter, device: &Device, queue: &Queue, max_num_pending_frames: usize ) -> Self

Creates a new Profiler object.

There is nothing preventing the use of several independent profiler objects.

active_features should contain the features enabled on the device to be used in the profiler scopes, these will be used to determine what queries are supported and configure the profiler accordingly (see GpuProfiler::ALL_WGPU_TIMER_FEATURES)

A profiler queues up to max_num_pending_frames “profiler-frames” at a time. A profiler-frame is in-flight until its queries have been successfully resolved using GpuProfiler::process_finished_frame. If this threshold is reached, GpuProfiler::end_frame will drop frames. (Typical values for max_num_pending_frames are 2~4)

timestamp_period needs to be set to the result of wgpu::Queue::get_timestamp_period

source

pub fn begin_scope<Recorder: ProfilerCommandRecorder>( &mut self, label: &str, encoder_or_pass: &mut Recorder, device: &Device )

Starts a new debug/timer scope on a given encoder or rendering/compute pass.

Scopes can be arbitrarily nested.

May create new wgpu query objects (which is why it needs a wgpu::Device reference)

See also wgpu_profiler!, GpuProfiler::end_scope

source

pub fn end_scope<Recorder: ProfilerCommandRecorder>( &mut self, encoder_or_pass: &mut Recorder )

Ends a debug/timer scope.

Panics if no scope has been open previously.

See also wgpu_profiler!, GpuProfiler::begin_scope

source

pub fn resolve_queries(&mut self, encoder: &mut CommandEncoder)

Puts query resolve commands in the encoder for all unresolved, pending queries of the current profiler frame.

source

pub fn end_frame(&mut self) -> Result<(), ()>

Marks the end of a frame. Needs to be called after submitting any encoder used in the current frame.

source

pub fn process_finished_frame(&mut self) -> Option<Vec<GpuTimerScopeResult>>

Checks if all timer queries for the oldest pending finished frame are done and returns that snapshot if any.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

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 Twhere 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 Twhere 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 Twhere 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.
§

impl<T> Upcast<T> for T

§

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

§

impl<T> WasmNotSend for Twhere T: Send,

§

impl<T> WasmNotSync for Twhere T: Sync,