diff --git a/wgpu-core/src/command/ray_tracing.rs b/wgpu-core/src/command/ray_tracing.rs index d43838511a..6f71596105 100644 --- a/wgpu-core/src/command/ray_tracing.rs +++ b/wgpu-core/src/command/ray_tracing.rs @@ -223,7 +223,7 @@ impl Global { }; let tlas = hub.tlas_s.get(entry.tlas_id).get()?; - cmd_buf_data.trackers.tlas_s.set_single(tlas.clone()); + cmd_buf_data.trackers.tlas_s.insert_single(tlas.clone()); cmd_buf_data.tlas_actions.push(TlasAction { tlas: tlas.clone(), @@ -485,7 +485,7 @@ impl Global { for package in tlas_iter { let tlas = hub.tlas_s.get(package.tlas_id).get()?; - cmd_buf_data.trackers.tlas_s.set_single(tlas.clone()); + cmd_buf_data.trackers.tlas_s.insert_single(tlas.clone()); tlas_lock_store.push((Some(package), tlas)) } @@ -516,7 +516,7 @@ impl Global { } let blas = hub.blas_s.get(instance.blas_id).get()?; - cmd_buf_data.trackers.blas_s.set_single(blas.clone()); + cmd_buf_data.trackers.blas_s.insert_single(blas.clone()); instance_buffer_staging_source.extend(device.raw().tlas_instance_to_bytes( hal::TlasInstance { @@ -803,7 +803,7 @@ fn iter_blas<'a>( let mut temp_buffer = Vec::new(); for entry in blas_iter { let blas = hub.blas_s.get(entry.blas_id).get()?; - cmd_buf_data.trackers.blas_s.set_single(blas.clone()); + cmd_buf_data.trackers.blas_s.insert_single(blas.clone()); cmd_buf_data.blas_actions.push(BlasAction { blas: blas.clone(), diff --git a/wgpu-core/src/track/mod.rs b/wgpu-core/src/track/mod.rs index 9a66b5f903..d4135cbadf 100644 --- a/wgpu-core/src/track/mod.rs +++ b/wgpu-core/src/track/mod.rs @@ -98,7 +98,6 @@ Device <- CommandBuffer = insert(device.start, device.end, buffer.start, buffer. mod buffer; mod metadata; mod range; -mod ray_tracing; mod stateless; mod texture; @@ -113,7 +112,6 @@ use crate::{ use std::{fmt, ops, sync::Arc}; use thiserror::Error; -use crate::track::ray_tracing::AccelerationStructureTracker; pub(crate) use buffer::{ BufferBindGroupState, BufferTracker, BufferUsageScope, DeviceBufferTracker, }; @@ -602,8 +600,8 @@ impl DeviceTracker { pub(crate) struct Tracker { pub buffers: BufferTracker, pub textures: TextureTracker, - pub blas_s: AccelerationStructureTracker, - pub tlas_s: AccelerationStructureTracker, + pub blas_s: StatelessTracker, + pub tlas_s: StatelessTracker, pub views: StatelessTracker, pub bind_groups: StatelessTracker, pub compute_pipelines: StatelessTracker, @@ -617,8 +615,8 @@ impl Tracker { Self { buffers: BufferTracker::new(), textures: TextureTracker::new(), - blas_s: AccelerationStructureTracker::new(), - tlas_s: AccelerationStructureTracker::new(), + blas_s: StatelessTracker::new(), + tlas_s: StatelessTracker::new(), views: StatelessTracker::new(), bind_groups: StatelessTracker::new(), compute_pipelines: StatelessTracker::new(), diff --git a/wgpu-core/src/track/ray_tracing.rs b/wgpu-core/src/track/ray_tracing.rs deleted file mode 100644 index dbe842bd9a..0000000000 --- a/wgpu-core/src/track/ray_tracing.rs +++ /dev/null @@ -1,75 +0,0 @@ -use crate::resource::AccelerationStructure; -use crate::track::metadata::ResourceMetadata; -use crate::track::ResourceUses; -use hal::AccelerationStructureUses; -use std::sync::Arc; -use wgt::strict_assert; - -pub(crate) struct AccelerationStructureTracker { - start: Vec, - end: Vec, - - metadata: ResourceMetadata>, -} - -impl AccelerationStructureTracker { - pub fn new() -> Self { - Self { - start: Vec::new(), - end: Vec::new(), - - metadata: ResourceMetadata::new(), - } - } - - fn tracker_assert_in_bounds(&self, index: usize) { - strict_assert!(index < self.start.len()); - strict_assert!(index < self.end.len()); - self.metadata.tracker_assert_in_bounds(index); - } - - /// Sets the size of all the vectors inside the tracker. - /// - /// Must be called with the highest possible Buffer ID before - /// all unsafe functions are called. - pub fn set_size(&mut self, size: usize) { - self.start.resize(size, AccelerationStructureUses::empty()); - self.end.resize(size, AccelerationStructureUses::empty()); - - self.metadata.set_size(size); - } - - /// Extend the vectors to let the given index be valid. - fn allow_index(&mut self, index: usize) { - if index >= self.start.len() { - self.set_size(index + 1); - } - } - - /// Inserts a single resource into the resource tracker. - pub fn set_single(&mut self, resource: Arc) { - let index: usize = resource.tracker_index().as_usize(); - - self.allow_index(index); - - self.tracker_assert_in_bounds(index); - } -} - -impl ResourceUses for AccelerationStructureUses { - const EXCLUSIVE: Self = Self::empty(); - - type Selector = (); - - fn bits(self) -> u16 { - Self::bits(&self) as u16 - } - - fn all_ordered(self) -> bool { - true - } - - fn any_exclusive(self) -> bool { - self.intersects(Self::EXCLUSIVE) - } -}