Repository navigation
Conversation
|
Tested Test Suite Execution
Negative ControlReverted
Hygiene Checks
LGTM! AI-assisted: verified and reviewed on Windows 11 environment. |
|
Tested
AI-assisted (Cursor / Composer). |
|
Verified commit AI-assisted verification. |
Grimkeh
left a comment
There was a problem hiding this comment.
Independent Linux CPU review (d94dee4b)
What changed: half_down / half_up clamp a finite float that floors/ceils past the half range to ±65504 instead of becoming ±Inf, so a box bound just outside the half range stays finite.
Checked:
- Diff is two clamps +
HALF_MAX(+ tests). python3 -I tests/test_bvh_rehydrate.py→ 19 OK.
Looks correct; no game files.
tupacfan04
left a comment
There was a problem hiding this comment.
The finite clamp is correct: half_down/half_up agree with xdxr_bvh.half_round for 65504/65505/65520/65536/70000; half_down(-70000)/half_up(70000) still go outward to infinities; the in-range leaf test is fine; NaN is 0x7E00 in both. The infinite inward sides and empty box still differ:
| input | bvh_rehydrate |
xdxr_bvh.half_round |
|---|---|---|
+inf, down |
0x7C00 (+inf) |
0x7BFF (65504) |
-inf, up |
0xFC00 (-inf) |
0xFBFF (-65504) |
tools/bvh_rehydrate.py:128-129,143-144 deliberately do not clamp an infinite input; the new test asserts both bvh_rehydrate values (tests/test_bvh_rehydrate.py:197,200). The PR body accounts only for half_down(+inf), not half_up(-inf), and tests/test_xdxr_bvh.py:97 explicitly asserts the opposite for both inward infinite sides.
The empty box is the same discrepancy: tools/bvh_rehydrate.py:394 writes [HALF_POS_INF]*3 + [HALF_NEG_INF]*3 (±inf), while xdxr_bvh.py's empty box via encode_box16 produces 0x7BFF/0xFBFF. Both boxes are empty (min > max) but the BOX16 words differ; the new test does not hang an unused BOX16 child or compare against xdxr_bvh, so the body's “the two builders now agree here” is true only for finite bounds.
Either align the infinite inward sides and empty box with xdxr_bvh (make half_down(+inf)/half_up(-inf) return ±HALF_MAX and use that for the empty slot), or keep the sentinel and list half_up(-inf) as a deliberate difference, and add an unused BOX16 child test/cross-check. The exact finite boundary half_up(65504)/half_down(-65504) is not directly tested (it is correct); NaN is not tested but both return 0x7E00. Synthetic only; no game files. AI-assisted (OpenCode).
|
Note for whoever merges: #7814 (the |
TEST validation — ApproveValidated on CPU (no GPU, no game files). Pure Python unit test on synthetic geometry. Tests added: Verification:
Note: Reviewer tupacfan04 flagged pre-existing differences with Recommendation: Approve / merge. Fully CPU-validatable, negative control confirms the test catches the regression, reviewed by 4 people across Linux and Windows. |
|
Tested
|
|
Thanks, that is a fair correction of my PR body. The fix here is only the finite case, and I have reworded the body to say so. What is and is not aligned with
I kept the infinite sentinel because this tool already writes AI-assisted (reply written with Claude Code). |
|
Tested Security pass first: clean. The change is two clamps in
All 265 have a BOX16 root and a large frame scale (exponents up to 2^19 on an axis): small objects scaled until their bounds pass the half range. In none does the whole scene lie past 65504 on an axis; it straddles the limit. So the inward-side case is reachable for a child box near the far corner of those 265 trees. Whether any child box really lies wholly past 65504 depends on the geometry, which I haven't matched for those streams.
AI-assisted. |
half_downandhalf_upare documented as "largest half not above x (a box16 minimum)" and "smallest half not below x (a box16 maximum)". Both ended infloat_to_half, whose overflow saturates to the infinity on the side of the magnitude. So on the inward side a finite bound came back infinite:half_down(70000.0)was0x7c00(+inf) where the largest half not above it is 65504 (0x7bff), andhalf_up(-70000.0)was0xfc00where it should be0xfbff. A node whose whole box lies above the half range was then written with minimum[inf, inf, inf], which is the value unused slots use for an empty box.The inward sides now stop at ±65504. Unchanged: infinite bounds still give infinities, the outward sides still saturate to the infinity (
half_down(-70000),half_up(70000)), and every in-range value.tools/xdxr_bvh.pyhalf_roundstates the same rule in its docstring ("±inf on their outward side ... and ±HALF_MAX on their inward side, so an empty box stays empty"), so the two builders now agree for finite bounds. Differences left alone on purpose: the sign of a zero result; the infinite inward sides (half_down(+inf)stays +inf andhalf_up(-inf)stays -inf here, wherehalf_roundgives ±65504); and, for the same reason, the words of an empty box (±inf here, ±65504 fromencode_box16). Both encodings of an empty box are empty (min > max).Scope, plainly: this only matters for geometry more than 65504 units from the origin on some axis. I have not checked whether any real scene has such bounds.
Tested on Linux, CPython 3.14, CPU only, synthetic geometry:
python -I tests/test_bvh_rehydrate.py19 OK; with only the tool reverted, the new test fails (31744 != 31743).compileall,check_no_game_data.pyandgit diff --checkare clean. The agent also compared the two helpers withxdxr_bvh.half_roundover about 42,000 values each; I did not repeat that comparison.Claim: #8047.
AI-assisted (DeepSeek V4.1 Flash wrote it; gated and re-run with Claude Code).