pub(crate) struct Tracker {
pub buffers: BufferTracker,
pub textures: TextureTracker,
pub blas_s: BlasTracker,
pub tlas_s: StatelessTracker<Tlas>,
pub views: StatelessTracker<TextureView>,
pub bind_groups: StatelessTracker<BindGroup>,
pub compute_pipelines: StatelessTracker<ComputePipeline>,
pub render_pipelines: StatelessTracker<RenderPipeline>,
pub bundles: StatelessTracker<RenderBundle>,
pub query_sets: StatelessTracker<QuerySet>,
}Expand description
A full double sided tracker used by CommandBuffers.
Fields§
§buffers: BufferTrackerBuffers used within this command buffer.
For compute passes, this only includes buffers actually used by the
pipeline (contrast with the bind_groups member).
textures: TextureTrackerTextures used within this command buffer.
For compute passes, this only includes textures actually used by the
pipeline (contrast with the bind_groups member).
blas_s: BlasTracker§tlas_s: StatelessTracker<Tlas>§views: StatelessTracker<TextureView>§bind_groups: StatelessTracker<BindGroup>Contains all bind groups that were passed in any call to
set_bind_group on the encoder.
WebGPU requires that submission fails if any resource in any of these
bind groups is destroyed, even if the resource is not actually used by
the pipeline (e.g. because the pipeline does not use the bound slot, or
because the bind group was replaced by a subsequent call to
set_bind_group).
compute_pipelines: StatelessTracker<ComputePipeline>§render_pipelines: StatelessTracker<RenderPipeline>§bundles: StatelessTracker<RenderBundle>§query_sets: StatelessTracker<QuerySet>Implementations§
Source§impl Tracker
impl Tracker
pub fn new() -> Self
Sourcepub fn set_and_remove_from_usage_scope_sparse(
&mut self,
scope: &mut UsageScope<'_>,
bind_group: &BindGroupStates,
)
pub fn set_and_remove_from_usage_scope_sparse( &mut self, scope: &mut UsageScope<'_>, bind_group: &BindGroupStates, )
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_transitions or
TextureTracker::drain_transitions 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.
§Panics
If a resource in the bind_group is not found in the usage scope.