Struct wgpu_profiler::GpuProfiler[][src]

pub struct GpuProfiler {
    pub enable_timer: bool,
    pub enable_debug_marker: bool,
    // some fields omitted
}

Fields

enable_timer: boolenable_debug_marker: bool

Implementations

impl GpuProfiler[src]

pub const REQUIRED_WGPU_FEATURES: Features[src]

Required wgpu features for timer scopes.

pub fn new(max_num_pending_frames: usize, timestamp_period: f32) -> Self[src]

Creates a new Profiler object.

There is nothing preventing the use of several independent profiler objects. In order to use profiler scopes later on, the device passed needs to have the [wgpu::Features::TIMESTAMP_QUERY] feature enabled. (see GpuProfiler::REQUIRED_WGPU_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::Adapter::get_timestamp_period()]

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

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

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

Ends a debug/timer scope.

Panics if no scope has been open previously.

See also wgpu_profiler!, GpuProfiler::begin_scope

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

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

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

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

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

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

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast<T> for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Upcast<T> for T