@@ -641,41 +641,25 @@ impl Tracker {
641641 }
642642
643643 /// Iterates through all resources in the given bind group and adopts
644- /// the state given for those resources in the UsageScope. It also
645- /// removes all touched resources from the usage scope.
644+ /// the state given for those resources in the UsageScope.
646645 ///
647646 /// If a transition is needed to get the resources into the needed
648647 /// state, those transitions are stored within the tracker. A
649648 /// subsequent call to [`BufferTracker::drain_transitions`] or
650649 /// [`TextureTracker::drain_transitions`] is needed to get those transitions.
651650 ///
652651 /// This is a really funky method used by Compute Passes to generate
653- /// barriers after a call to dispatch without needing to iterate
654- /// over all elements in the usage scope. We use each the
655- /// bind group as a source of which IDs to look at. The bind groups
656- /// must have first been added to the usage scope.
652+ /// barriers for each dispatch. We use the bind group as a source of which
653+ /// IDs to look at.
657654 ///
658655 /// Only stateful things are merged in here, all other resources are owned
659656 /// indirectly by the bind group.
660- ///
661- /// # Safety
662- ///
663- /// The maximum ID given by each bind group resource must be less than the
664- /// value given to `set_size`
665- pub unsafe fn set_and_remove_from_usage_scope_sparse (
666- & mut self ,
667- scope : & mut UsageScope ,
668- bind_group : & BindGroupStates ,
669- ) {
670- unsafe {
671- self . buffers . set_and_remove_from_usage_scope_sparse (
672- & mut scope. buffers ,
673- bind_group. buffers . used_tracker_indices ( ) ,
674- )
675- } ;
676- unsafe {
677- self . textures
678- . set_and_remove_from_usage_scope_sparse ( & mut scope. textures , & bind_group. views )
679- } ;
657+ pub fn set_from_bind_group ( & mut self , scope : & mut UsageScope , bind_group : & BindGroupStates ) {
658+ self . buffers . set_multiple (
659+ & mut scope. buffers ,
660+ bind_group. buffers . used_tracker_indices ( ) ,
661+ ) ;
662+ self . textures
663+ . set_multiple ( & mut scope. textures , & bind_group. views ) ;
680664 }
681665}
0 commit comments