File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ impl Global {
7878 device. check_is_valid ( ) ?;
7979 device. require_features ( Features :: EXPERIMENTAL_RAY_QUERY ) ?;
8080
81- let mut build_command = AsBuild :: default ( ) ;
81+ let mut build_command = AsBuild :: with_capacity ( blas_ids . len ( ) , tlas_ids . len ( ) ) ;
8282
8383 for blas in blas_ids {
8484 let blas = hub. blas_s . get ( * blas) . get ( ) ?;
@@ -187,7 +187,7 @@ pub(crate) fn build_acceleration_structures(
187187 . device
188188 . require_features ( Features :: EXPERIMENTAL_RAY_QUERY ) ?;
189189
190- let mut build_command = AsBuild :: default ( ) ;
190+ let mut build_command = AsBuild :: with_capacity ( blas . len ( ) , tlas . len ( ) ) ;
191191 let mut input_barriers = Vec :: < hal:: BufferBarrier < dyn hal:: DynBuffer > > :: new ( ) ;
192192 let mut scratch_buffer_blas_size = 0 ;
193193 let mut blas_storage = Vec :: with_capacity ( blas. len ( ) ) ;
Original file line number Diff line number Diff line change @@ -302,6 +302,15 @@ pub(crate) struct AsBuild {
302302 pub tlas_s_built : Vec < TlasBuild > ,
303303}
304304
305+ impl AsBuild {
306+ pub ( crate ) fn with_capacity ( blas : usize , tlas : usize ) -> Self {
307+ Self {
308+ blas_s_built : Vec :: with_capacity ( blas) ,
309+ tlas_s_built : Vec :: with_capacity ( tlas) ,
310+ }
311+ }
312+ }
313+
305314#[ derive( Debug , Clone ) ]
306315pub ( crate ) enum AsAction {
307316 Build ( AsBuild ) ,
You can’t perform that action at this time.
0 commit comments