File tree 4 files changed +16
-11
lines changed
4 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ impl Device {
363
363
let Some ( view) = view. upgrade ( ) else {
364
364
continue ;
365
365
} ;
366
- let Some ( raw_view) = view. raw . snatch ( self . snatchable_lock . write ( ) ) else {
366
+ let Some ( raw_view) = view. raw . snatch ( & mut self . snatchable_lock . write ( ) ) else {
367
367
continue ;
368
368
} ;
369
369
@@ -377,7 +377,8 @@ impl Device {
377
377
let Some ( bind_group) = bind_group. upgrade ( ) else {
378
378
continue ;
379
379
} ;
380
- let Some ( raw_bind_group) = bind_group. raw . snatch ( self . snatchable_lock . write ( ) )
380
+ let Some ( raw_bind_group) =
381
+ bind_group. raw . snatch ( & mut self . snatchable_lock . write ( ) )
381
382
else {
382
383
continue ;
383
384
} ;
Original file line number Diff line number Diff line change @@ -288,8 +288,11 @@ impl Global {
288
288
. textures
289
289
. remove ( texture. tracker_index ( ) ) ;
290
290
let suf = surface. raw ( device. backend ( ) ) . unwrap ( ) ;
291
- let exclusive_snatch_guard = device. snatchable_lock . write ( ) ;
292
- match texture. inner . snatch ( exclusive_snatch_guard) . unwrap ( ) {
291
+ match texture
292
+ . inner
293
+ . snatch ( & mut device. snatchable_lock . write ( ) )
294
+ . unwrap ( )
295
+ {
293
296
resource:: TextureInner :: Surface { raw, parent_id } => {
294
297
if surface_id != parent_id {
295
298
log:: error!( "Presented frame is from a different surface" ) ;
@@ -359,8 +362,11 @@ impl Global {
359
362
. textures
360
363
. remove ( texture. tracker_index ( ) ) ;
361
364
let suf = surface. raw ( device. backend ( ) ) ;
362
- let exclusive_snatch_guard = device. snatchable_lock . write ( ) ;
363
- match texture. inner . snatch ( exclusive_snatch_guard) . unwrap ( ) {
365
+ match texture
366
+ . inner
367
+ . snatch ( & mut device. snatchable_lock . write ( ) )
368
+ . unwrap ( )
369
+ {
364
370
resource:: TextureInner :: Surface { raw, parent_id } => {
365
371
if surface_id == parent_id {
366
372
unsafe { suf. unwrap ( ) . discard_texture ( raw) } ;
Original file line number Diff line number Diff line change @@ -737,8 +737,7 @@ impl Buffer {
737
737
let device = & self . device ;
738
738
739
739
let temp = {
740
- let snatch_guard = device. snatchable_lock . write ( ) ;
741
- let raw = match self . raw . snatch ( snatch_guard) {
740
+ let raw = match self . raw . snatch ( & mut device. snatchable_lock . write ( ) ) {
742
741
Some ( raw) => raw,
743
742
None => {
744
743
return Err ( DestroyError :: AlreadyDestroyed ) ;
@@ -1185,8 +1184,7 @@ impl Texture {
1185
1184
let device = & self . device ;
1186
1185
1187
1186
let temp = {
1188
- let snatch_guard = device. snatchable_lock . write ( ) ;
1189
- let raw = match self . inner . snatch ( snatch_guard) {
1187
+ let raw = match self . inner . snatch ( & mut device. snatchable_lock . write ( ) ) {
1190
1188
Some ( TextureInner :: Native { raw } ) => raw,
1191
1189
Some ( TextureInner :: Surface { .. } ) => {
1192
1190
return Ok ( ( ) ) ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ impl<T> Snatchable<T> {
38
38
}
39
39
40
40
/// Take the value. Requires a the snatchable lock's write guard.
41
- pub fn snatch ( & self , _guard : ExclusiveSnatchGuard ) -> Option < T > {
41
+ pub fn snatch ( & self , _guard : & mut ExclusiveSnatchGuard ) -> Option < T > {
42
42
unsafe { ( * self . value . get ( ) ) . take ( ) }
43
43
}
44
44
You can’t perform that action at this time.
0 commit comments