Skip to content

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

Open
lukaslw-lab wants to merge 1 commit into
R0Y00:mainfrom
lukaslw-lab:shader/mesh-flat-integer-rows
Open

lukaslw-lab wants to merge 1 commit into
R0Y00:mainfrom
lukaslw-lab:shader/mesh-flat-integer-rows

Conversation

@lukaslw-lab

Copy link
Copy Markdown
Contributor

Change

Fixes #3824. 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 #3823. 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

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 <noreply@anthropic.com>

@Leyukaka Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

shader: a mesh output row that packs a u32 and an f32 fails DXIL validation

2 participants