@@ -2010,42 +2010,6 @@ impl AccelerationStructure for Blas {
20102010 }
20112011}
20122012
2013- impl Blas {
2014- pub ( crate ) fn destroy ( self : & Arc < Self > ) -> Result < ( ) , DestroyError > {
2015- let device = & self . device ;
2016-
2017- let temp = {
2018- let mut snatch_guard = device. snatchable_lock . write ( ) ;
2019-
2020- let raw = match self . raw . snatch ( & mut snatch_guard) {
2021- Some ( raw) => raw,
2022- None => {
2023- return Err ( DestroyError :: AlreadyDestroyed ) ;
2024- }
2025- } ;
2026-
2027- drop ( snatch_guard) ;
2028-
2029- queue:: TempResource :: DestroyedAccelerationStructure ( DestroyedAccelerationStructure {
2030- raw : ManuallyDrop :: new ( raw) ,
2031- device : Arc :: clone ( & self . device ) ,
2032- label : self . label ( ) . to_owned ( ) ,
2033- bind_groups : WeakVec :: new ( ) ,
2034- } )
2035- } ;
2036-
2037- if let Some ( queue) = device. get_queue ( ) {
2038- let mut life_lock = queue. lock_life ( ) ;
2039- let last_submit_index = life_lock. get_blas_latest_submission_index ( self ) ;
2040- if let Some ( last_submit_index) = last_submit_index {
2041- life_lock. schedule_resource_destruction ( temp, last_submit_index) ;
2042- }
2043- }
2044-
2045- Ok ( ( ) )
2046- }
2047- }
2048-
20492013crate :: impl_resource_type!( Blas ) ;
20502014crate :: impl_labeled!( Blas ) ;
20512015crate :: impl_parent_device!( Blas ) ;
@@ -2066,7 +2030,6 @@ pub struct Tlas {
20662030 /// The `label` from the descriptor used to create the resource.
20672031 pub ( crate ) label : String ,
20682032 pub ( crate ) tracking_data : TrackingData ,
2069- pub ( crate ) bind_groups : Mutex < WeakVec < BindGroup > > ,
20702033}
20712034
20722035impl Drop for Tlas {
@@ -2099,71 +2062,3 @@ crate::impl_labeled!(Tlas);
20992062crate :: impl_parent_device!( Tlas ) ;
21002063crate :: impl_storage_item!( Tlas ) ;
21012064crate :: impl_trackable!( Tlas ) ;
2102-
2103- impl Tlas {
2104- pub ( crate ) fn destroy ( self : & Arc < Self > ) -> Result < ( ) , DestroyError > {
2105- let device = & self . device ;
2106-
2107- let temp = {
2108- let mut snatch_guard = device. snatchable_lock . write ( ) ;
2109-
2110- let raw = match self . raw . snatch ( & mut snatch_guard) {
2111- Some ( raw) => raw,
2112- None => {
2113- return Err ( DestroyError :: AlreadyDestroyed ) ;
2114- }
2115- } ;
2116-
2117- drop ( snatch_guard) ;
2118-
2119- queue:: TempResource :: DestroyedAccelerationStructure ( DestroyedAccelerationStructure {
2120- raw : ManuallyDrop :: new ( raw) ,
2121- device : Arc :: clone ( & self . device ) ,
2122- label : self . label ( ) . to_owned ( ) ,
2123- bind_groups : mem:: take ( & mut self . bind_groups . lock ( ) ) ,
2124- } )
2125- } ;
2126-
2127- if let Some ( queue) = device. get_queue ( ) {
2128- let mut life_lock = queue. lock_life ( ) ;
2129- let last_submit_index = life_lock. get_tlas_latest_submission_index ( self ) ;
2130- if let Some ( last_submit_index) = last_submit_index {
2131- life_lock. schedule_resource_destruction ( temp, last_submit_index) ;
2132- }
2133- }
2134-
2135- Ok ( ( ) )
2136- }
2137- }
2138-
2139- #[ derive( Debug ) ]
2140- pub struct DestroyedAccelerationStructure {
2141- raw : ManuallyDrop < Box < dyn hal:: DynAccelerationStructure > > ,
2142- device : Arc < Device > ,
2143- label : String ,
2144- // only filled if the acceleration structure is a TLAS
2145- bind_groups : WeakVec < BindGroup > ,
2146- }
2147-
2148- impl DestroyedAccelerationStructure {
2149- pub fn label ( & self ) -> & dyn Debug {
2150- & self . label
2151- }
2152- }
2153-
2154- impl Drop for DestroyedAccelerationStructure {
2155- fn drop ( & mut self ) {
2156- let mut deferred = self . device . deferred_destroy . lock ( ) ;
2157- deferred. push ( DeferredDestroy :: BindGroups ( mem:: take (
2158- & mut self . bind_groups ,
2159- ) ) ) ;
2160- drop ( deferred) ;
2161-
2162- resource_log ! ( "Destroy raw Buffer (destroyed) {:?}" , self . label( ) ) ;
2163- // SAFETY: We are in the Drop impl and we don't use self.raw anymore after this point.
2164- let raw = unsafe { ManuallyDrop :: take ( & mut self . raw ) } ;
2165- unsafe {
2166- hal:: DynDevice :: destroy_acceleration_structure ( self . device . raw ( ) , raw) ;
2167- }
2168- }
2169- }
0 commit comments