From cafc0b083177f29b08b964650f06aded6398c08d Mon Sep 17 00:00:00 2001 From: Vecvec Date: Mon, 29 Jul 2024 12:00:25 +1200 Subject: [PATCH] clippy --- wgpu-core/src/command/ray_tracing.rs | 36 ++++++++++------------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/wgpu-core/src/command/ray_tracing.rs b/wgpu-core/src/command/ray_tracing.rs index e94458f9db..640853a632 100644 --- a/wgpu-core/src/command/ray_tracing.rs +++ b/wgpu-core/src/command/ray_tracing.rs @@ -14,7 +14,7 @@ use crate::{ FastHashSet, }; -use wgt::{math::align_to, BufferUsages, BufferAddress}; +use wgt::{math::align_to, BufferAddress, BufferUsages}; use super::{BakedCommands, CommandBufferMutable, CommandEncoderError}; use crate::lock::rank; @@ -37,6 +37,8 @@ type BufferStorage<'a, A> = Vec<( Option>>, )>; +type BlasStorage<'a, A> = Vec<(Arc>, hal::AccelerationStructureEntries<'a, A>, u64)>; + // This should be queried from the device, maybe the the hal api should pre aline it, since I am unsure how else we can idiomatically get this value. const SCRATCH_BUFFER_ALIGNMENT: u32 = 256; @@ -146,18 +148,10 @@ impl Global { let tlas_iter = trace_tlas.iter(); let mut input_barriers = Vec::>::new(); - let mut buf_storage = Vec::<( - Arc>, - Option>, - Option<(Arc>, Option>)>, - Option<(Arc>, Option>)>, - BlasTriangleGeometry, - Option>>, - )>::new(); + let mut buf_storage = BufferStorage::new(); let mut scratch_buffer_blas_size = 0; - let mut blas_storage = - Vec::<(Arc>, hal::AccelerationStructureEntries, u64)>::new(); + let mut blas_storage = BlasStorage::new(); let mut cmd_buf_data = cmd_buf.data.lock(); let cmd_buf_data = cmd_buf_data.as_mut().unwrap(); @@ -493,18 +487,10 @@ impl Global { }); let mut input_barriers = Vec::>::new(); - let mut buf_storage = Vec::<( - Arc>, - Option>, - Option<(Arc>, Option>)>, - Option<(Arc>, Option>)>, - BlasTriangleGeometry, - Option>>, - )>::new(); + let mut buf_storage = BufferStorage::new(); let mut scratch_buffer_blas_size = 0; - let mut blas_storage = - Vec::<(Arc>, hal::AccelerationStructureEntries, u64)>::new(); + let mut blas_storage = BlasStorage::new(); let mut cmd_buf_data = cmd_buf.data.lock(); let cmd_buf_data = cmd_buf_data.as_mut().unwrap(); @@ -1030,7 +1016,7 @@ fn iter_buffers<'a, 'b, A: HalApi>( cmd_buf_data: &mut CommandBufferMutable, buffer_guard: &RwLockReadGuard>>, scratch_buffer_blas_size: &mut u64, - blas_storage: &mut Vec<(Arc>, hal::AccelerationStructureEntries<'a, A>, u64)>, + blas_storage: &mut BlasStorage<'a, A>, ) -> Result<(), BuildAccelerationStructureError> { let mut triangle_entries = Vec::>::new(); for buf in buf_storage { @@ -1219,7 +1205,11 @@ fn iter_buffers<'a, 'b, A: HalApi>( } fn map_blas<'a, A: HalApi>( - storage: &'a (Arc>, hal::AccelerationStructureEntries, BufferAddress), + storage: &'a ( + Arc>, + hal::AccelerationStructureEntries, + BufferAddress, + ), scratch_buffer: &'a ::Buffer, ) -> hal::BuildAccelerationStructureDescriptor<'a, A> { let (blas, entries, scratch_buffer_offset) = storage;