StructureID separate from chunk 'anchor'

This commit is contained in:
2026-11-09 11:44:13 +01:00
parent e855ccd904
commit b6f4a9c432
19 changed files with 944 additions and 136 deletions
+15 -6
View File
@@ -397,9 +397,18 @@ Structure-table shaders use a simpler concatenation:
`common.wgsl` + pass file.
`common.wgsl` starts with `enable wgpu_binding_array;` and defines the shared
`CacheIndex`, `RequestInformation`, `RequestMeta`, `InsertionParent`,
`AttributeArray`, `LocationPage`, and child-pointer helpers so the Rust and WGSL
sides share names.
`CacheIndex`, `StructureAnchor`/`anchor_eq`, `RequestInformation`, `RequestMeta`,
`InsertionParent`, `AttributeArray`, `LocationPage`, and child-pointer helpers so
the Rust and WGSL sides share names. The wire structs carry the anchor and the
external table slot; see [`voxel-cache.md`](./voxel-cache.md#22-location-page).
Structure-table shaders that emit requests or validate/insert roots bind a third
group:
- group 0 — table pointers, or request handler;
- group 1 — request buffer, or insertion data;
- group 2 — slot metadata: binding 0 `fixed_table_anchors`,
binding 1 `fixed_table_structure_ids`.
### 9.2 WGSL modules and entry points
@@ -412,9 +421,9 @@ sides share names.
| `shaders/invalidation.wgsl` | `invalidation` | Clear cache pointers that reference pages recycled this insert. |
| `shaders/write_pointers.wgsl` | `write_pointers` | Link internal insertion results into parent pages using the batch's `InsertionParent`. |
| `shaders/eviction.wgsl` | `reset_lru_list`, `indirect_copy` | Build the eviction candidate list: descending depth sort, then gather timestamps for the stable timestamp sort. |
| `fixed_table/write_requests.wgsl` | `write_requests` | Emit root requests for table slots. |
| `fixed_table/validate_insertion.wgsl` | `validate_external` | Keep only root entries whose slot still waits for a page. |
| `fixed_table/insertion.wgsl` | `insertion` | Point table slots at inserted root pages. |
| `fixed_table/write_requests.wgsl` | `write_requests` | Emit root requests for table slots, resolving the slot's current structure id and anchor. |
| `fixed_table/validate_insertion.wgsl` | `validate_external` | Keep only root entries whose named slot still carries the same anchor/id and waits for a page. |
| `fixed_table/insertion.wgsl` | `insertion` | Re-check anchor/id/slot, then point the table slot at the inserted root page. |
| `fixed_table/invalidation.wgsl` | `invalidation` | Clear table slots pointing at recycled pages. |
| `terrain/shaders/toroidal_structure.wgsl` | `invalidate_new` | Reset table slots whose world position changed. |