Skip to content

Stage 6.4b: probes, probe batches, baked reflection data and lookups - #40

Merged
razedproduction merged 1 commit into
masterfrom
stage-6.4b-probes
Oct 16, 2026
Merged

razedproduction merged 1 commit into
masterfrom
stage-6.4b-probes

Conversation

@razedproduction

Copy link
Copy Markdown
Owner

Stage 6.4b of docs/PORTING_PLAN.md: probes, probe generation, probe tree, probe batches, neighbourhoods and manager, baked reflection data and its lookups, with probe batch serialization.

What's ported

Upstream Rust
probe, probe_generator probes::Probe, probes::generate_probes (ProbeGeneration::Centroid, UniformFloor { spacing, height })
probe_tree (moved from stage 7: ProbeBatch::commit needs it) probes::ProbeTree, ProbeTreeNode
probe_batch, probe_batch.fbs probes::ProbeBatch (serialize / deserialize), ProbeNeighborhood
probe_manager probes::ProbeManager (Arc<ProbeBatch>)
probe_data, baked_reflection_data, baked_reflection_data.fbs baking::{BakedDataIdentifier, BakedData, BakedReflectionsData}
baked_reflection_simulator simulation::baked_reflection::{find_unique_probe_batches, lookup_energy_field, lookup_reverb}

Neighbourhood entries refer to batches by their index in the batch list instead of by pointer. The lookups take that list and the unique batches, so callers (and the tests) choose the order in which batches are summed. Upstream's order comes from an unordered_set of pointers, so it depends on addresses.

Parity

Every case below is bit-exact on Windows, in debug and in release, against tools/golden/src/probes.cpp. The test uses EXACT for indices and bytes and F32 for float results:

  • probe trees of 1–130 probes (with tied centers), and 64 queries per tree
  • centroid and uniform-floor generation (boxroom axis-aligned, simplescene rotated)
  • a manager holding [B0, B1, B0] queried at 48 points in boxroom: influencing probes, occlusion, weights, nearest probe, unique batches, and energy-field and reverb lookups for 3 identifiers
  • serialized batches, byte for byte, as built and after 6 rounds of changes; every golden batch deserializes and serializes back to the same bytes

No libm is involved, so other platforms should match too. Truncated and corrupted batches return errors and never panic.

Upstream quirks (R27) and deviations

  • Cross-batch lookup bug. Upstream looks up a probe from batch A in batch B's data by A's index when A lacks the layer. This reads out of bounds when the index is past B's probes, and it crashed the first generator draft. The goldens keep indices in range so the quirk can be compared; the port skips out-of-range indices.
  • Null energy-field offsets. A baked probe without a field is written as a null offset, which upstream's release build writes as ReferTo(0). The port writes the same bytes and reads them back as "no field".
  • Pathing layers. Baked pathing layers are rejected with MalformedSerializedData until stage 7.
  • The full lists are R27 in the plan and the 6.4b rows in DEVIATIONS.md.

Checks: cargo fmt --check, both clippy configurations and cargo test --all pass locally.

Ports probe, probe_generator, probe_tree (moved from stage 7: ProbeBatch::commit builds one), probe_batch,
probe_data, probe_manager, baked_reflection_data and baked_reflection_simulator, with the FlatBuffers schemas
probe_batch.fbs and baked_reflection_data.fbs.

- probes: Probe, ProbeTree, generate_probes (centroid, uniform floor), ProbeBatch (serialize/deserialize),
  ProbeNeighborhood (entries refer to batches by index in the batch list), ProbeManager (Arc<ProbeBatch>).
- baking: BakedDataIdentifier (ordered like upstream's operator<), BakedData enum, BakedReflectionsData.
- simulation::baked_reflection: find_unique_probe_batches, lookup_energy_field, lookup_reverb.
- serialization: int8 and struct fields, vectors of offsets with upstream's null offsets.

Bit-exact on Windows (debug and release) against tools/golden/src/probes.cpp: probe trees and queries, generated
probes, neighbourhoods (occlusion, weights, nearest), lookups, and serialized batches byte for byte across six
rounds of changes. Upstream quirks kept: R27. A probe index past another batch's data, which upstream reads out of
bounds (it crashed the first generator draft), is skipped.

Co-Authored-By: Claude <noreply@anthropic.com>
@razedproduction
razedproduction merged commit 7c0d756 into master Oct 16, 2026
3 checks passed
@razedproduction
razedproduction deleted the stage-6.4b-probes branch October 16, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant