refactor: Deprecating cache layout for now

This commit is contained in:
2026-11-22 16:58:05 +01:00
parent 42f85757d5
commit 34e5215001
14 changed files with 165 additions and 222 deletions
-50
View File
@@ -1,50 +0,0 @@
use crate::gi_pipeline::sparse_set::GpuSparseSet;
use vxls_voxel_cache::VoxelCache;
use vxls_voxel_cache::{self};
mod sparse_set;
pub struct VoxelGiPipeline<const N: usize>
where
[(); N * N * N]:,
{
voxel_cache: VoxelCache<N>,
/// Keeps a set of the leaves present in the cache.
/// Kept in correspondancy with the leaf list attribute within the cache
leaf_list: GpuSparseSet,
leaf_list_attribute: usize,
}
impl<const N: usize> VoxelGiPipeline<N>
where
[(); N * N * N]:,
{
pub fn new(
device: &wgpu::Device,
cache_size: usize,
max_requests: usize,
cache_layout: &mut vxls_voxel_cache::CacheLayout,
) -> Self
{
let leaf_list_attribute = cache_layout.add_attribute(vxls_voxel_cache::CacheAttribute {
label: Some("VoxelGiPipeline::leaf_list_pointer"),
word_count: 1,
init: vxls_voxel_cache::CacheAttributeInit::External,
});
cache_layout.add_attribute(vxls_voxel_cache::CacheAttribute {
label: Some("VoxelGiPipeline::radiance"),
word_count: 3,
init: vxls_voxel_cache::CacheAttributeInit::DontTouch,
});
let voxel_cache = VoxelCache::new(device, cache_size, max_requests, cache_layout);
Self {
voxel_cache,
leaf_list: GpuSparseSet::new(device, cache_size),
leaf_list_attribute,
}
}
}
-15
View File
@@ -1,15 +0,0 @@
// Contains useful facilities to render data streamed in from the host
// Can produce a voxel given
// - Its depth
// - Its position within the chunk
// - The chunks position
pub trait ChunkVoxelProducer
{
fn produce_voxel(
&mut self,
depth: usize,
chunk_position: (usize, usize, usize),
voxel_position: (usize, usize, usize),
);
}
+2 -6
View File
@@ -83,7 +83,6 @@ use vxls_profiler::Frame;
use vxls_profiler::Profile;
use vxls_profiler::ProfilingEncoder;
use vxls_terrain::ToroidalStructureTable;
use vxls_voxel_cache::CacheLayout;
use vxls_voxel_cache::VoxelCache;
use vxls_voxel_cache::VoxelCacheInsertion;
use vxls_voxel_cache::insertion::CacheInsertionData;
@@ -95,7 +94,6 @@ use vxls_voxel_cache::tables::FixedStructureTable;
mod camera;
mod egui_renderer;
mod gi_pipeline;
mod producers;
mod sparse_tree;
@@ -377,7 +375,7 @@ impl State
*/
// Load dragon ply
let tree: NTree<4> = load_ply("dragon.txt");
let tree: NTree<4> = load_ply("../../dragon.txt");
// let mut arrays = vec![Color(0., 0., 0., 0.); 256 * 256 * 256];
// for ((x, y), z) in (0..256).cartesian_product(0..256).cartesian_product(0..256)
// {
@@ -397,9 +395,7 @@ impl State
let egui_renderer = EguiRenderer::new(&device, surface_format, &window);
let layout =
CacheLayout::from_attributes(&crate::producers::VoxelAttributes::LAYOUT, &[]);
let layout = crate::producers::VoxelAttributes::LAYOUT;
let request_buffer = CacheRequestBuffer::new(&device, 1024);
let voxel_cache =
VoxelCache::<4>::new(&device, 150_000, request_buffer.max_requests, &layout);