mesh: lower clip and cull distance exports placed by PA_CL_VS_OUT_CNTL #2281

Merged
roansystemlabs merged 1 commit from upstream-pr/2289 into main 2026-11-25 10:21:03 +00:00
roansystemlabs commented 2026-11-25 10:13:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-25T10:13:09Z.


Part of #1998.

Change

Item F, first slice: clip and cull distance exports in the bounded mesh path, placed by an explicit PA_CL_VS_OUT_CNTL word, as agreed in the claim and the reply above. Reading the word from the slot 57 state stays a separate piece.

  • Input. Both lowerers take the word as an explicit input: --pa-cl-vs-out-cntl <word> on the command line of tools/mesh_entry_aot.py and tools/mesh_dynamic_aot.py, vs_out_cntl= in Python. Without it, the output and the refusals of existing programs are unchanged.
  • Decoding. tools/mesh_clip_cull.py (new) decodes the word and checks every vertex's position exports against it. Both references are pinned to Mesa commit 03ecd8b0a517e528d790a3d252194f7b898d0e8f (tag mesa-24.0.0, MIT):
  • What is lowered. The misc vector is refused, so the first enabled CCDIST vector is pos1 and the second is pos2. The output vertex declares only the enabled components, one field per kind and vector (float2 clip0 : SV_ClipDistance0, float cull1 : SV_CullDistance1, ...). A component with both enables, which radeonsi sets for every clip distance (culldist_mask |= clipdist_mask, line 897), is declared as both. Disabled components may be off or hold any value; they are not declared.
  • Refused by name, each with a test in both lowerers:
    • unsupported state: no word given (Mesh export pos1 needs the PA_CL_VS_OUT_CNTL word), the misc vector (... sets VS_OUT_MISC_VEC_ENA; only clip and cull distance vectors are translated), every USE_VTX_* bit and VS_OUT_MISC_SIDE_BUS_ENA by field name, unknown bits, a vector enable without components, components without their vector enable, more than eight components, a value that is not a 32-bit word;
    • exports: a distance export the word does not enable (Mesh export pos2 is not enabled by PA_CL_VS_OUT_CNTL 0x00400003), an enabled export that is missing (... enables pos2 (CCDIST1), which vertex 0 does not export), an enabled component written as off, duplicate and reordered exports, done on another export than the last, pos4 and above (Unsupported mesh export);
    • the compute fallback, whose intermediate buffer has no room for distances: The compute fallback has no room for clip or cull distances.
  • Shared files. In tools/mesh_entry_aot.py the export parser accepts pos0-pos3 and records each position export with its done flag. The check that done sits on the last position export moved from the instruction to mesh_clip_cull.vertex_distances(), so a pos0 without done and without distances is still refused with the same message. tools/mesh_dynamic_aot.py carries the decoded word in Geometry and the distances in Variant.

Overlap: #2149 also touches tools/mesh_entry_aot.py. git merge-tree of this branch with its head 20c2eb84 is clean, and on the merge of the two the CPU checks mesh_clip_cull_check, mesh_dynamic_aot_check, mesh_dynamic_geometry_check, mesh_lane_spill_check, mesh_scc_any_lane_check and mesh_multi_check pass.

Verification

Windows 11 26200, MSVC 19.44, dev preset, D3D12 debug layer on, DXC from Windows SDK 10.0.26100.0. Tested commit 718e86d5 on main ba89d51a. The full set below first ran on the same change on main 77a204d6; after the rebase the mesh_clip_cull_* and mesh_two_exits_* tests were run again with the same results.

python -B tests/mesh_clip_cull_check.py
python -B tests/mesh_clip_cull_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1
ctest --preset dev --no-tests=error -R "^mesh_clip_cull_" -V
  • Clipping, separately from culling. Geometry word 1 picks one of two draws of the same program. The clip draw has two partly visible triangles: A loses the pixels left of screen x = 9 to clip distance 0 and B the pixels above y = 7 to clip distance 1 (91 of 1,024 pixels covered). The cull draw has a triangle whose cull distance 4 is -1 on all three vertices, which must disappear, and a neighbour with +1, which must stay whole (78 pixels covered).

  • Readback. mesh_clip_cull_draw_hardware passed on NVIDIA GeForce RTX 3070 (10de:2484, driver 32.0.16.2101) and mesh_clip_cull_draw_warp on WARP 10.0.26100.9818, with no capability skips. Both draws matched the reference on 1,024 of 1,024 pixels with the static and the runtime translation, with debug_errors=0 debug_warnings=0. The draw mode also ran three times per adapter, and the three outputs were identical on each.

  • Negative controls. Translator mutants, each drawn on both draws. Each must change exactly the number of pixels the model predicts, and a prediction of 0 must read back unchanged:

    Control WARP clip / cull draw RTX 3070 clip / cull draw
    clip and cull components swapped 65 / 0 0 / 0 (see findings)
    CCDIST0 and CCDIST1 swapped (pos1 read as CCDIST1) 65 / 0 50 / 0
    clip distance 1 dropped 50 / 0 50 / 0
    cull distance 4 dropped 0 / 78 0 / 78
    word ignored, every exported component a clip distance 91 / 78 91 / 78

    The disabled components hold -1.0 or 2.0, so declaring any of them changes the image (last row).

  • CPU mode. The static translations of both draws and the runtime translation, checked field by field: clip distances 0-1 from pos1.xy, cull distance 4 from pos2.x, nothing else written. This also catches the clip and cull swap on every adapter. Also checked: Mesa's form with off in disabled components gives the same HLSL; CCDIST1 enabled alone is carried by pos1; both enables on one component declare both semantics; a word that enables nothing leaves a program without distances unchanged. 20 refusals are checked by message in both lowerers, plus the compute fallback. Each guard of mesh_clip_cull.py was then removed in turn (refused bits, unknown bits, export not enabled, enabled export missing, duplicate export, component missing, done on the last export), and the check failed every time. Three of those mutants are still refused by the order check, with a less precise message, and the check catches the message change.

  • Fail-first. Against main's lowerers the program stops at its first export, not at pos1 as the claim said: Expected completed primitive or position export, because pos0 carries no done when distances follow. With done added to pos0, it stops at pos1 with Unsupported mesh export, in both lowerers. The new check cannot import its module there.

  • Binary mode. The 612-byte program reassembles to the embedded bytes, and LLVM's decode equals the Python decoder's. Both command lines produce the same HLSL as lower, exit 1 without the word (Mesh export pos1 needs the PA_CL_VS_OUT_CNTL word), and exit 2 for an invalid word. I ran this locally with LLVM 15.0.7: the clang 15 integrated assembler stood in for llvm-mc, with llvm-objcopy and LLVM-C.dll from the same release, as in #749 and #773. The existing binary modes of mesh_entry, mesh_dynamic_geometry, mesh_multi, mesh_heap_sampler, mesh_lit, mesh_shadow and mesh_scc_any_lane pass.

  • Wider runs. ctest --preset dev --no-tests=error -R "^(mesh_|compute_mesh_texture_|offscreen_|startup_sampler_heap)" -V ran 75 tests: 73 passed, and mesh_two_exits_{hardware,warp} skipped with skip: two-exit mesh draw requires LLVM 15 with AMDGPU, because LLVM 15 was not on that run's PATH. Since that test uses both lowerers, I ran ctest --preset dev --no-tests=error -R "^mesh_two_exits_" -V again with LLVM 15.0.7 on PATH: both passed, static and runtime. No run reported a debug-layer error. mesh_dynamic_aot_check, mesh_dynamic_geometry_check, mesh_multi_check, mesh_heap_sampler_check, mesh_lane_spill_check, mesh_scc_any_lane_check, mesh_join_descriptor_check, pso_readiness_check, docs_links_check, bidi_controls_check and git diff --check pass. The draw mode also passed on WARP with the debug layer reported as unavailable, reading the pixels only.

  • Not run. The Ubuntu LLVM 15 job and the Linux Python job (the new check is added to both), the release preset, AMD and Intel GPUs, console hardware, reading the word from the slot 57 state, and the misc vector.

Evidence and follow-up

The gfx1013 program tests/mesh_clip_cull.s is original, written for this test, and MIT. No game files. The expected images come from an exact rational model in the test, independent of the translator: coverage of pixel centers (none on an edge), linear interpolation of the clip distances (w = 1), and culling when one cull component is negative on all three vertices. The model also checks that every covered center is at least 1/8 pixel away from each clip plane.

Findings:

  • Mixed-sign cull distances differ between adapters. The D3D11.3 functional specification, §15.4.2, says a primitive is discarded only when the cull distance is < 0 on all of its vertices: "if any of the plane distance(s) ... in a primitive is >= 0, the primitive is not culled". WARP kept the whole triangle. On the RTX 3070 (driver 32.0.16.2101), a mesh-shader triangle whose SV_CullDistance is negative on some vertices but not all lost the pixels where the interpolated cull distance is negative. That is 57 pixels for the neighbour triangle with cull distances -1, -1, +1. The translated HLSL was the same on both. I report this as an observation, and I did not check a vertex-shader pipeline. The good draws therefore have no mixed signs, and the model checks that they draw the same image either way. The draw mode first runs a calibration draw that accepts only 0 or exactly 57 changed pixels, and the control predictions follow it. With per-pixel culling, clip and cull distances draw alike, so the clip and cull swap changes no pixel on that GPU. WARP and the CPU mode show it. A pixel shader that reads SV_ClipDistance and SV_CullDistance back would show it on every adapter; I left that out of this slice.
  • The order pos0, misc, CCDIST0, CCDIST1 is Mesa's. I have not verified it against console hardware. Because the misc vector is refused, this slice relies on the numbering only for "CCDIST1 is pos1 when CCDIST0 is disabled".

docs/experiments.md documents the input, the references, the refusals and the commands. The new tests are registered in CMake (mesh_clip_cull_cpu, mesh_clip_cull_draw_{hardware,warp}), in the Ubuntu LLVM 15 and Linux Python jobs, and in AGENTS.md.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6602124773 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2289). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-25T10:13:09Z. --- Part of #1998. ## Change Item F, first slice: clip and cull distance exports in the bounded mesh path, placed by an explicit `PA_CL_VS_OUT_CNTL` word, as agreed in the claim and the reply above. Reading the word from the slot 57 state stays a separate piece. - **Input.** Both lowerers take the word as an explicit input: `--pa-cl-vs-out-cntl <word>` on the command line of `tools/mesh_entry_aot.py` and `tools/mesh_dynamic_aot.py`, `vs_out_cntl=` in Python. Without it, the output and the refusals of existing programs are unchanged. - **Decoding.** `tools/mesh_clip_cull.py` (new) decodes the word and checks every vertex's position exports against it. Both references are pinned to Mesa commit `03ecd8b0a517e528d790a3d252194f7b898d0e8f` (tag `mesa-24.0.0`, MIT): - field layout: [gfx10 register table, `PA_CL_VS_OUT_CNTL`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/03ecd8b0a517e528d790a3d252194f7b898d0e8f/src/amd/registers/gfx10.json#L13456-13487): `CLIP_DIST_ENA_0..7` in bits 0-7, `CULL_DIST_ENA_0..7` in bits 8-15, `VS_OUT_MISC_VEC_ENA` in bit 21, `VS_OUT_CCDIST0/1_VEC_ENA` in bits 22-23. radeonsi writes [`clipdist_mask | (culldist_mask << 8)`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/03ecd8b0a517e528d790a3d252194f7b898d0e8f/src/gallium/drivers/radeonsi/si_state.c#L897-902), so distance component n is component n % 4 of vector CCDIST(n / 4); - export order: [`ac_nir_export_position`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/03ecd8b0a517e528d790a3d252194f7b898d0e8f/src/amd/common/ac_nir.c#L254-396): `pos0`, the misc vector when enabled, then each enabled CCDIST vector, numbered without gaps, with `done` on the last position export. - **What is lowered.** The misc vector is refused, so the first enabled CCDIST vector is `pos1` and the second is `pos2`. The output vertex declares only the enabled components, one field per kind and vector (`float2 clip0 : SV_ClipDistance0`, `float cull1 : SV_CullDistance1`, ...). A component with both enables, which radeonsi sets for every clip distance (`culldist_mask |= clipdist_mask`, line 897), is declared as both. Disabled components may be `off` or hold any value; they are not declared. - **Refused by name**, each with a test in both lowerers: - unsupported state: no word given (`Mesh export pos1 needs the PA_CL_VS_OUT_CNTL word`), the misc vector (`... sets VS_OUT_MISC_VEC_ENA; only clip and cull distance vectors are translated`), every `USE_VTX_*` bit and `VS_OUT_MISC_SIDE_BUS_ENA` by field name, unknown bits, a vector enable without components, components without their vector enable, more than eight components, a value that is not a 32-bit word; - exports: a distance export the word does not enable (`Mesh export pos2 is not enabled by PA_CL_VS_OUT_CNTL 0x00400003`), an enabled export that is missing (`... enables pos2 (CCDIST1), which vertex 0 does not export`), an enabled component written as `off`, duplicate and reordered exports, `done` on another export than the last, `pos4` and above (`Unsupported mesh export`); - the compute fallback, whose intermediate buffer has no room for distances: `The compute fallback has no room for clip or cull distances`. - **Shared files.** In `tools/mesh_entry_aot.py` the export parser accepts `pos0`-`pos3` and records each position export with its `done` flag. The check that `done` sits on the last position export moved from the instruction to `mesh_clip_cull.vertex_distances()`, so a `pos0` without `done` and without distances is still refused with the same message. `tools/mesh_dynamic_aot.py` carries the decoded word in `Geometry` and the distances in `Variant`. Overlap: #2149 also touches `tools/mesh_entry_aot.py`. `git merge-tree` of this branch with its head `20c2eb84` is clean, and on the merge of the two the CPU checks `mesh_clip_cull_check`, `mesh_dynamic_aot_check`, `mesh_dynamic_geometry_check`, `mesh_lane_spill_check`, `mesh_scc_any_lane_check` and `mesh_multi_check` pass. ## Verification Windows 11 26200, MSVC 19.44, `dev` preset, D3D12 debug layer on, DXC from Windows SDK 10.0.26100.0. Tested commit `718e86d5` on `main` `ba89d51a`. The full set below first ran on the same change on `main` `77a204d6`; after the rebase the `mesh_clip_cull_*` and `mesh_two_exits_*` tests were run again with the same results. ```text python -B tests/mesh_clip_cull_check.py python -B tests/mesh_clip_cull_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ctest --preset dev --no-tests=error -R "^mesh_clip_cull_" -V ``` - **Clipping, separately from culling.** Geometry word 1 picks one of two draws of the same program. The clip draw has two partly visible triangles: A loses the pixels left of screen x = 9 to clip distance 0 and B the pixels above y = 7 to clip distance 1 (91 of 1,024 pixels covered). The cull draw has a triangle whose cull distance 4 is -1 on all three vertices, which must disappear, and a neighbour with +1, which must stay whole (78 pixels covered). - **Readback.** `mesh_clip_cull_draw_hardware` passed on NVIDIA GeForce RTX 3070 (`10de:2484`, driver 32.0.16.2101) and `mesh_clip_cull_draw_warp` on WARP 10.0.26100.9818, with no capability skips. Both draws matched the reference on 1,024 of 1,024 pixels with the static and the runtime translation, with `debug_errors=0 debug_warnings=0`. The draw mode also ran three times per adapter, and the three outputs were identical on each. - **Negative controls.** Translator mutants, each drawn on both draws. Each must change exactly the number of pixels the model predicts, and a prediction of 0 must read back unchanged: | Control | WARP clip / cull draw | RTX 3070 clip / cull draw | |---|---|---| | clip and cull components swapped | 65 / 0 | 0 / 0 (see findings) | | CCDIST0 and CCDIST1 swapped (`pos1` read as CCDIST1) | 65 / 0 | 50 / 0 | | clip distance 1 dropped | 50 / 0 | 50 / 0 | | cull distance 4 dropped | 0 / 78 | 0 / 78 | | word ignored, every exported component a clip distance | 91 / 78 | 91 / 78 | The disabled components hold -1.0 or 2.0, so declaring any of them changes the image (last row). - **CPU mode.** The static translations of both draws and the runtime translation, checked field by field: clip distances 0-1 from `pos1.xy`, cull distance 4 from `pos2.x`, nothing else written. This also catches the clip and cull swap on every adapter. Also checked: Mesa's form with `off` in disabled components gives the same HLSL; CCDIST1 enabled alone is carried by `pos1`; both enables on one component declare both semantics; a word that enables nothing leaves a program without distances unchanged. 20 refusals are checked by message in both lowerers, plus the compute fallback. Each guard of `mesh_clip_cull.py` was then removed in turn (refused bits, unknown bits, export not enabled, enabled export missing, duplicate export, component missing, `done` on the last export), and the check failed every time. Three of those mutants are still refused by the order check, with a less precise message, and the check catches the message change. - **Fail-first.** Against `main`'s lowerers the program stops at its first export, not at `pos1` as the claim said: `Expected completed primitive or position export`, because `pos0` carries no `done` when distances follow. With `done` added to `pos0`, it stops at `pos1` with `Unsupported mesh export`, in both lowerers. The new check cannot import its module there. - **Binary mode.** The 612-byte program reassembles to the embedded bytes, and LLVM's decode equals the Python decoder's. Both command lines produce the same HLSL as `lower`, exit 1 without the word (`Mesh export pos1 needs the PA_CL_VS_OUT_CNTL word`), and exit 2 for an invalid word. I ran this locally with LLVM 15.0.7: the clang 15 integrated assembler stood in for `llvm-mc`, with `llvm-objcopy` and `LLVM-C.dll` from the same release, as in #749 and #773. The existing binary modes of `mesh_entry`, `mesh_dynamic_geometry`, `mesh_multi`, `mesh_heap_sampler`, `mesh_lit`, `mesh_shadow` and `mesh_scc_any_lane` pass. - **Wider runs.** `ctest --preset dev --no-tests=error -R "^(mesh_|compute_mesh_texture_|offscreen_|startup_sampler_heap)" -V` ran 75 tests: 73 passed, and `mesh_two_exits_{hardware,warp}` skipped with `skip: two-exit mesh draw requires LLVM 15 with AMDGPU`, because LLVM 15 was not on that run's `PATH`. Since that test uses both lowerers, I ran `ctest --preset dev --no-tests=error -R "^mesh_two_exits_" -V` again with LLVM 15.0.7 on `PATH`: both passed, static and runtime. No run reported a debug-layer error. `mesh_dynamic_aot_check`, `mesh_dynamic_geometry_check`, `mesh_multi_check`, `mesh_heap_sampler_check`, `mesh_lane_spill_check`, `mesh_scc_any_lane_check`, `mesh_join_descriptor_check`, `pso_readiness_check`, `docs_links_check`, `bidi_controls_check` and `git diff --check` pass. The draw mode also passed on WARP with the debug layer reported as unavailable, reading the pixels only. - **Not run.** The Ubuntu LLVM 15 job and the Linux Python job (the new check is added to both), the `release` preset, AMD and Intel GPUs, console hardware, reading the word from the slot 57 state, and the misc vector. ## Evidence and follow-up The gfx1013 program `tests/mesh_clip_cull.s` is original, written for this test, and MIT. No game files. The expected images come from an exact rational model in the test, independent of the translator: coverage of pixel centers (none on an edge), linear interpolation of the clip distances (w = 1), and culling when one cull component is negative on all three vertices. The model also checks that every covered center is at least 1/8 pixel away from each clip plane. Findings: - **Mixed-sign cull distances differ between adapters.** The [D3D11.3 functional specification](https://microsoft.github.io/DirectX-Specs/d3d/archive/D3D11_3_FunctionalSpec.htm#CullDistances), §15.4.2, says a primitive is discarded only when the cull distance is < 0 on all of its vertices: "if any of the plane distance(s) ... in a primitive is >= 0, the primitive is not culled". WARP kept the whole triangle. On the RTX 3070 (driver 32.0.16.2101), a mesh-shader triangle whose `SV_CullDistance` is negative on some vertices but not all lost the pixels where the interpolated cull distance is negative. That is 57 pixels for the neighbour triangle with cull distances -1, -1, +1. The translated HLSL was the same on both. I report this as an observation, and I did not check a vertex-shader pipeline. The good draws therefore have no mixed signs, and the model checks that they draw the same image either way. The draw mode first runs a calibration draw that accepts only 0 or exactly 57 changed pixels, and the control predictions follow it. With per-pixel culling, clip and cull distances draw alike, so the clip and cull swap changes no pixel on that GPU. WARP and the CPU mode show it. A pixel shader that reads `SV_ClipDistance` and `SV_CullDistance` back would show it on every adapter; I left that out of this slice. - The order `pos0`, misc, CCDIST0, CCDIST1 is Mesa's. I have not verified it against console hardware. Because the misc vector is refused, this slice relies on the numbering only for "CCDIST1 is `pos1` when CCDIST0 is disabled". `docs/experiments.md` documents the input, the references, the refusals and the commands. The new tests are registered in CMake (`mesh_clip_cull_cpu`, `mesh_clip_cull_draw_{hardware,warp}`), in the Ubuntu LLVM 15 and Linux Python jobs, and in AGENTS.md. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-25 11:02:21 +00:00
tedin7 commented 2026-11-25 11:02:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T10:15:46Z.

Review: COMMENTED


Review of head 718e86d548 (mesh: lower clip and cull distance exports placed by PA_CL_VS_OUT_CNTL).

Verdict: no blocking findings (P1=0, P2=0). Notes below are nits.

Commands run locally (Linux, in a worktree of the PR head)

  • git diff --stat origin/main...HEAD: 9 files, +957/-18.
  • python3 -B tests/mesh_clip_cull_check.py: exit 0 (CPU cases, refusal cases, reference-vs-control pixel counts, guard-removal self-checks all pass).
  • python3 -B tests/mesh_dynamic_aot_check.py: "Runtime mesh specializations matched the CPU cases and rejected unproven uses".
  • python3 tests/docs_links_check.py: self-test passed, 18 Markdown files, 436 links.
  • python3 tests/bidi_controls_check.py: 1581 files, no bidirectional controls.
  • git diff --check origin/main...HEAD: clean.
  • gh pr checks: Linux Python checks pass; the Windows jobs were still pending when I looked, so I did not rely on them.
  • Mergeable: yes. Title and body are neutral; references are pinned to a public Mesa commit.

Mutations (both reverted with git checkout -- .)

  1. tools/mesh_clip_cull.py:95 changed the first CCDIST target from pos1 to pos2: the test fails with Mesh export pos1 is not enabled by PA_CL_VS_OUT_CNTL 0x00c01003. Killed.
  2. Disabled the "enabled distance not exported" check (tools/mesh_clip_cull.py, the value is None branch): the test fails. Killed, but see nit 1.

Reading of the logic

  • Field decode matches the pinned layout (clip bits 0-7, cull bits 8-15, CCDIST vector enables at bits 22-23). Unknown and unsupported bits are refused by name.
  • The position export regex now accepts pos0..pos3, and done is only required on prim. Order, duplicates, missing enabled targets and done on the last export only are all checked in vertex_distances. Without the word, existing programs still get a refusal for pos1+.
  • The compute fallback is refused when distances are present, which is the safe choice.

Nits

  • nit 1: with the "not exported" guard removed, the failure is an unhandled TypeError (None formatted as hex) instead of a clean refusal. The guard is correct as written, but the test would be sharper if it asserted the message, not just any failure.
  • nit 2: tools/mesh_dynamic_aot.py calls decode_vs_out_cntl twice (in enumerate_variants and again in lower). Harmless; one decode passed down would be tidier.
  • nit 3: the pos1/pos2 numbering is Mesa's and unconfirmed on console hardware. The module docstring already says so; keep that wording when the state-reading slice lands.

Not run

  • Windows WARP draw tests (mesh_clip_cull_draw_*): I did not queue the Windows VM. The PR's own Windows CI job covers them and was still pending at review time. Please confirm that job is green before marking Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6055662523 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2289#pullrequestreview-6055662523). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T10:15:46Z. **Review:** COMMENTED --- Review of head 718e86d5488ce1324b6d5ace799c0075d083bc2b (`mesh: lower clip and cull distance exports placed by PA_CL_VS_OUT_CNTL`). **Verdict: no blocking findings (P1=0, P2=0).** Notes below are nits. ## Commands run locally (Linux, in a worktree of the PR head) - `git diff --stat origin/main...HEAD`: 9 files, +957/-18. - `python3 -B tests/mesh_clip_cull_check.py`: exit 0 (CPU cases, refusal cases, reference-vs-control pixel counts, guard-removal self-checks all pass). - `python3 -B tests/mesh_dynamic_aot_check.py`: "Runtime mesh specializations matched the CPU cases and rejected unproven uses". - `python3 tests/docs_links_check.py`: self-test passed, 18 Markdown files, 436 links. - `python3 tests/bidi_controls_check.py`: 1581 files, no bidirectional controls. - `git diff --check origin/main...HEAD`: clean. - `gh pr checks`: Linux Python checks pass; the Windows jobs were still pending when I looked, so I did not rely on them. - Mergeable: yes. Title and body are neutral; references are pinned to a public Mesa commit. ## Mutations (both reverted with `git checkout -- .`) 1. `tools/mesh_clip_cull.py:95` changed the first CCDIST target from `pos1` to `pos2`: the test fails with `Mesh export pos1 is not enabled by PA_CL_VS_OUT_CNTL 0x00c01003`. Killed. 2. Disabled the "enabled distance not exported" check (`tools/mesh_clip_cull.py`, the `value is None` branch): the test fails. Killed, but see nit 1. ## Reading of the logic - Field decode matches the pinned layout (clip bits 0-7, cull bits 8-15, CCDIST vector enables at bits 22-23). Unknown and unsupported bits are refused by name. - The position export regex now accepts `pos0..pos3`, and `done` is only required on `prim`. Order, duplicates, missing enabled targets and `done` on the last export only are all checked in `vertex_distances`. Without the word, existing programs still get a refusal for `pos1+`. - The compute fallback is refused when distances are present, which is the safe choice. ## Nits - nit 1: with the "not exported" guard removed, the failure is an unhandled `TypeError` (None formatted as hex) instead of a clean refusal. The guard is correct as written, but the test would be sharper if it asserted the message, not just any failure. - nit 2: `tools/mesh_dynamic_aot.py` calls `decode_vs_out_cntl` twice (in `enumerate_variants` and again in `lower`). Harmless; one decode passed down would be tidier. - nit 3: the pos1/pos2 numbering is Mesa's and unconfirmed on console hardware. The module docstring already says so; keep that wording when the state-reading slice lands. ## Not run - Windows WARP draw tests (`mesh_clip_cull_draw_*`): I did not queue the Windows VM. The PR's own Windows CI job covers them and was still pending at review time. Please confirm that job is green before marking Ready. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2281
No description provided.