chore: Removing warnings in all but main playground crate
This commit is contained in:
@@ -2,18 +2,16 @@
|
||||
use wgpu::BindGroup;
|
||||
use wgpu::BindGroupLayout;
|
||||
use wgpu::CommandEncoder;
|
||||
use wgpu::ComputePipeline;
|
||||
use wgpu::include_wgsl;
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
use crate::CacheRessources;
|
||||
use crate::create_multi_buffers_bind_group_layout;
|
||||
use crate::structure::CacheStructure;
|
||||
use vxls_gpu::create_multi_buffers_bind_group;
|
||||
use vxls_gpu::radix_sort;
|
||||
use vxls_profiler::ScopeEncoder;
|
||||
use vxls_profiler::memory_profiler;
|
||||
use vxls_profiler::{self};
|
||||
use crate::CacheRessources;
|
||||
use crate::create_multi_buffers_bind_group_layout;
|
||||
use crate::structure::CacheStructure;
|
||||
|
||||
/// Retains usage information about pages in the cache under the form of timestamps.
|
||||
/// Produces an eviction order from which the cache can pull pages to recycle.
|
||||
@@ -34,6 +32,7 @@ pub struct CacheEvictor
|
||||
lru_list: wgpu::Buffer,
|
||||
|
||||
/// When reusing pages, count of lru pages consumed
|
||||
#[allow(unused)]
|
||||
consumed_count: wgpu::Buffer,
|
||||
|
||||
/// To reset lru indices between insertions
|
||||
@@ -44,6 +43,7 @@ pub struct CacheEvictor
|
||||
pipelines_dispatch_count: u32,
|
||||
|
||||
// For external passes
|
||||
#[allow(unused)]
|
||||
bind_group_layout: BindGroupLayout,
|
||||
bind_group: BindGroup,
|
||||
}
|
||||
@@ -128,7 +128,7 @@ impl CacheEvictor
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prepare_eviction_list<const N: usize>(
|
||||
pub(crate) fn prepare_eviction_list<const N: usize>(
|
||||
&self,
|
||||
device: &wgpu::Device,
|
||||
ressources: &CacheRessources<N>,
|
||||
|
||||
@@ -47,6 +47,7 @@ where
|
||||
/// Amount of entries written to [`Self::valid_indices`]
|
||||
valid_count: wgpu::Buffer,
|
||||
|
||||
#[allow(unused)]
|
||||
bind_group_layout: wgpu::BindGroupLayout,
|
||||
bind_group: wgpu::BindGroup,
|
||||
bind_group_no_attributes: wgpu::BindGroup,
|
||||
@@ -119,7 +120,7 @@ pub fn validate_voxel_count(
|
||||
capacity: usize,
|
||||
) -> Result<(), AttributeUploadError>
|
||||
{
|
||||
if voxel_count % children != 0
|
||||
if !voxel_count.is_multiple_of(children)
|
||||
{
|
||||
return Err(AttributeUploadError::NotWholePages {
|
||||
voxel_count,
|
||||
@@ -563,11 +564,6 @@ mod tests
|
||||
}
|
||||
}
|
||||
|
||||
fn cache_layout() -> CacheLayout
|
||||
{
|
||||
CacheLayout::from_attributes(&TestAttributes::LAYOUT, &[])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_attribute_bytes_orders_by_voxel()
|
||||
{
|
||||
@@ -597,77 +593,6 @@ mod tests
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn matching_layout_passes_validation()
|
||||
{
|
||||
assert_eq!(
|
||||
validate_attribute_layout::<TestAttributes>(&cache_layout()),
|
||||
Ok(())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validation_rejects_word_count_mismatch()
|
||||
{
|
||||
let mut layout = CacheLayout::default();
|
||||
layout.add_attribute(CacheAttribute {
|
||||
label: Some("color"),
|
||||
word_count: 2,
|
||||
init: CacheAttributeInit::External,
|
||||
});
|
||||
layout.add_attribute(CacheAttribute {
|
||||
label: Some("normal"),
|
||||
word_count: 3,
|
||||
init: CacheAttributeInit::External,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
validate_attribute_layout::<TestAttributes>(&layout),
|
||||
Err(AttributeUploadError::WordCountMismatch {
|
||||
index: 0,
|
||||
producer: 1,
|
||||
cache: 2,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validation_rejects_non_external_attributes()
|
||||
{
|
||||
let mut layout = CacheLayout::default();
|
||||
layout.add_attribute(CacheAttribute {
|
||||
label: Some("color"),
|
||||
word_count: 1,
|
||||
init: CacheAttributeInit::DontTouch,
|
||||
});
|
||||
layout.add_attribute(CacheAttribute {
|
||||
label: Some("normal"),
|
||||
word_count: 3,
|
||||
init: CacheAttributeInit::External,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
validate_attribute_layout::<TestAttributes>(&layout),
|
||||
Err(AttributeUploadError::NotExternal { index: 0 })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn validation_rejects_missing_attributes()
|
||||
{
|
||||
let mut layout = CacheLayout::default();
|
||||
layout.add_attribute(CacheAttribute {
|
||||
label: Some("color"),
|
||||
word_count: 1,
|
||||
init: CacheAttributeInit::External,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
validate_attribute_layout::<TestAttributes>(&layout),
|
||||
Err(AttributeUploadError::MissingCacheAttribute { index: 1 })
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn voxel_counts_must_be_whole_pages_within_capacity()
|
||||
{
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
//! Depracted for now, DontTouch attributes will be re-added later
|
||||
//! when necessary as another bunch of attributes, which allows cleaner separation
|
||||
/*
|
||||
use vxls_attributes::AttributesLayout;
|
||||
use vxls_profiler::memory_profiler;
|
||||
|
||||
/// Defines how a [`VoxelCache`]'s attribute is populated upon populating a page
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum CacheAttributeInit
|
||||
{
|
||||
/// Attribute is external : it is copied from the insertion operation
|
||||
External,
|
||||
|
||||
/// Attribute will not be touched by the cache mechanism. It is left to the discrecy of the
|
||||
/// cache user.
|
||||
///
|
||||
/// Some applications requires pieces of data into the resident data of the cache that are
|
||||
/// computed on the fly : e.g. global illumination
|
||||
DontTouch,
|
||||
}
|
||||
|
||||
/// Describes an attribute of a [`VoxelCache`]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct CacheAttribute
|
||||
{
|
||||
pub label: Option<&'static str>,
|
||||
pub word_count: u32,
|
||||
pub init: CacheAttributeInit,
|
||||
}
|
||||
|
||||
impl CacheAttribute
|
||||
{
|
||||
pub fn create_buffer_profiled(
|
||||
&self,
|
||||
device: &mut memory_profiler::Device,
|
||||
child_count: usize,
|
||||
page_count: usize,
|
||||
usage: wgpu::BufferUsages,
|
||||
) -> wgpu::Buffer
|
||||
{
|
||||
device.create_buffer(&wgpu::BufferDescriptor {
|
||||
label: Some(
|
||||
format!(
|
||||
"VoxelCacheAttribute ({}) {} word(s)",
|
||||
self.label.unwrap_or("no-name"),
|
||||
self.word_count
|
||||
)
|
||||
.as_str(),
|
||||
),
|
||||
size: (self.word_count as usize * page_count * child_count * size_of::<u32>()) as u64,
|
||||
usage,
|
||||
mapped_at_creation: false,
|
||||
})
|
||||
}
|
||||
|
||||
/// Creates the wgpu buffer necessary to store this attribute in the cache
|
||||
pub fn create_buffer(
|
||||
&self,
|
||||
device: &wgpu::Device,
|
||||
child_count: usize,
|
||||
page_count: usize,
|
||||
usage: wgpu::BufferUsages,
|
||||
) -> wgpu::Buffer
|
||||
{
|
||||
device.create_buffer(&wgpu::BufferDescriptor {
|
||||
label: Some(
|
||||
format!(
|
||||
"VoxelCacheAttribute ({}) {} word(s)",
|
||||
self.label.unwrap_or("no-name"),
|
||||
self.word_count
|
||||
)
|
||||
.as_str(),
|
||||
),
|
||||
size: (self.word_count as usize * page_count * child_count * size_of::<u32>()) as u64,
|
||||
usage,
|
||||
mapped_at_creation: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct CacheLayout
|
||||
{
|
||||
pub(super) attributes: Vec<CacheAttribute>,
|
||||
}
|
||||
|
||||
impl CacheLayout
|
||||
{
|
||||
/// Adds a new [`VoxelCacheAttribute`] in the layout
|
||||
///
|
||||
/// Attributes are added starting from 0 counting up
|
||||
///
|
||||
/// Returns the index of the new added attirbute
|
||||
pub fn add_attribute(&mut self, attribute: CacheAttribute) -> usize
|
||||
{
|
||||
let index = self.attributes.len();
|
||||
self.attributes.push(attribute);
|
||||
index
|
||||
}
|
||||
|
||||
/// Builds a cache layout from producer attributes followed by `extra`.
|
||||
///
|
||||
/// Every attribute of `layout` is inserted from the producer and is
|
||||
/// therefore [`CacheAttributeInit::External`]. `extra` attributes are
|
||||
/// appended after them and are meant for GPU-only data
|
||||
/// ([`CacheAttributeInit::DontTouch`]), which producers never fill.
|
||||
pub fn from_attributes(layout: &AttributesLayout, extra: &[CacheAttribute]) -> Self
|
||||
{
|
||||
let mut cache_layout = Self::default();
|
||||
|
||||
for attribute in layout.attributes
|
||||
{
|
||||
cache_layout.add_attribute(CacheAttribute {
|
||||
label: Some(attribute.label),
|
||||
word_count: attribute.word_count,
|
||||
init: CacheAttributeInit::External,
|
||||
});
|
||||
}
|
||||
|
||||
for attribute in extra
|
||||
{
|
||||
cache_layout.add_attribute(*attribute);
|
||||
}
|
||||
|
||||
cache_layout
|
||||
}
|
||||
|
||||
/// The attributes of this layout, in binding order
|
||||
pub fn attributes(&self) -> &[CacheAttribute]
|
||||
{
|
||||
&self.attributes
|
||||
}
|
||||
|
||||
/// Produces a wgsl declaration describing this layout :
|
||||
///
|
||||
/// ```wgsl
|
||||
///
|
||||
/// const ATTRIBUTE_COUNT: u32 = /* attribute count */;
|
||||
/// const ATTRIBUTE_WORD_COUNTS: array<u32, ...> = {
|
||||
/// /* word count for attribute 0 */,
|
||||
/// /* word count for attribute 1 */,
|
||||
/// ...
|
||||
/// };
|
||||
///
|
||||
/// const ATTRIBUTE_COPY: array<bool, ...> = {
|
||||
/// /* external? for attribute 0 */,
|
||||
/// /* external? for attribute 1 */,
|
||||
/// ...
|
||||
/// };
|
||||
///
|
||||
/// ```
|
||||
pub fn wgsl_layout_decl(&self) -> String
|
||||
{
|
||||
let mut decl = String::new();
|
||||
|
||||
decl += &format!("const ATTRIBUTE_COUNT: u32 = {};", self.attributes.len());
|
||||
|
||||
// Word counts
|
||||
decl += &format!(
|
||||
"const ATTRIBUTE_WORD_COUNTS: array<u32, {}> = array<u32, {}>(",
|
||||
self.attributes.len(),
|
||||
self.attributes.len()
|
||||
);
|
||||
|
||||
for attribute in self.attributes.iter()
|
||||
{
|
||||
decl += &format!(" {},", attribute.word_count);
|
||||
}
|
||||
|
||||
decl += ");";
|
||||
|
||||
// Copy
|
||||
decl += &format!(
|
||||
"const ATTRIBUTE_COPY: array<bool, {}> = array<bool, {}>(",
|
||||
self.attributes.len(),
|
||||
self.attributes.len()
|
||||
);
|
||||
|
||||
for attribute in self.attributes.iter()
|
||||
{
|
||||
decl += &format!(" {},", attribute.init == CacheAttributeInit::External);
|
||||
}
|
||||
|
||||
decl += ");";
|
||||
|
||||
decl
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -9,6 +9,11 @@ use wgpu::Device;
|
||||
use wgpu::include_wgsl;
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
use crate::CacheRessources;
|
||||
use crate::create_multi_buffers_bg_bg_layout;
|
||||
use crate::create_multi_buffers_bind_group_layout;
|
||||
use crate::schema::RequestInformation;
|
||||
use crate::schema::RequestMeta;
|
||||
use vxls_gpu::create_multi_buffers_bind_group;
|
||||
use vxls_gpu::indirect_buffer::IndirectBuffer1D;
|
||||
use vxls_gpu::radix_sort::{self};
|
||||
@@ -16,11 +21,6 @@ use vxls_gpu::top_k::TopKSelector;
|
||||
use vxls_profiler::ScopeEncoder;
|
||||
use vxls_profiler::memory_profiler;
|
||||
use vxls_profiler::{self};
|
||||
use crate::CacheRessources;
|
||||
use crate::create_multi_buffers_bg_bg_layout;
|
||||
use crate::create_multi_buffers_bind_group_layout;
|
||||
use crate::schema::RequestInformation;
|
||||
use crate::schema::RequestMeta;
|
||||
|
||||
/// Records, handles, and produces a list of requested data inside the cache
|
||||
pub struct CacheRequestHandler<const N: usize>
|
||||
@@ -52,6 +52,7 @@ pub struct CacheRequestHandler<const N: usize>
|
||||
reset_pass_dispatch: u32,
|
||||
|
||||
// External bind group
|
||||
#[allow(unused)]
|
||||
bind_group_layout: BindGroupLayout,
|
||||
bind_group: BindGroup,
|
||||
}
|
||||
@@ -70,6 +71,7 @@ pub struct CacheRequestBuffer
|
||||
/// Buffer containing the meta information about the requests, a dense array of [`voxel_cache::schema::RequestMeta`]
|
||||
request_meta: wgpu::Buffer,
|
||||
|
||||
#[allow(unused)]
|
||||
bind_group_layout: wgpu::BindGroupLayout,
|
||||
bind_group: wgpu::BindGroup,
|
||||
}
|
||||
@@ -203,7 +205,7 @@ impl<const N: usize> CacheRequestHandler<N>
|
||||
/// Uses both the sorter and the scratch buffer in the ressources
|
||||
///
|
||||
/// The `request_count` buffer will contain the amount of request produced this time.
|
||||
pub fn sort_requests(
|
||||
pub(crate) fn sort_requests(
|
||||
&self,
|
||||
device: &wgpu::Device,
|
||||
ressources: &CacheRessources<N>,
|
||||
@@ -443,8 +445,7 @@ impl CacheRequestBuffer
|
||||
&self.request_meta.slice(..),
|
||||
move |buffer| {
|
||||
let mapped_buffer = buffer.expect("Could not map request buffer (meta).");
|
||||
let request_metas: Vec<RequestMeta> =
|
||||
bytemuck::pod_collect_to_vec(&mapped_buffer);
|
||||
let request_metas: Vec<RequestMeta> = bytemuck::pod_collect_to_vec(&mapped_buffer);
|
||||
|
||||
request_map_state_3
|
||||
.lock()
|
||||
@@ -477,11 +478,8 @@ impl<F: FnMut(&[RequestInformation], &[RequestMeta]) + Send + Sync + 'static> Re
|
||||
|
||||
fn try_callback(&mut self)
|
||||
{
|
||||
if let (Some(request_count), Some(request_infos), Some(request_metas)) = (
|
||||
self.request_count,
|
||||
&self.request_infos,
|
||||
&self.request_metas,
|
||||
)
|
||||
if let (Some(request_count), Some(request_infos), Some(request_metas)) =
|
||||
(self.request_count, &self.request_infos, &self.request_metas)
|
||||
{
|
||||
(self.callback)(
|
||||
&request_infos[0..request_count],
|
||||
|
||||
@@ -3,11 +3,11 @@ use wgpu::BindGroupLayout;
|
||||
use wgpu::Buffer;
|
||||
use wgpu::BufferUsages;
|
||||
|
||||
use crate::schema::DepthPage;
|
||||
use crate::schema::StructurePage;
|
||||
use vxls_gpu::create_multi_buffers_bind_group;
|
||||
use vxls_gpu::create_multi_buffers_bind_group_layout;
|
||||
use vxls_profiler::memory_profiler;
|
||||
use crate::schema::DepthPage;
|
||||
use crate::schema::StructurePage;
|
||||
|
||||
/// Contains the instanciated buffers relevant to the structure of the trees
|
||||
pub struct CacheStructure<const N: usize>
|
||||
@@ -15,6 +15,7 @@ where
|
||||
[(); N * N * N]:,
|
||||
{
|
||||
pointer_pages: Buffer,
|
||||
#[allow(unused)]
|
||||
location_pages: Buffer,
|
||||
depth_pages: Buffer,
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
//! Cache keeps pages from different structures within itself.
|
||||
//! Pages are pieces of structure pointing to each other. But, in order to start tracing inside the
|
||||
//! voxels, we must enter the cache from somewhere
|
||||
//!
|
||||
//! The structure table is a structure that keeps information about where to find the root node
|
||||
//! inside the cache, or if it is not preset, emit requests.
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
use vxls_gpu::create_multi_buffers_bind_group;
|
||||
use vxls_gpu::indirect_buffer::IndirectBuffer1D;
|
||||
use vxls_profiler::ScopeEncoder;
|
||||
use vxls_profiler::memory_profiler::MemoryProfile;
|
||||
use crate::CacheInvalidable;
|
||||
use crate::CacheRessources;
|
||||
use crate::create_multi_buffers_bg_bg_layout;
|
||||
@@ -15,14 +18,10 @@ use crate::requests::CacheRequestBuffer;
|
||||
use crate::requests::CacheRequestHandler;
|
||||
use crate::schema::CachePointer;
|
||||
use crate::schema::StructureAnchor;
|
||||
|
||||
/// Cache keeps pages from different structures within itself.
|
||||
/// Pages are pieces of structure pointing to each other. But, in order to start tracing inside the
|
||||
/// voxels, we must enter the cache from somewhere
|
||||
///
|
||||
/// The structure table is a structure that keeps information about where to find the root node
|
||||
/// inside the cache, or if it is not preset, emit requests.
|
||||
///
|
||||
use vxls_gpu::create_multi_buffers_bind_group;
|
||||
use vxls_gpu::indirect_buffer::IndirectBuffer1D;
|
||||
use vxls_profiler::ScopeEncoder;
|
||||
use vxls_profiler::memory_profiler::MemoryProfile;
|
||||
|
||||
macro_rules! include_table_wgsl {
|
||||
($path:literal) => {{
|
||||
@@ -265,12 +264,11 @@ impl StructureTableCore
|
||||
contents: bytemuck::cast_slice(initial_pointers),
|
||||
});
|
||||
|
||||
let (metadata_bind_group_layout, metadata_bind_group) =
|
||||
create_multi_buffers_bg_bg_layout(
|
||||
device,
|
||||
&[&anchors_buffer],
|
||||
Some("StructureTableCore::metadata"),
|
||||
);
|
||||
let (metadata_bind_group_layout, metadata_bind_group) = create_multi_buffers_bg_bg_layout(
|
||||
device,
|
||||
&[&anchors_buffer],
|
||||
Some("StructureTableCore::metadata"),
|
||||
);
|
||||
|
||||
let (pointers_bind_group_layout, pointers_bind_group) = create_multi_buffers_bg_bg_layout(
|
||||
device,
|
||||
@@ -714,12 +712,7 @@ impl FixedStructureTable
|
||||
/// Retained for callers that do not move slots; [`Self::new_with_anchors`]
|
||||
/// is the general constructor.
|
||||
#[allow(dead_code)]
|
||||
pub fn new(
|
||||
device: &wgpu::Device,
|
||||
size: usize,
|
||||
max_requests: usize,
|
||||
producer_id: u32,
|
||||
) -> Self
|
||||
pub fn new(device: &wgpu::Device, size: usize, max_requests: usize, producer_id: u32) -> Self
|
||||
{
|
||||
let anchors = (0..size)
|
||||
.map(|slot| StructureAnchor {
|
||||
@@ -741,9 +734,8 @@ impl FixedStructureTable
|
||||
assert_eq!(anchors.len(), size);
|
||||
|
||||
let pointers = vec![CachePointer::new(Some(None)); size];
|
||||
let core = StructureTableCore::new(
|
||||
device, size, max_requests, producer_id, &anchors, &pointers,
|
||||
);
|
||||
let core =
|
||||
StructureTableCore::new(device, size, max_requests, producer_id, &anchors, &pointers);
|
||||
|
||||
Self {
|
||||
core,
|
||||
@@ -767,6 +759,7 @@ impl FixedStructureTable
|
||||
|
||||
let retired = retired_anchors(&self.slot_anchors, new_anchors);
|
||||
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for slot in 0..self.core.size
|
||||
{
|
||||
let anchor = new_anchors[slot];
|
||||
@@ -876,7 +869,12 @@ impl DynamicStructureTable
|
||||
let anchors = vec![StructureAnchor::ZERO; capacity];
|
||||
let pointers = vec![CachePointer::new(None); capacity];
|
||||
let core = StructureTableCore::new(
|
||||
device, capacity, max_requests, producer_id, &anchors, &pointers,
|
||||
device,
|
||||
capacity,
|
||||
max_requests,
|
||||
producer_id,
|
||||
&anchors,
|
||||
&pointers,
|
||||
);
|
||||
|
||||
Self {
|
||||
@@ -922,12 +920,7 @@ impl DynamicStructureTable
|
||||
///
|
||||
/// Capacity doubles from the current value until it reaches `min_capacity`.
|
||||
/// Must be called between frames.
|
||||
pub fn reserve(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
queue: &wgpu::Queue,
|
||||
min_capacity: usize,
|
||||
)
|
||||
pub fn reserve(&mut self, device: &wgpu::Device, queue: &wgpu::Queue, min_capacity: usize)
|
||||
{
|
||||
assert!(
|
||||
min_capacity <= u32::MAX as usize,
|
||||
@@ -1058,6 +1051,58 @@ impl DynamicStructureTable
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> CacheInvalidable<N> for FixedStructureTable
|
||||
where
|
||||
[(); N * N * N]:,
|
||||
{
|
||||
fn validate_insertion(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
insertion: &CacheInsertionData<N>,
|
||||
)
|
||||
{
|
||||
self.core.validate_insertion(device, encoder, insertion);
|
||||
}
|
||||
|
||||
fn invalidate(
|
||||
&mut self,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
cache_evictor: &CacheEvictor,
|
||||
invalid_timestamp: u32,
|
||||
)
|
||||
{
|
||||
self.core
|
||||
.invalidate(encoder, cache_evictor, invalid_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> CacheInvalidable<N> for DynamicStructureTable
|
||||
where
|
||||
[(); N * N * N]:,
|
||||
{
|
||||
fn validate_insertion(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
insertion: &CacheInsertionData<N>,
|
||||
)
|
||||
{
|
||||
self.core.validate_insertion(device, encoder, insertion);
|
||||
}
|
||||
|
||||
fn invalidate(
|
||||
&mut self,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
cache_evictor: &CacheEvictor,
|
||||
invalid_timestamp: u32,
|
||||
)
|
||||
{
|
||||
self.core
|
||||
.invalidate(encoder, cache_evictor, invalid_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests
|
||||
{
|
||||
@@ -1190,51 +1235,3 @@ mod tests
|
||||
assert_eq!(allocator.allocate(anchor(4)), None);
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> CacheInvalidable<N> for FixedStructureTable
|
||||
where
|
||||
[(); N * N * N]:,
|
||||
{
|
||||
fn validate_insertion(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
insertion: &CacheInsertionData<N>,
|
||||
) {
|
||||
self.core.validate_insertion(device, encoder, insertion);
|
||||
}
|
||||
|
||||
fn invalidate(
|
||||
&mut self,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
cache_evictor: &CacheEvictor,
|
||||
invalid_timestamp: u32,
|
||||
)
|
||||
{
|
||||
self.core.invalidate(encoder, cache_evictor, invalid_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
impl<const N: usize> CacheInvalidable<N> for DynamicStructureTable
|
||||
where
|
||||
[(); N * N * N]:,
|
||||
{
|
||||
fn validate_insertion(
|
||||
&mut self,
|
||||
device: &wgpu::Device,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
insertion: &CacheInsertionData<N>,
|
||||
) {
|
||||
self.core.validate_insertion(device, encoder, insertion);
|
||||
}
|
||||
|
||||
fn invalidate(
|
||||
&mut self,
|
||||
encoder: &mut ScopeEncoder<wgpu::CommandEncoder>,
|
||||
cache_evictor: &CacheEvictor,
|
||||
invalid_timestamp: u32,
|
||||
)
|
||||
{
|
||||
self.core.invalidate(encoder, cache_evictor, invalid_timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user