@@ -12,7 +12,7 @@ use crate::{
12
12
init_tracker:: { BufferInitTracker , TextureInitTracker } ,
13
13
lock:: { rank, Mutex , RwLock } ,
14
14
resource_log,
15
- snatch:: { ExclusiveSnatchGuard , SnatchGuard , Snatchable } ,
15
+ snatch:: { SnatchGuard , Snatchable } ,
16
16
track:: { SharedTrackerIndexAllocator , TextureSelector , TrackerIndex } ,
17
17
Label , LabelHelpers ,
18
18
} ;
@@ -953,17 +953,16 @@ pub(crate) enum TextureInner<A: HalApi> {
953
953
raw : A :: Texture ,
954
954
} ,
955
955
Surface {
956
- raw : Option < A :: SurfaceTexture > ,
956
+ raw : A :: SurfaceTexture ,
957
957
parent_id : SurfaceId ,
958
958
} ,
959
959
}
960
960
961
961
impl < A : HalApi > TextureInner < A > {
962
- pub ( crate ) fn raw ( & self ) -> Option < & A :: Texture > {
962
+ pub ( crate ) fn raw ( & self ) -> & A :: Texture {
963
963
match self {
964
- Self :: Native { raw } => Some ( raw) ,
965
- Self :: Surface { raw : Some ( tex) , .. } => Some ( tex. borrow ( ) ) ,
966
- _ => None ,
964
+ Self :: Native { raw } => raw,
965
+ Self :: Surface { raw, .. } => raw. borrow ( ) ,
967
966
}
968
967
}
969
968
}
@@ -1104,7 +1103,7 @@ impl<A: HalApi> Texture<A> {
1104
1103
}
1105
1104
1106
1105
pub ( crate ) fn raw < ' a > ( & ' a self , snatch_guard : & ' a SnatchGuard ) -> Option < & ' a A :: Texture > {
1107
- self . inner . get ( snatch_guard) ?. raw ( )
1106
+ Some ( self . inner . get ( snatch_guard) ?. raw ( ) )
1108
1107
}
1109
1108
1110
1109
pub ( crate ) fn try_raw < ' a > (
@@ -1113,16 +1112,10 @@ impl<A: HalApi> Texture<A> {
1113
1112
) -> Result < & ' a A :: Texture , DestroyedResourceError > {
1114
1113
self . inner
1115
1114
. get ( guard)
1116
- . and_then ( |t| t. raw ( ) )
1115
+ . map ( |t| t. raw ( ) )
1117
1116
. ok_or_else ( || DestroyedResourceError ( self . error_ident ( ) ) )
1118
1117
}
1119
1118
1120
- pub ( crate ) fn inner_mut < ' a > (
1121
- & ' a self ,
1122
- guard : & ' a mut ExclusiveSnatchGuard ,
1123
- ) -> Option < & ' a mut TextureInner < A > > {
1124
- self . inner . get_mut ( guard)
1125
- }
1126
1119
pub ( crate ) fn get_clear_view < ' a > (
1127
1120
clear_mode : & ' a TextureClearMode < A > ,
1128
1121
desc : & ' a wgt:: TextureDescriptor < ( ) , Vec < wgt:: TextureFormat > > ,
0 commit comments