@@ -57,10 +57,9 @@ use super::{
57
57
/// Structure describing a logical device. Some members are internally mutable,
58
58
/// stored behind mutexes.
59
59
pub struct Device {
60
- raw : ManuallyDrop < Box < dyn hal:: DynDevice > > ,
60
+ raw : Box < dyn hal:: DynDevice > ,
61
61
pub ( crate ) adapter : Arc < Adapter > ,
62
62
pub ( crate ) queue : OnceLock < Weak < Queue > > ,
63
- queue_to_drop : OnceLock < Box < dyn hal:: DynQueue > > ,
64
63
pub ( crate ) zero_buffer : ManuallyDrop < Box < dyn hal:: DynBuffer > > ,
65
64
/// The `label` from the descriptor used to create the resource.
66
65
label : String ,
@@ -154,23 +153,19 @@ impl Drop for Device {
154
153
closure. call ( DeviceLostReason :: Dropped , String :: from ( "Device dropped." ) ) ;
155
154
}
156
155
157
- // SAFETY: We are in the Drop impl and we don't use self.raw anymore after this point.
158
- let raw = unsafe { ManuallyDrop :: take ( & mut self . raw ) } ;
159
156
// SAFETY: We are in the Drop impl and we don't use self.zero_buffer anymore after this point.
160
157
let zero_buffer = unsafe { ManuallyDrop :: take ( & mut self . zero_buffer ) } ;
161
158
// SAFETY: We are in the Drop impl and we don't use self.fence anymore after this point.
162
159
let fence = unsafe { ManuallyDrop :: take ( & mut self . fence . write ( ) ) } ;
163
- self . command_allocator . dispose ( raw. as_ref ( ) ) ;
160
+ self . command_allocator . dispose ( self . raw . as_ref ( ) ) ;
164
161
#[ cfg( feature = "indirect-validation" ) ]
165
162
self . indirect_validation
166
163
. take ( )
167
164
. unwrap ( )
168
- . dispose ( raw. as_ref ( ) ) ;
165
+ . dispose ( self . raw . as_ref ( ) ) ;
169
166
unsafe {
170
- raw. destroy_buffer ( zero_buffer) ;
171
- raw. destroy_fence ( fence) ;
172
- let queue = self . queue_to_drop . take ( ) . unwrap ( ) ;
173
- raw. exit ( queue) ;
167
+ self . raw . destroy_buffer ( zero_buffer) ;
168
+ self . raw . destroy_fence ( fence) ;
174
169
}
175
170
}
176
171
}
@@ -249,10 +244,9 @@ impl Device {
249
244
} ;
250
245
251
246
Ok ( Self {
252
- raw : ManuallyDrop :: new ( raw_device) ,
247
+ raw : raw_device,
253
248
adapter : adapter. clone ( ) ,
254
249
queue : OnceLock :: new ( ) ,
255
- queue_to_drop : OnceLock :: new ( ) ,
256
250
zero_buffer : ManuallyDrop :: new ( zero_buffer) ,
257
251
label : desc. label . to_string ( ) ,
258
252
command_allocator,
@@ -325,10 +319,6 @@ impl Device {
325
319
DeviceError :: from_hal ( error)
326
320
}
327
321
328
- pub ( crate ) fn release_queue ( & self , queue : Box < dyn hal:: DynQueue > ) {
329
- assert ! ( self . queue_to_drop. set( queue) . is_ok( ) ) ;
330
- }
331
-
332
322
/// Run some destroy operations that were deferred.
333
323
///
334
324
/// Destroying the resources requires taking a write lock on the device's snatch lock,
0 commit comments