Skip to content

Support isolated P10 reads on pixel shader inputs - #2038

Closed
DoubleD17 wants to merge 1 commit into
Marvisak:mainfrom
DoubleD17:port/fxceless-439
Closed

DoubleD17 wants to merge 1 commit into
Marvisak:mainfrom
DoubleD17:port/fxceless-439

Conversation

@DoubleD17

Copy link
Copy Markdown
Contributor

Isolated P10 reads in v_interp_mov_f32 now lower to the difference between vertex 1 and vertex 0 for eligible generic float32 pixel inputs. Preserve the input signature and the existing modes for P0 and coordinate pairs. Reject conflicting interpolation modes on the same row. Four focused tests passed on Windows x64 with DXIL validation using SDK 10.0.26100.0. On D3D12 WARP (DXGI 1414:008C), the packed VS/PS synthetic draw read back 0.5 for P10 and 0.25 for P0. Draw validation covers an unclipped synthetic triangle in host vertex order.

Adapted from fxceless/victory-fork #439.

AI-assisted.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-shader --lib isolated_p10 — 3 passed, 0 failed (1 ignored) on both RTX 5090 hardware and VICTORY_D3D12_WARP=1
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean support for isolated P10 reads on pixel shader inputs preserving packed input linkage and rejecting incompatible live interpolation. Looks good.

AI-assisted (Gemini 4 Neon).

@jeremygold02

Copy link
Copy Markdown
Contributor

Triage verdict — Keep for the tested generic float32 inputs (8c498ab)

Evidence

  • @DoubleD17's patch lowers isolated P10 to the difference between the first two host vertex attributes while retaining P0, packed input linkage, and the rejection for incompatible live interpolation. The existing review covers the default tests. I checked the opt-in render path separately. Opt-in draw

Checks and limits

  • On WARP, the opt-in packed VS/PS draw returned P10 = 0.5 and P0 = 0.25. A disposable variant moved the first vertex behind the near plane while keeping the sampled pixel covered. Both values stayed the same and DXIL validation accepted both variants.
  • This adds coverage for clipping on a triangle using host vertex order. It leaves console strip ordering and rectangle-list decomposition open. The host rectangle path emits two triangles with different second vertices, so the same subtraction need not produce the same coefficient on both halves. Rectangle emission

Next step

  • Keep the scope explicit. Before claiming rectangle or strip parity, compare asymmetric vertex attributes against a console reference across both constituent triangles.

This verification was AI-assisted.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.

147 passed / 0 failed. Isolated P10 reads on pixel shader inputs (+3 tests) — 10-bit pixel-input path; mixed apps+shader, apps half Windows-only.

@upipibi

upipibi commented Nov 25, 2026

Copy link
Copy Markdown

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at 8c498ab. victory-shader: 247 passed, 3 failed, 4 ignored; the 3 non-ignored isolated_p10_* tests pass. I also ran the ignored one: isolated_p10_and_p0_draw_with_a_packed_signature passes with --ignored (Windows SDK DXC, the DXIL validator and WARP are on this machine). The 3 failures are #1744's NVIDIA failures on main. Same as main on this hardware. Not run: a title.

AI-assisted (Claude Code).

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

The P10 path also covers standalone P20 with one change: select vertex 2 instead of vertex 1 before subtracting P0. 665452c extends the same generic float32 path in one commit on 8c498ab.

On that exact head, the extended packed-signature WARP draw read back P10 = 0.5 and stopped at P20 with "a non-provoking vertex value". With the commit, all three shaders passed DXIL validation and the draw read back P10 = 0.5, P20 = -0.125 and P0 = 0.25. Both coefficient selectors also pass the packed-signature and incompatible-live-interpolation tests. The draw uses an unclipped triangle in host vertex order.

The full forced-WARP shader suite reported 247 passed, 3 failed and 4 ignored on both builds. The gather, lane-permute and edge-flagged triangle failures were shared. Strict shader Clippy and staged asset policy passed.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs work.

emit/lower.rs now lowers a v_interp_mov_f32 of P10 (Interp::Vertex { vertex: 0 }, previously refused as "a non-provoking vertex value") on an unpacked generic float32 input to attributeAtVertex(1) - attributeAtVertex(0) in the new isolated_p10, marks the input used with constant interpolation, sets the SFI0 barycentrics feature (flags::BARYCENTRICS, 0x2_0000, correct bit and no collision with the existing flags), and rejects a row that another live read needs in a different mode. The code is careful and the tests cover the signature, PSV and the conflict case.

What it needs:

  • Evidence and motivation. This changes shader semantics with no stated reference. P10 = P1 - P0 matches the public RDNA ISA description of parameter interpolation, so please cite that, and say how many title programs translate reports with "a non-provoking vertex value" today and how many this clears.
  • Vertex order. The result is only right when the host's vertex 0/1 match the console's P0/P1. That holds for the tested unclipped triangle list in host order, but not obviously for strips or for rectangle lists, which emit/rect.rs splits into two triangles with different second vertices (raised in the earlier review). Before, these shaders failed to translate; now they would produce silently wrong values for such draws. Either show parity for those cases or document the limitation with a shortcut: note at isolated_p10.
  • P20 (665452c, offered in the comments with WARP results) fits the same path; consider folding it in. Shaders: preserve live interpolation values (on #453) #1738 covers P10/P20 for rows that are also interpolated; the two should agree on vertex order.

CI: passing (check).


Generated by Claude Code

@DoubleD17
DoubleD17 marked this pull request as draft November 25, 2026 09:57
@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

Your refreshed head documents the ISA and the vertex-order constraint. I ported the isolated P20 follow-up to that exact head, 30b0692, and added clipped triangles to the packed-signature draw. 8b8c90d

On 30b0692 with the same test, P10 reads 0.5 with and without clipping, and P20 stops at “a non-provoking vertex value”. With the follow-up, P10, P20 and P0 validate and read 0.5, -0.125 and 0.25 respectively for both triangles. All four focused tests passed on WARP. The full WARP shader run went from 245 passed, 5 failed, 4 ignored to 247 passed, 3 failed, 4 ignored. The gather, lane-permute and edge-flag failures were present on both builds. Clippy and repository policy passed.

The shortcut still documents the open vertex-order question for strips and rectangles. AMD's definition of P20 as P2 - P0 is in section 12.2 of the RDNA 3 ISA.

Please preserve the Git author if you take the follow-up. If the code or test is folded into your commit, please add:

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted. Synthetic tests only.

@sinan-cmyk

Copy link
Copy Markdown

Offline measurement on a retail dump

Result: no count change against main.

I merged head 30b0692 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants