diff --git a/shaders/compaction.spv b/shaders/compaction.spv index 1e30405..b4fd7ee 100644 Binary files a/shaders/compaction.spv and b/shaders/compaction.spv differ diff --git a/shaders/gi.spv b/shaders/gi.spv index 4b93ff2..aa8c41e 100644 Binary files a/shaders/gi.spv and b/shaders/gi.spv differ diff --git a/shaders/radix_reduce.spv b/shaders/radix_reduce.spv index d9d8040..85fc112 100644 Binary files a/shaders/radix_reduce.spv and b/shaders/radix_reduce.spv differ diff --git a/shaders/radix_sort.spv b/shaders/radix_sort.spv index b662222..72cf267 100644 Binary files a/shaders/radix_sort.spv and b/shaders/radix_sort.spv differ diff --git a/shaders/voxel.spv b/shaders/voxel.spv index 3cff6c3..bb83279 100644 Binary files a/shaders/voxel.spv and b/shaders/voxel.spv differ diff --git a/shaders/voxel_tracing.slang b/shaders/voxel_tracing.slang new file mode 100644 index 0000000..1619385 --- /dev/null +++ b/shaders/voxel_tracing.slang @@ -0,0 +1,54 @@ +struct Ray +{ + float3 origin; + float3 direction; + float3 invDirection; +} + +struct Span +{ + float t0; + float t1; +} + +struct Cell +{ + /// Entry pointer into the cache + uint32_t cache_pointer; // entry into the cache + + /// Ray to be traced inside the cache + Ray local_ray; +} + +interface IStructure +{ + /// A cursor structure to keep ray state + associatedtype Cursor; + + /// Begins tracing a certain ray, with a span + Cursor begin(Ray worldRay, Span s); + + /// Returns whether it hits, updating the state, and returning a cell structure if hit. + bool next(inout Cursor c, out Cell cell); // next populated cell along the ray +} + +interface ILodPolicy +{ + /// cone / pixel-footprint termination + bool shouldStop(float t, float nodeSize); +} + +interface IVoxelCache +{ + associatedtype Voxel; + bool trace(uint32_t root, Ray r, L lod, out float t, out Voxel v); +} + +struct Tracer +{ + S structure; + C cache; + + Hit trace(Ray r, Span s) { /* loop: next cell -> cache.trace -> early out */ } +} + diff --git a/src/main.rs b/src/main.rs index 82d2ae1..f804d01 100644 --- a/src/main.rs +++ b/src/main.rs @@ -360,7 +360,7 @@ impl State init: voxel_cache::CacheAttributeInit::External, }); - let voxel_cache = VoxelCache::<4>::new(&device, 200_000, &layout); + let voxel_cache = VoxelCache::<4>::new(&device, 50_000, &layout); let request_buffer = CacheRequestBuffer::new(&device, 1024); let insertion_data = CacheInsertionData::new(&device, 1024, &layout);