Commit 4f77012 committed Apr 24, 2024 · 19 / 23
1 parent fe2a633 commit 4f77012 Copy full SHA for 4f77012
File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -545,13 +545,17 @@ impl<A: HalApi> LifetimeTracker<A> {
545
545
& mut trackers. bind_groups ,
546
546
|maps| & mut maps. bind_groups ,
547
547
) ;
548
+ let mut used_buffers = vec ! [ ] ;
549
+ let mut used_textures = vec ! [ ] ;
548
550
removed_resource. drain ( ..) . for_each ( |bind_group| {
549
551
for v in bind_group. used . buffers . drain_resources ( ) {
552
+ used_buffers. push ( v. clone ( ) ) ;
550
553
self . suspected_resources
551
554
. buffers
552
555
. insert ( v. as_info ( ) . tracker_index ( ) , v) ;
553
556
}
554
557
for v in bind_group. used . textures . drain_resources ( ) {
558
+ used_textures. push ( v. clone ( ) ) ;
555
559
self . suspected_resources
556
560
. textures
557
561
. insert ( v. as_info ( ) . tracker_index ( ) , v) ;
@@ -572,6 +576,12 @@ impl<A: HalApi> LifetimeTracker<A> {
572
576
bind_group. layout . clone ( ) ,
573
577
) ;
574
578
} ) ;
579
+ for b in used_buffers {
580
+ b. bind_groups . lock ( ) . retain ( |weak| weak. strong_count ( ) > 0 ) ;
581
+ }
582
+ for t in used_textures {
583
+ t. bind_groups . lock ( ) . retain ( |weak| weak. strong_count ( ) > 0 ) ;
584
+ }
575
585
self
576
586
}
577
587
You can’t perform that action at this time.
0 commit comments