Struct wgpu_core::track::Tracker

source ·
pub(crate) struct Tracker<A: HalApi> {
    pub buffers: BufferTracker<A>,
    pub textures: TextureTracker<A>,
    pub views: StatelessTracker<A, TextureView<A>, TextureViewId>,
    pub samplers: StatelessTracker<A, Sampler<A>, SamplerId>,
    pub bind_groups: StatelessTracker<A, BindGroup<A>, BindGroupId>,
    pub compute_pipelines: StatelessTracker<A, ComputePipeline<A>, ComputePipelineId>,
    pub render_pipelines: StatelessTracker<A, RenderPipeline<A>, RenderPipelineId>,
    pub bundles: StatelessTracker<A, RenderBundle<A>, RenderBundleId>,
    pub query_sets: StatelessTracker<A, QuerySet<A>, QuerySetId>,
}
Expand description

A full double sided tracker used by CommandBuffers and the Device.

Fields§

§buffers: BufferTracker<A>§textures: TextureTracker<A>§views: StatelessTracker<A, TextureView<A>, TextureViewId>§samplers: StatelessTracker<A, Sampler<A>, SamplerId>§bind_groups: StatelessTracker<A, BindGroup<A>, BindGroupId>§compute_pipelines: StatelessTracker<A, ComputePipeline<A>, ComputePipelineId>§render_pipelines: StatelessTracker<A, RenderPipeline<A>, RenderPipelineId>§bundles: StatelessTracker<A, RenderBundle<A>, RenderBundleId>§query_sets: StatelessTracker<A, QuerySet<A>, QuerySetId>

Implementations§

source§

impl<A: HalApi> Tracker<A>

source

pub fn new() -> Self

source

pub fn set_size( &mut self, buffers: Option<&Storage<Buffer<A>, BufferId>>, textures: Option<&Storage<Texture<A>, TextureId>>, views: Option<&Storage<TextureView<A>, TextureViewId>>, samplers: Option<&Storage<Sampler<A>, SamplerId>>, bind_groups: Option<&Storage<BindGroup<A>, BindGroupId>>, compute_pipelines: Option<&Storage<ComputePipeline<A>, ComputePipelineId>>, render_pipelines: Option<&Storage<RenderPipeline<A>, RenderPipelineId>>, bundles: Option<&Storage<RenderBundle<A>, RenderBundleId>>, query_sets: Option<&Storage<QuerySet<A>, QuerySetId>> )

Pull the maximum IDs from the hubs.

source

pub unsafe fn set_and_remove_from_usage_scope_sparse( &mut self, textures: &Storage<Texture<A>, TextureId>, scope: &mut UsageScope<A>, bind_group: &BindGroupStates<A> )

Iterates through all resources in the given bind group and adopts the state given for those resources in the UsageScope. It also removes all touched resources from the usage scope.

If a transition is needed to get the resources into the needed state, those transitions are stored within the tracker. A subsequent call to BufferTracker::drain or TextureTracker::drain is needed to get those transitions.

This is a really funky method used by Compute Passes to generate barriers after a call to dispatch without needing to iterate over all elements in the usage scope. We use each the bind group as a source of which IDs to look at. The bind groups must have first been added to the usage scope.

Only stateful things are merged in here, all other resources are owned indirectly by the bind group.

Safety

The maximum ID given by each bind group resource must be less than the value given to set_size

source

pub unsafe fn add_from_render_bundle( &mut self, render_bundle: &RenderBundleScope<A> ) -> Result<(), UsageConflict>

Tracks the stateless resources from the given renderbundle. It is expected that the stateful resources will get merged into a usage scope first.

Safety

The maximum ID given by each bind group resource must be less than the value given to set_size

Auto Trait Implementations§

§

impl<A> !RefUnwindSafe for Tracker<A>

§

impl<A> Send for Tracker<A>where A: Send,

§

impl<A> Sync for Tracker<A>where A: Sync,

§

impl<A> Unpin for Tracker<A>where A: Unpin, <A as Api>::BindGroup: Unpin, <A as Api>::ComputePipeline: Unpin, <A as Api>::QuerySet: Unpin, <A as Api>::RenderPipeline: Unpin, <A as Api>::Sampler: Unpin, <A as Api>::TextureView: Unpin,

§

impl<A> !UnwindSafe for Tracker<A>

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

impl<T> WasmNotSend for Twhere T: Send,

source§

impl<T> WasmNotSync for Twhere T: Sync,