Spatial texture creation

This commit is contained in:
2026-10-20 21:13:28 +01:00
parent dcc59b04dd
commit 2c05cc28a0
10 changed files with 212 additions and 60 deletions
@@ -18,6 +18,7 @@ struct InstanceTapeIds {
aabb_buffer_id: u32,
aabb_buffer_offset: u32,
aabb_count: u32,
spatial_texture_id: u32,
metadata_buffer_id: u32,
metadata_buffer_offset: u32,
}
@@ -143,31 +144,29 @@ const LIGHT_NOT_PRESENT_THIS_FRAME = 0xFFFFFFFFu;
@group(0) @binding(0) var<storage> vertex_buffers: binding_array<VertexBuffer>;
@group(0) @binding(1) var<storage> index_buffers: binding_array<IndexBuffer>;
@group(0) @binding(2)
var<storage> aabb_buffers: binding_array<AabbBuffer>;
@group(0) @binding(3)
var<storage> tape_metadata_buffers: binding_array<TapeMetadataBuffer>;
@group(0) @binding(4) var textures: binding_array<texture_2d<f32>>;
@group(0) @binding(5) var samplers: binding_array<sampler>;
@group(0) @binding(6) var<storage> materials: array<Material>;
@group(0) @binding(7) var tlas: acceleration_structure;
@group(0) @binding(8) var previous_frame_tlas: acceleration_structure;
@group(0) @binding(9) var<storage> transforms: array<mat3x4<f32>>;
@group(0) @binding(10) var<storage> previous_frame_transforms: array<mat3x4<f32>>;
@group(0) @binding(11) var<storage> geometry_ids: array<InstanceGeometryIds>;
@group(0) @binding(12)
var<storage> tape_ids: array<InstanceTapeIds>;
@group(0) @binding(13) var<storage> material_ids: array<u32>;
@group(0) @binding(14) var brdf_dfg_lut: texture_2d<f32>;
@group(0) @binding(15) var brdf_dfg_lut_sampler: sampler;
@group(0) @binding(16) var<storage> light_sources: array<LightSource>;
@group(0) @binding(17) var<storage> directional_lights: array<DirectionalLight>;
@group(0) @binding(18) var<storage> point_lights: array<PointLight>;
@group(0) @binding(19) var<storage> rect_lights: array<RectLight>;
@group(0) @binding(20) var environment_map: texture_cube<f32>;
@group(0) @binding(21) var environment_map_sampler: sampler;
@group(0) @binding(22) var<storage> environment_map_light: EnvironmentMapLight;
@group(0) @binding(23) var<storage> previous_frame_light_id_translations: array<u32>;
@group(0) @binding(2) var<storage> aabb_buffers: binding_array<AabbBuffer>;
@group(0) @binding(3) var<storage> tape_metadata_buffers: binding_array<TapeMetadataBuffer>;
@group(0) @binding(4) var spatial_textures: binding_array<texture_3d<f32>>;
@group(0) @binding(5) var textures: binding_array<texture_2d<f32>>;
@group(0) @binding(6) var samplers: binding_array<sampler>;
@group(0) @binding(7) var<storage> materials: array<Material>;
@group(0) @binding(8) var tlas: acceleration_structure;
@group(0) @binding(9) var previous_frame_tlas: acceleration_structure;
@group(0) @binding(10) var<storage> transforms: array<mat3x4<f32>>;
@group(0) @binding(11) var<storage> previous_frame_transforms: array<mat3x4<f32>>;
@group(0) @binding(12) var<storage> geometry_ids: array<InstanceGeometryIds>;
@group(0) @binding(13) var<storage> tape_ids: array<InstanceTapeIds>;
@group(0) @binding(14) var<storage> material_ids: array<u32>;
@group(0) @binding(15) var brdf_dfg_lut: texture_2d<f32>;
@group(0) @binding(16) var brdf_dfg_lut_sampler: sampler;
@group(0) @binding(17) var<storage> light_sources: array<LightSource>;
@group(0) @binding(18) var<storage> directional_lights: array<DirectionalLight>;
@group(0) @binding(19) var<storage> point_lights: array<PointLight>;
@group(0) @binding(20) var<storage> rect_lights: array<RectLight>;
@group(0) @binding(21) var environment_map: texture_cube<f32>;
@group(0) @binding(22) var environment_map_sampler: sampler;
@group(0) @binding(23) var<storage> environment_map_light: EnvironmentMapLight;
@group(0) @binding(24) var<storage> previous_frame_light_id_translations: array<u32>;
const RAY_T_MIN = 0.001f;
const RAY_T_MAX = 100000.0f;