shader: keep mesh output rows with an integer element constant #3827

Manually merged
github merged 1 commit from github-bot/gh-3825 into gh-pr/3825/base 2026-12-02 09:03:44 +00:00 AGit
Owner

@⁠lukaslw-lab on GitHub · 2026-12-02 06:12 UTC · original
lukaslw-lab:shader/mesh-flat-integer-rows → main · +23 −2 · 2 files · 1 commits · merged 2026-12-02 08:57 UTC

Change

Fixes #3826. In a direct mesh or vertex output signature, an element whose row also holds an integer element is now emitted with constant interpolation (generic() in src/gfx1013_direct_graphics.inl). Before, a float in such a row was linear, so DXIL validation rejected the row. Rows holding only floats are unchanged.

Verification

Commit 50a90fd5 on main f365f125. Windows 10 19045, RTX 3080 Ti (driver 32.0.16.1047), in-box D3D12 runtime, DXC 1.9.2609, release preset.

Check Result
ctest --test-dir out/build/release -R '^native_direct_mesh$' passed
Same, with the source change reverted (negative control) fails: signature element TEXCOORD at location (1,1) ... has interpolation mode that differs from another element packed into the same row.
ctest --test-dir out/build/release -R '^native_|mesh|ngg|graphics' -j4 (678 tests, on main e958b8e8) 327 passed, 266 skipped, 85 failed. All 85 were rerun on plain main f365f125: 82 fail the same way (GPU tests on this host's in-box Win10 D3D12 runtime, e.g. CreatePipelineState 0x80070057). The 2 native_indexed_pixel_texture_* tests skip on both after #3825. native_translator_corpus_ir is flaky on plain main too (3 of 8 runs passed, 2 of 8 on this branch; incomplete or conflicting outputs on a compute key).
Local slot 86 census, 6,685 distinct mesh programs (main 0dd65da1) the 3 Validation failed. programs now compile (1,036 → 1,039 OK); no other program changes outcome
  • New cases in tests/native_direct_mesh_check.py, built on the existing source-built container fixture:
    • integer-row: u32 COLOR.x and f32 TEXCOORD.y in one row; TEXCOORD becomes constant;
    • float-row: two floats in one row; TEXCOORD stays linear.
  • A program that validated before cannot hold an integer and a float in one output row, so already translated programs keep the same signature.

Evidence and follow-up

  • The guest pixel stage paired with the 3 programs reads both channels of the packed attribute with v_interp_mov_f32.
  • AI-assisted (Claude Code).

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 (none changed).
  • I did not include game files, dumps, distribution links or secrets.

🤖 Generated with Claude Code

**@⁠lukaslw-lab** on GitHub · 2026-12-02 06:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3825) `lukaslw-lab:shader/mesh-flat-integer-rows` → `main` · +23 −2 · 2 files · 1 commits · merged 2026-12-02 08:57 UTC ## Change Fixes #3826. In a direct mesh or vertex output signature, an element whose row also holds an integer element is now emitted with constant interpolation (`generic()` in `src/gfx1013_direct_graphics.inl`). Before, a float in such a row was linear, so DXIL validation rejected the row. Rows holding only floats are unchanged. ## Verification Commit `50a90fd5` on main `f365f125`. Windows 10 19045, RTX 3080 Ti (driver 32.0.16.1047), in-box D3D12 runtime, DXC 1.9.2609, release preset. | Check | Result | |---|---| | `ctest --test-dir out/build/release -R '^native_direct_mesh$'` | passed | | Same, with the source change reverted (negative control) | fails: `signature element TEXCOORD at location (1,1) ... has interpolation mode that differs from another element packed into the same row.` | | `ctest --test-dir out/build/release -R '^native_\|mesh\|ngg\|graphics' -j4` (678 tests, on main `e958b8e8`) | 327 passed, 266 skipped, 85 failed. All 85 were rerun on plain main `f365f125`: 82 fail the same way (GPU tests on this host's in-box Win10 D3D12 runtime, e.g. `CreatePipelineState 0x80070057`). The 2 `native_indexed_pixel_texture_*` tests skip on both after #3825. `native_translator_corpus_ir` is flaky on plain main too (3 of 8 runs passed, 2 of 8 on this branch; `incomplete or conflicting outputs` on a compute key). | | Local slot 86 census, 6,685 distinct mesh programs (main `0dd65da1`) | the 3 `Validation failed.` programs now compile (1,036 → 1,039 OK); no other program changes outcome | - New cases in `tests/native_direct_mesh_check.py`, built on the existing source-built container fixture: - `integer-row`: u32 `COLOR.x` and f32 `TEXCOORD.y` in one row; `TEXCOORD` becomes constant; - `float-row`: two floats in one row; `TEXCOORD` stays linear. - A program that validated before cannot hold an integer and a float in one output row, so already translated programs keep the same signature. ## Evidence and follow-up - The guest pixel stage paired with the 3 programs reads both channels of the packed attribute with `v_interp_mov_f32`. - AI-assisted (Claude Code). ## 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 (none changed). - [x] I did not include game files, dumps, distribution links or secrets. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A DXIL signature row holds one interpolation mode, and integer elements
are constant. The direct graphics translator made integer outputs constant
and float outputs linear, so a guest row that packs a u32 and an f32 failed
DXIL validation. Every element of an output row that holds a non-float
element is now constant, which matches the flat attribute read of such a
row on the guest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 06:18:34 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-12-02 07:02 UTC · original · approved these changes

Review of 50a90fd5. Read the diff; not built or run.

The change is limited to output rows in generic() (src/gfx1013_direct_graphics.inl:198-203). An output element now gets constant interpolation when its row also holds a non-system element that is not a float (component != 3). Before, only the integer element itself was constant. A float packed beside it stayed linear, and DXIL validation rejected the row. What I checked:

  • Inputs are unchanged (!input), so pixel-stage interpolation is not affected.
  • Float-only rows keep the caller's mode, and an integer element was already constant. A program that validated before cannot have an integer and a float in the same row, so programs that already translated keep the same signature.
  • System elements are excluded on both sides: the loop skips s.system, and the predicate checks !o.system. This matches the scope of generic().
  • The two new cases, integer-row and float-row, check the interpolation field of TEXCOORD in the dumped signature (constant 1, linear 2). The description reports the failure with the source change reverted.

No changes requested. Approving 50a90fd5.

**@⁠Leyukaka** on GitHub · 2026-12-02 07:02 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3825#pullrequestreview-6146134256) · **approved these changes** Review of `50a90fd5`. Read the diff; not built or run. The change is limited to output rows in `generic()` (`src/gfx1013_direct_graphics.inl:198-203`). An output element now gets constant interpolation when its row also holds a non-system element that is not a float (`component != 3`). Before, only the integer element itself was constant. A float packed beside it stayed linear, and DXIL validation rejected the row. What I checked: - Inputs are unchanged (`!input`), so pixel-stage interpolation is not affected. - Float-only rows keep the caller's mode, and an integer element was already constant. A program that validated before cannot have an integer and a float in the same row, so programs that already translated keep the same signature. - System elements are excluded on both sides: the loop skips `s.system`, and the predicate checks `!o.system`. This matches the scope of `generic()`. - The two new cases, `integer-row` and `float-row`, check the interpolation field of `TEXCOORD` in the dumped signature (constant 1, linear 2). The description reports the failure with the source change reverted. No changes requested. Approving `50a90fd5`.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 08:56 UTC · original · approved these changes

Independently built compile_dxil in Windows Debug at 50a90fd5 and ran ctest --preset dev --no-tests=error -j 1 -R '^native_direct_(mesh|container)$' --output-on-failure. Both tests passed, including the mixed integer/float row and the all-float control. The change is confined to output signatures and preserves the interpolation mode of all-float rows.

**@⁠R0Y00** on GitHub · 2026-12-02 08:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3825#pullrequestreview-6147524356) · **approved these changes** Independently built `compile_dxil` in Windows Debug at `50a90fd5` and ran `ctest --preset dev --no-tests=error -j 1 -R '^native_direct_(mesh|container)$' --output-on-failure`. Both tests passed, including the mixed integer/float row and the all-float control. The change is confined to output signatures and preserves the interpolation mode of all-float rows.
github-bot changed target branch from main to gh-pr/3825/base 2026-12-02 09:03:42 +00:00
github manually merged commit 50a90fd5d6 into gh-pr/3825/base 2026-12-02 09:03:44 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.