Revamped shader arch

This commit is contained in:
2026-11-05 16:49:25 +01:00
parent f8671bd35f
commit 9bd2cd5667
20 changed files with 593 additions and 705 deletions
+1 -1
View File
@@ -136,7 +136,7 @@ impl NonZeroBufferCompactor
wgpu::ShaderModuleDescriptor {
label: Some("compaction_shader_layout"),
source: wgpu::ShaderSource::SpirV(wgpu::__macro_helpers::Cow::Borrowed(
wgpu::include_spirv_source!("../../shaders/compaction.spv"),
wgpu::include_spirv_source!("../../shaders/out/compaction.spv"),
)),
},
wgpu::ShaderRuntimeChecks {
+1 -1
View File
@@ -225,7 +225,7 @@ impl RadixSorter
});
let radix_sort_shader_module =
device.create_shader_module(include_spirv!("../../shaders/radix_sort.spv"));
device.create_shader_module(include_spirv!("../../shaders/out/radix_sort.spv"));
let compilation_options = wgpu::PipelineCompilationOptions {
zero_initialize_workgroup_memory: false,
+3 -3
View File
@@ -360,7 +360,7 @@ impl State
init: voxel_cache::CacheAttributeInit::External,
});
let voxel_cache = VoxelCache::<4>::new(&device, 50_000, &layout);
let voxel_cache = VoxelCache::<4>::new(&device, 150_000, &layout);
let request_buffer = CacheRequestBuffer::new(&device, 1024);
let insertion_data = CacheInsertionData::new(&device, 1024, &layout);
@@ -467,7 +467,7 @@ impl State
wgpu::ShaderModuleDescriptorPassthrough {
label: wgpu::__macro_helpers::Some("../shaders/voxel.spv"),
spirv: Some(std::borrow::Cow::Borrowed(wgpu::include_spirv_source!(
"../shaders/voxel.spv"
"../shaders/out/voxel.spv"
))),
entry_points: std::borrow::Cow::Borrowed(&[
wgpu::PassthroughShaderEntryPoint {
@@ -490,7 +490,7 @@ impl State
wgpu::ShaderModuleDescriptorPassthrough {
label: wgpu::__macro_helpers::Some("../shaders/gi.spv"),
spirv: Some(std::borrow::Cow::Borrowed(wgpu::include_spirv_source!(
"../shaders/gi.spv"
"../shaders/out/gi.spv"
))),
entry_points: std::borrow::Cow::Borrowed(&[
wgpu::PassthroughShaderEntryPoint {
+21 -21
View File
@@ -315,23 +315,9 @@ where
},
count: None,
},
// Attributes
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStages::COMPUTE,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Storage { read_only: false },
has_dynamic_offset: false,
min_binding_size: None,
},
count: Some(
NonZero::new(attribute_count as u32)
.expect("Null amount of cache attributes."),
),
},
// Request pages
wgpu::BindGroupLayoutEntry {
binding: 2,
binding: 1,
visibility: wgpu::ShaderStages::COMPUTE,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Storage { read_only: false },
@@ -342,7 +328,7 @@ where
},
// Usage pages
wgpu::BindGroupLayoutEntry {
binding: 3,
binding: 2,
visibility: wgpu::ShaderStages::COMPUTE,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Storage { read_only: false },
@@ -351,6 +337,20 @@ where
},
count: None,
},
// Attributes
wgpu::BindGroupLayoutEntry {
binding: 3,
visibility: wgpu::ShaderStages::COMPUTE,
ty: wgpu::BindingType::Buffer {
ty: wgpu::BufferBindingType::Storage { read_only: false },
has_dynamic_offset: false,
min_binding_size: None,
},
count: Some(
NonZero::new(attribute_count as u32)
.expect("Null amount of cache attributes."),
),
},
],
});
@@ -369,16 +369,16 @@ where
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::BufferArray(&attributes_bindings),
},
wgpu::BindGroupEntry {
binding: 2,
resource: request_handler.request_pages_buffer().as_entire_binding(),
},
wgpu::BindGroupEntry {
binding: 3,
binding: 2,
resource: evictor.timestamp_pages_buffer().as_entire_binding(),
},
wgpu::BindGroupEntry {
binding: 3,
resource: wgpu::BindingResource::BufferArray(&attributes_bindings),
},
],
});