startup: lower the binary16 BVH box node #3032

Manually merged
github merged 18 commits from github-bot/gh-3032 into gh-pr/3032/base 2026-11-27 21:23:59 +00:00 AGit
Owner

@⁠lambirou on GitHub · 2026-11-27 09:08 UTC · original
lambirou:startup/bvh-intersect-box16 → main · +405 −86 · 3 files · 18 commits · merged 2026-11-27 21:19 UTC

What changed

This is the binary16 slice of image_bvh_intersect_ray, stacked on the merged FP32 box slice (#2922) and the corrected FP32 semantics from #3040.

  • Accepts the 64-byte binary16 box node (kind 4): four child pointers at bytes 0..15 and four boxes of six binary16 values at bytes 16..63.
  • Widens the bounds with f16tof32 and reuses the slab test, extent clip, inactive-box rule, descriptor validation and sort rules of the FP32 helper.
  • Keeps the #3040 result rules for both kinds: the descriptor base is decoded from 256-byte units, the size field is a count minus one in 64-byte units, unsorted results stay in their original child slots with 0xffffffff for holes, and sorted misses use a positive-infinity key.
  • The translator emits x2w_bvh_intersect_box16 for kind 4 and keeps the same srv <i> bvh base 0x<base> size 0x<size> manifest line.
  • The 64-bit form, A16, dynamic descriptors and every other box kind are still refused by name with no partial output. Triangle nodes are covered by the stacked #3105.

The node layout follows Mesa 25.1.0 RADV's radv_bvh_box16_node (MIT). No game files or captures are included.

Tests

python -B tests/startup_gfx2hlsl_bvh_check.py
ctest --preset <dev|release> --no-tests=error -R '^startup_gfx2hlsl_bvh' -V

The combined check writes four FP32 nodes, four binary16 nodes and 21 rays and compares the 1232-byte readback. Binary16 bounds are packed as binary16 and read by the independent tests/gfx1030_bvh_box/bvh_model.py; one bound at 1.1 rounds to 1.099609375 so a ray extent between the two values proves f16tof32 is used. Six mutants cover miss filling (box32 and box16), unsorted compaction with a box16 witness, the finite miss key, the low-byte base check and the high-byte base handling.

Decoded-extent controls: exact fits (0x04, 0), (0x05, 1) and (0x0c, 1); too-short (0x05, 0) and (0x0c, 0); the largest extent 0x03ffffff; and the above-4-GiB 0x04000000. A separate boundary dispatch checks box16 size 0 at offset zero (hit), box16 at offset 64 with size 0 (miss), box32 at offset 128 with size 3 (hit) and size 2 (miss).

Passed on d2eeb68c, dev and release:

  • startup_gfx2hlsl_bvh: pass, both DXC compiles ok.
  • startup_gfx2hlsl_bvh_dispatch_warp: pass, 21/21 cases, 6/6 controls and 4/4 boundary cases on Microsoft Basic Render Driver 1414:008c, driver 10.0.26100.10068.
  • startup_gfx2hlsl_bvh_dispatch_hardware: pass, 21/21 cases, 6/6 controls and 4/4 boundary cases on AMD Radeon RX 9060 XT 1002:7590, driver 32.0.32029.2010.

The branch is merged with current main 63a30dc1. Windows checks #8252 is green.

Limits

This is a translator slice. It does not bind the node buffer on a D3D12 device or establish title behavior. The runtime manifest loader does not yet consume the bvhbase line, so a real dispatch is refused rather than bound at a wrong address.

Refs #870, #1268, #2922, #3040.

AI-assisted.

**@⁠lambirou** on GitHub · 2026-11-27 09:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032) `lambirou:startup/bvh-intersect-box16` → `main` · +405 −86 · 3 files · 18 commits · merged 2026-11-27 21:19 UTC ## What changed This is the binary16 slice of `image_bvh_intersect_ray`, stacked on the merged FP32 box slice (#2922) and the corrected FP32 semantics from #3040. - Accepts the 64-byte binary16 box node (kind 4): four child pointers at bytes 0..15 and four boxes of six `binary16` values at bytes 16..63. - Widens the bounds with `f16tof32` and reuses the slab test, extent clip, inactive-box rule, descriptor validation and sort rules of the FP32 helper. - Keeps the #3040 result rules for both kinds: the descriptor base is decoded from 256-byte units, the size field is a count minus one in 64-byte units, unsorted results stay in their original child slots with `0xffffffff` for holes, and sorted misses use a positive-infinity key. - The translator emits `x2w_bvh_intersect_box16` for kind 4 and keeps the same `srv <i> bvh base 0x<base> size 0x<size>` manifest line. - The 64-bit form, A16, dynamic descriptors and every other box kind are still refused by name with no partial output. Triangle nodes are covered by the stacked #3105. The node layout follows Mesa 25.1.0 RADV's `radv_bvh_box16_node` (MIT). No game files or captures are included. ## Tests ```powershell python -B tests/startup_gfx2hlsl_bvh_check.py ctest --preset <dev|release> --no-tests=error -R '^startup_gfx2hlsl_bvh' -V ``` The combined check writes four FP32 nodes, four binary16 nodes and 21 rays and compares the 1232-byte readback. Binary16 bounds are packed as `binary16` and read by the independent `tests/gfx1030_bvh_box/bvh_model.py`; one bound at 1.1 rounds to 1.099609375 so a ray extent between the two values proves `f16tof32` is used. Six mutants cover miss filling (box32 and box16), unsorted compaction with a box16 witness, the finite miss key, the low-byte base check and the high-byte base handling. Decoded-extent controls: exact fits `(0x04, 0)`, `(0x05, 1)` and `(0x0c, 1)`; too-short `(0x05, 0)` and `(0x0c, 0)`; the largest extent `0x03ffffff`; and the above-4-GiB `0x04000000`. A separate boundary dispatch checks box16 size 0 at offset zero (hit), box16 at offset 64 with size 0 (miss), box32 at offset 128 with size 3 (hit) and size 2 (miss). Passed on `d2eeb68c`, dev and release: - `startup_gfx2hlsl_bvh`: pass, both DXC compiles ok. - `startup_gfx2hlsl_bvh_dispatch_warp`: pass, 21/21 cases, 6/6 controls and 4/4 boundary cases on Microsoft Basic Render Driver `1414:008c`, driver `10.0.26100.10068`. - `startup_gfx2hlsl_bvh_dispatch_hardware`: pass, 21/21 cases, 6/6 controls and 4/4 boundary cases on AMD Radeon RX 9060 XT `1002:7590`, driver `32.0.32029.2010`. The branch is merged with current `main` `63a30dc1`. Windows checks #8252 is green. ## Limits This is a translator slice. It does not bind the node buffer on a D3D12 device or establish title behavior. The runtime manifest loader does not yet consume the `bvhbase` line, so a real dispatch is refused rather than bound at a wrong address. Refs #870, #1268, #2922, #3040. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 09:10:46 +00:00
Author
Owner

@⁠chadhyatt on GitHub · 2026-11-27 09:58 UTC · original

I am preparing an AI-assisted backport patch from x2w-microlift for three independently reproducible FP32 corrections: encoded descriptor base is in 256-byte units (keep the upper base byte), unsorted hits preserve original child slots (existing box32/mixed-nosort witness), and misses use positive infinity rather than FLT_MAX. These are shared with this FP16 extension; I would prefer to land the focused FP32 correction first and have this PR adopt the same semantics.

One separate FP16-specific point from RDNA2 ISA Table 49: size encodes the number of nodes minus one, so a single-unit binary16 node at offset == size, including size zero/offset zero, is valid. The current two-unit bounds check and shared size-zero refusal need adjustment for box16. I will keep the standalone FP32 patch source-built/title-neutral and avoid runtime binding changes.

**@⁠chadhyatt** on GitHub · 2026-11-27 09:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7215325288) I am preparing an AI-assisted backport patch from x2w-microlift for three independently reproducible FP32 corrections: encoded descriptor base is in 256-byte units (keep the upper base byte), unsorted hits preserve original child slots (existing `box32/mixed-nosort` witness), and misses use positive infinity rather than FLT_MAX. These are shared with this FP16 extension; I would prefer to land the focused FP32 correction first and have this PR adopt the same semantics. One separate FP16-specific point from RDNA2 ISA Table 49: size encodes the number of nodes minus one, so a single-unit binary16 node at offset == size, including size zero/offset zero, is valid. The current two-unit bounds check and shared size-zero refusal need adjustment for box16. I will keep the standalone FP32 patch source-built/title-neutral and avoid runtime binding changes.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 10:07 UTC · original · reviewed

Review of head c7a23a1b (a merge of main on top of the code I read; the PR-only diff is the same 3 files) (comment only).

Read the diff of tools/startup/gfx2hlsl.py (85 lines): kind-4 (binary16) box nodes are now lowered through x2w_bvh_box16_slot / x2w_bvh_intersect_box16, with a 64-byte node alignment check (offset & 0x3f), the same descriptor-size rule in 64-byte units, miss compaction, and a separate path for unsorted boxes (the sort network is not reused, with the reason in a comment). The six half values per child are read as f16tof32 and the box32 maths is reused, which is exact.

The check has what a lowering needs: startup_gfx2hlsl_bvh_dispatch_warp / _hardware run the generated HLSL on a node buffer and compare the readback with the CPU reference(...) for both box32 and box16 cases (including the half-node cases), plus the translator-level startup_gfx2hlsl_bvh.

Ran locally (Linux; no dxc here, so the dispatch part skips): python3 -B tests/startup_gfx2hlsl_bvh_check.py: all ok.

  • Mutation A: the lo.z half read changed from h1 to h2 in the HLSL helper: the Linux part does NOT catch it (HLSL maths only runs in the dispatch test); only the WARP dispatch can.
  • Mutation B: accepted kinds reduced to (5,): the translator control fails (StopIteration, no box16 call).

No defect found. It only lacks a Windows receipt on this head: ctest -R "startup_gfx2hlsl_bvh" (dev + release).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 10:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#pullrequestreview-6086494481) · **reviewed** Review of head c7a23a1b (a merge of main on top of the code I read; the PR-only diff is the same 3 files) (comment only). Read the diff of `tools/startup/gfx2hlsl.py` (85 lines): kind-4 (binary16) box nodes are now lowered through `x2w_bvh_box16_slot` / `x2w_bvh_intersect_box16`, with a 64-byte node alignment check (`offset & 0x3f`), the same descriptor-size rule in 64-byte units, miss compaction, and a separate path for unsorted boxes (the sort network is not reused, with the reason in a comment). The six half values per child are read as `f16tof32` and the box32 maths is reused, which is exact. The check has what a lowering needs: `startup_gfx2hlsl_bvh_dispatch_warp` / `_hardware` run the generated HLSL on a node buffer and compare the readback with the CPU `reference(...)` for both box32 and box16 cases (including the half-node cases), plus the translator-level `startup_gfx2hlsl_bvh`. Ran locally (Linux; no `dxc` here, so the dispatch part skips): `python3 -B tests/startup_gfx2hlsl_bvh_check.py`: all ok. - Mutation A: the `lo.z` half read changed from `h1` to `h2` in the HLSL helper: the Linux part does NOT catch it (HLSL maths only runs in the dispatch test); only the WARP dispatch can. - Mutation B: accepted kinds reduced to `(5,)`: the translator control fails (`StopIteration`, no box16 call). No defect found. It only lacks a Windows receipt on this head: `ctest -R "startup_gfx2hlsl_bvh"` (dev + release). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 10:18 UTC · original

Windows receipt on c7a23a1b (head), main e446b072:

ctest --preset dev --no-tests=error -R "startup_gfx2hlsl_bvh"
3/3 passed: startup_gfx2hlsl_bvh, dispatch_warp, dispatch_hardware
ctest --preset release --no-tests=error -R "startup_gfx2hlsl_bvh"
3/3 passed: same three

Hardware adapter: AMD Radeon RX 9060 XT (1002:7590, driver 32.0.32029.2010). Both WARP and hardware runs report all six FP32 and five binary16 dispatch cases exact; the miss-fill control also passes.

The translator controls and both DXC compiles pass in dev and release. No code changes since the head you reviewed; this is only the requested Windows receipt.

**@⁠lambirou** on GitHub · 2026-11-27 10:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7215731031) Windows receipt on `c7a23a1b` (head), main `e446b072`: ```text ctest --preset dev --no-tests=error -R "startup_gfx2hlsl_bvh" 3/3 passed: startup_gfx2hlsl_bvh, dispatch_warp, dispatch_hardware ctest --preset release --no-tests=error -R "startup_gfx2hlsl_bvh" 3/3 passed: same three ``` Hardware adapter: AMD Radeon RX 9060 XT (`1002:7590`, driver `32.0.32029.2010`). Both WARP and hardware runs report all six FP32 and five binary16 dispatch cases exact; the miss-fill control also passes. The translator controls and both DXC compiles pass in dev and release. No code changes since the head you reviewed; this is only the requested Windows receipt.
Author
Owner

@⁠chadhyatt on GitHub · 2026-11-27 10:18 UTC · original

The focused FP32 correction is available in #3040 now. It also checks the 48-bit node-address end-exclusive bound. Portable CPU model/translator checks passed; GPU dispatch remains unverified on this host.

**@⁠chadhyatt** on GitHub · 2026-11-27 10:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7215735575) The focused FP32 correction is available in #3040 now. It also checks the 48-bit node-address end-exclusive bound. Portable CPU model/translator checks passed; GPU dispatch remains unverified on this host.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 11:30 UTC · original

#3040 has landed on main as 1c879506. Please rebase or merge the current main into this PR and preserve the descriptor base in 256-byte units, the 48-bit end-exclusive bound, positional misses with sorting disabled, and the +infinity miss key. Please carry the focused controls into the combined box32/box16 run on the new head. The earlier Windows receipt predates those semantics.

**@⁠R0Y00** on GitHub · 2026-11-27 11:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7217146671) #3040 has landed on `main` as `1c879506`. Please rebase or merge the current main into this PR and preserve the descriptor base in 256-byte units, the 48-bit end-exclusive bound, positional misses with sorting disabled, and the +infinity miss key. Please carry the focused controls into the combined box32/box16 run on the new head. The earlier Windows receipt predates those semantics.
Adopt the FP32 BVH descriptor unit decode, 48-bit end-exclusive bound, positional unsorted results and positive-infinity miss keys for both box kinds. Binary16 fixtures are packed as half values and share the independent model; dev and release WARP and RX 9060 XT dispatch pass 21 cases plus six mutants.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 14:05 UTC · original

Merged main at e1ea515d into this branch. Head is now b7117d46; the Windows receipt was taken on 13167033, and the only later change is a one-line correction to the node count in the experiment note.

The binary16 path now shares the #3040 semantics:

  • the descriptor base stays encoded in 256-byte units and is decoded once for the manifest and binding;
  • the 48-bit end-exclusive check uses the node size (64 bytes for binary16, 128 bytes for FP32), so a node ending exactly at the boundary translates and a wrapping node is refused before any resource is bound;
  • with sorting disabled both helpers return uint4(c0, c1, c2, c3) in child slots, with 0xffffffff for a miss;
  • sorted misses use asfloat(0x7f800000u), so the finite FLT_MAX hit still sorts ahead.

The combined check writes four FP32 nodes, four binary16 nodes and 21 rays, and compares the 1232-byte readback. Binary16 bounds are packed as binary16 bytes and read by the independent tests/gfx1030_bvh_box/bvh_model.py; one bound at 1.1 rounds to 1.099609375, so a ray extent between the two values proves f16tof32 is used. Six mutants cover miss filling (box32 and box16), unsorted compaction with a box16 witness, the finite miss key, the low-byte base check and the high-byte base handling.

Windows receipt on 13167033 (dev and release), ctest --preset <dev|release> --no-tests=error -R '^startup_gfx2hlsl_bvh':

  • startup_gfx2hlsl_bvh: pass, both DXC compiles ok.
  • startup_gfx2hlsl_bvh_dispatch_warp: pass, 21/21 cases and 6/6 controls on Microsoft Basic Render Driver 1414:008c, driver 10.0.26100.10068.
  • startup_gfx2hlsl_bvh_dispatch_hardware: pass, 21/21 cases and 6/6 controls on AMD Radeon RX 9060 XT 1002:7590, driver 32.0.32029.2010.

The earlier Windows receipt predates the #3040 changes; this one is on the new head.

**@⁠lambirou** on GitHub · 2026-11-27 14:05 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7220332716) Merged `main` at `e1ea515d` into this branch. Head is now `b7117d46`; the Windows receipt was taken on `13167033`, and the only later change is a one-line correction to the node count in the experiment note. The binary16 path now shares the #3040 semantics: - the descriptor base stays encoded in 256-byte units and is decoded once for the manifest and binding; - the 48-bit end-exclusive check uses the node size (64 bytes for binary16, 128 bytes for FP32), so a node ending exactly at the boundary translates and a wrapping node is refused before any resource is bound; - with sorting disabled both helpers return `uint4(c0, c1, c2, c3)` in child slots, with `0xffffffff` for a miss; - sorted misses use `asfloat(0x7f800000u)`, so the finite `FLT_MAX` hit still sorts ahead. The combined check writes four FP32 nodes, four binary16 nodes and 21 rays, and compares the 1232-byte readback. Binary16 bounds are packed as `binary16` bytes and read by the independent `tests/gfx1030_bvh_box/bvh_model.py`; one bound at 1.1 rounds to 1.099609375, so a ray extent between the two values proves `f16tof32` is used. Six mutants cover miss filling (box32 and box16), unsorted compaction with a box16 witness, the finite miss key, the low-byte base check and the high-byte base handling. Windows receipt on `13167033` (dev and release), `ctest --preset <dev|release> --no-tests=error -R '^startup_gfx2hlsl_bvh'`: - `startup_gfx2hlsl_bvh`: pass, both DXC compiles ok. - `startup_gfx2hlsl_bvh_dispatch_warp`: pass, 21/21 cases and 6/6 controls on Microsoft Basic Render Driver `1414:008c`, driver `10.0.26100.10068`. - `startup_gfx2hlsl_bvh_dispatch_hardware`: pass, 21/21 cases and 6/6 controls on AMD Radeon RX 9060 XT `1002:7590`, driver `32.0.32029.2010`. The earlier Windows receipt predates the #3040 changes; this one is on the new head.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 14:29 UTC · original

@⁠R0Y00 the current main merge and the #3040 descriptor/result semantics are on b7117d46, with the combined 21-case and 6-mutant run green on WARP and on the RX 9060 XT in dev and release. Could you take another look when you have a moment?

**@⁠lambirou** on GitHub · 2026-11-27 14:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7220846482) @⁠R0Y00 the current `main` merge and the #3040 descriptor/result semantics are on `b7117d46`, with the combined 21-case and 6-mutant run green on WARP and on the RX 9060 XT in dev and release. Could you take another look when you have a moment?
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 15:34 UTC · original

Merged main at 428c08c1; head is now aa5c9013. startup_gfx2hlsl_bvh passes 6/6 in dev and release on WARP and the RX 9060 XT, including the combined box32/box16 dispatch. Windows checks #8206 is running. #3105 (triangle nodes) is stacked on this PR and will be retargeted after it lands.

**@⁠lambirou** on GitHub · 2026-11-27 15:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7222223344) Merged `main` at `428c08c1`; head is now `aa5c9013`. `startup_gfx2hlsl_bvh` passes 6/6 in dev and release on WARP and the RX 9060 XT, including the combined box32/box16 dispatch. Windows checks #8206 is running. #3105 (triangle nodes) is stacked on this PR and will be retargeted after it lands.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 15:37 UTC · original

Windows checks #8206 completed successfully on aa5c9013.

**@⁠lambirou** on GitHub · 2026-11-27 15:37 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7222285687) Windows checks #8206 completed successfully on `aa5c9013`.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 15:43 UTC · original · requested changes

The new descriptor boundary rule treats the encoded size as the number of 64-byte units. The PR's manifest docs specify (size + 1) * 64, consistent with the AMD RDNA 2 ISA, Table 49, which defines the field as a count minus one.

Reproduced on aa5c9013 integrated over 4a6302eb. Import translate_program from tests/startup_gfx2hlsl_bvh_check.py and call it with (node, word2) equal to (0x04, 0), (0x05, 1), and (0x0c, 1). All three currently refuse. In order, these are a binary16 box in a one-unit span, an FP32 box in a two-unit span, and a binary16 box in the last unit of a two-unit span. Each accepts if the advertised extent grows by one unit. In particular, the FP32 case (0x05, 1) was accepted before this PR.

Please use the same decoded extent in the Python guard and both emitted HLSL helpers, including the descriptor validity guard for size=0. Add exact-fit positives and neighboring too-short negatives. For example, at offset zero the FP32 positive is size=1 and the negative is size=0. Also check the upper bound against the decoded extent. This is relevant to the boundary check carried by stacked #3105.

**@⁠R0Y00** on GitHub · 2026-11-27 15:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#pullrequestreview-6090518830) · **requested changes** The new descriptor boundary rule treats the encoded size as the number of 64-byte units. The PR's manifest docs specify `(size + 1) * 64`, consistent with the [AMD RDNA 2 ISA, Table 49](https://docs.amd.com/api/khub/documents/Et~wpu9g~Ffl7d9q0QZ~Og/content), which defines the field as a count minus one. Reproduced on `aa5c9013` integrated over `4a6302eb`. Import `translate_program` from `tests/startup_gfx2hlsl_bvh_check.py` and call it with `(node, word2)` equal to `(0x04, 0)`, `(0x05, 1)`, and `(0x0c, 1)`. All three currently refuse. In order, these are a binary16 box in a one-unit span, an FP32 box in a two-unit span, and a binary16 box in the last unit of a two-unit span. Each accepts if the advertised extent grows by one unit. In particular, the FP32 case `(0x05, 1)` was accepted before this PR. Please use the same decoded extent in the Python guard and both emitted HLSL helpers, including the descriptor validity guard for `size=0`. Add exact-fit positives and neighboring too-short negatives. For example, at offset zero the FP32 positive is `size=1` and the negative is `size=0`. Also check the upper bound against the decoded extent. This is relevant to the boundary check carried by stacked #3105.
Size 0 is a one-unit span, so a binary16 node at offset zero accepts it and an FP32 node needs size 1 at offset zero. Use the decoded extent in the Python guard and both HLSL helpers, with exact-fit, too-short, upper-bound and boundary-dispatch controls.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 15:55 UTC · original

Additional test receipt for the reviewed aa5c9013 integration (tree 5556a1f577b2ce890e6a90881cb909d0ca95e753). Built offscreen_check in dev and release, then ran ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_bvh'. The existing translator, WARP, and RTX tests passed 3/3 in each build without skips. Existing readbacks and all six mutations passed on both adapters, with the debug layer enabled and no warnings or errors. RTX 4060 Laptop driver 32.0.16.1656, Windows 26200.9974, SDK/DXC 10.0.26100.0. The exact-fit boundary case in the review is an additional compile probe.

**@⁠R0Y00** on GitHub · 2026-11-27 15:55 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7222641706) Additional test receipt for the reviewed `aa5c9013` integration (tree `5556a1f577b2ce890e6a90881cb909d0ca95e753`). Built `offscreen_check` in `dev` and `release`, then ran `ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_bvh'`. The existing translator, WARP, and RTX tests passed 3/3 in each build without skips. Existing readbacks and all six mutations passed on both adapters, with the debug layer enabled and no warnings or errors. RTX 4060 Laptop driver `32.0.16.1656`, Windows `26200.9974`, SDK/DXC `10.0.26100.0`. The exact-fit boundary case in the review is an additional compile probe.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 16:08 UTC · original

Fixed on 3ac44c28. The size field is now treated as a count minus one everywhere:

  • Python guard: (node_offset >> 6) + node_units - 1 > word2 refuses only when the decoded extent is too short;
  • box32 helper: (offset >> 6) + 1 > word2;
  • box16 helper: (offset >> 6) > word2;
  • x2w_bvh_descriptor_ok allows word2 = 0 and keeps the < 0x04000000 upper bound.

Controls added: exact fits (node 0x04, size 0), (0x05, 1), (0x0c, 1); too-short (0x05, 0) and (0x0c, 0); largest extent 0x03ffffff and above-4-GiB 0x04000000. A separate boundary dispatch checks box16 size 0 at offset zero (hit), box16 at offset 64 with size 0 (miss), box32 at offset 128 with size 3 (hit) and size 2 (miss). It passes on WARP and the RX 9060 XT.

The same rule is carried to the triangle helper in #3105 (070b12de). startup_gfx2hlsl_bvh is 6/6 in dev and release. Windows checks are running on the new head.

**@⁠lambirou** on GitHub · 2026-11-27 16:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7222907869) Fixed on `3ac44c28`. The size field is now treated as a count minus one everywhere: - Python guard: `(node_offset >> 6) + node_units - 1 > word2` refuses only when the decoded extent is too short; - box32 helper: `(offset >> 6) + 1 > word2`; - box16 helper: `(offset >> 6) > word2`; - `x2w_bvh_descriptor_ok` allows `word2 = 0` and keeps the `< 0x04000000` upper bound. Controls added: exact fits `(node 0x04, size 0)`, `(0x05, 1)`, `(0x0c, 1)`; too-short `(0x05, 0)` and `(0x0c, 0)`; largest extent `0x03ffffff` and above-4-GiB `0x04000000`. A separate boundary dispatch checks box16 size 0 at offset zero (hit), box16 at offset 64 with size 0 (miss), box32 at offset 128 with size 3 (hit) and size 2 (miss). It passes on WARP and the RX 9060 XT. The same rule is carried to the triangle helper in #3105 (`070b12de`). `startup_gfx2hlsl_bvh` is 6/6 in dev and release. Windows checks are running on the new head.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 16:09 UTC · original

Windows checks #8235 completed successfully on 3ac44c28.

**@⁠lambirou** on GitHub · 2026-11-27 16:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7222924356) Windows checks #8235 completed successfully on `3ac44c28`.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 16:12 UTC · original

All three review points are addressed on 3ac44c28: decoded extent in the Python guard and both HLSL helpers, size=0 accepted, exact-fit/too-short/upper-bound and boundary-dispatch controls added. Dev and release are 6/6 on WARP and the RX 9060 XT; CI #8235 is green. Could you re-review when you have a moment?

**@⁠lambirou** on GitHub · 2026-11-27 16:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7222991617) All three review points are addressed on `3ac44c28`: decoded extent in the Python guard and both HLSL helpers, `size=0` accepted, exact-fit/too-short/upper-bound and boundary-dispatch controls added. Dev and release are 6/6 on WARP and the RX 9060 XT; CI #8235 is green. Could you re-review when you have a moment?
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 17:31 UTC · original

Merged main at 63a30dc1; head is now d2eeb68c. Windows checks #8252 is green, and startup_gfx2hlsl_bvh remains 6/6 in dev and release on WARP and the RX 9060 XT.

**@⁠lambirou** on GitHub · 2026-11-27 17:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7224501519) Merged `main` at `63a30dc1`; head is now `d2eeb68c`. Windows checks #8252 is green, and `startup_gfx2hlsl_bvh` remains 6/6 in dev and release on WARP and the RX 9060 XT.
Author
Owner

@⁠lambirou on GitHub · 2026-11-27 20:40 UTC · original

@⁠R0Y00 the descriptor boundary fix has been on 3ac44c28 since 16:08, and the current head d2eeb68c only merges main; CI #8252 is green and startup_gfx2hlsl_bvh remains 6/6 in dev and release on WARP and the RX 9060 XT. The exact-fit (0x04, 0), (0x05, 1), (0x0c, 1) cases and the neighboring too-short negatives are in the combined run. #3105 is stacked on this PR and cannot be rebased until it lands. Could you clear the stale CHANGES_REQUESTED when you get a moment?

**@⁠lambirou** on GitHub · 2026-11-27 20:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#issuecomment-7227726081) @⁠R0Y00 the descriptor boundary fix has been on `3ac44c28` since 16:08, and the current head `d2eeb68c` only merges `main`; CI #8252 is green and `startup_gfx2hlsl_bvh` remains 6/6 in dev and release on WARP and the RX 9060 XT. The exact-fit `(0x04, 0)`, `(0x05, 1)`, `(0x0c, 1)` cases and the neighboring too-short negatives are in the combined run. #3105 is stacked on this PR and cannot be rebased until it lands. Could you clear the stale CHANGES_REQUESTED when you get a moment?
github-bot changed target branch from main to gh-pr/3032/base 2026-11-27 21:23:52 +00:00
github manually merged commit d2eeb68cef into gh-pr/3032/base 2026-11-27 21:23:59 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-27 21:18 UTC · original · approved these changes

Re-reviewed current head d2eeb68c. The decoded count-minus-one extent is now consistent across Python and both HLSL helpers. Exact-fit box16 at offset zero and in the final unit, and exact-fit box32 at offset zero, all translate. The neighboring too-short cases and the above-4-GiB extent are refused. This supersedes my earlier changes-requested review on aa5c9013.

Built offscreen_check in Debug and Release /O2, on cf3df832 plus #3155 and this exact #3032 head (tree 0720ecb04d9db50f7f00a02789ba73336006956a). Ran ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_bvh'. Each build passed 3/3 with zero skips, including the WARP and hardware dispatches, four descriptor extent readbacks and the existing mutations. The pure Python and DXC controls also passed on cf3df832 plus #3032 alone. Windows 26200.9974, Microsoft Basic Render Driver WARP 10.0.26100.9818, RTX 4060 Laptop driver 32.0.16.1656, SDK/DXC 10.0.26100.0, D3D12 debug layer enabled without diagnostics. Hosted Windows, Linux and gfx1013 checks also passed.

**@⁠R0Y00** on GitHub · 2026-11-27 21:18 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3032#pullrequestreview-6093425547) · **approved these changes** Re-reviewed current head `d2eeb68c`. The decoded count-minus-one extent is now consistent across Python and both HLSL helpers. Exact-fit box16 at offset zero and in the final unit, and exact-fit box32 at offset zero, all translate. The neighboring too-short cases and the above-4-GiB extent are refused. This supersedes my earlier changes-requested review on `aa5c9013`. Built `offscreen_check` in Debug and Release `/O2`, on `cf3df832` plus #3155 and this exact #3032 head (tree `0720ecb04d9db50f7f00a02789ba73336006956a`). Ran `ctest --test-dir <build> --no-tests=error -j 1 -V -R '^startup_gfx2hlsl_bvh'`. Each build passed 3/3 with zero skips, including the WARP and hardware dispatches, four descriptor extent readbacks and the existing mutations. The pure Python and DXC controls also passed on `cf3df832` plus #3032 alone. Windows `26200.9974`, Microsoft Basic Render Driver WARP `10.0.26100.9818`, RTX 4060 Laptop driver `32.0.16.1656`, SDK/DXC `10.0.26100.0`, D3D12 debug layer enabled without diagnostics. Hosted Windows, Linux and gfx1013 checks also passed.
This discussion has been locked. Commenting is limited to contributors.
No description provided.