Repository navigation
Shaders: preserve live interpolation values (on #453) - #1738
jaschinski97-ops wants to merge 10 commits into
Conversation
Pixel programs that use the I/J VGPRs as plain values (custom interpolation, math on the weights) failed with "barycentrics read directly". They are now channels y and z of an SV_Barycentrics input (SM 6.1+, the emitter targets 6.6) declared with the interpolation mode of their kind (perspective/linear, center/centroid/sample), one element per mode (semantic index 0 and 1), with the Barycentrics shader flag and SFI0 feature. GFX10 interpolates P0 + i (P1 - P0) + j (P2 - P0) with P0 the provoking vertex, which the host's barycentrics weight as vertex 0, so i = y and j = z. The VGPRs are loaded on first use as a value, so programs that only feed them to v_interp_* declare nothing new. A console signature's own SV_Barycentrics row (D3D name 23) is parsed and reused. Pull-model barycentrics stay unsupported. SV_Barycentrics is left unpacked (no row, packing location -1), like other non-packed system values: the DXIL validator refuses it in a row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
v_interp_p1/p2 (and the f16 forms) fed with an i or j that is not the loaded input VGPR now evaluate each half as the hardware does: P0 + i (P1 - P0) for the first, the old dst + j (P2 - P0) for the second, with the vertex values read by attributeAtVertex. That needs the element declared constant, so every other interpolation of the same attribute row is weighed from its vertices with SV_Barycentrics of its mode, and flat reads stay loadInput of the provoking vertex. v_interp_mov of P10 and P20 reads P1 - P0 and P2 - P0 the same way when the program also interpolates the attribute (so the hardware holds the deltas); alone it is still refused. The translate command's tally counts Interp::Weighted as interpolated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
lower.rs: keep the PR's lazy barycentric VGPR inputs next to main's `Reg::S(n)` arm for uninitialized SGPRs. mod.rs: the barycentric test helper passes the structure to resource::track, which now takes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
DXIL allows at most two SV_Barycentrics input elements, one perspective
and one linear. A program reading both perspective center and centroid
I/J as values declared two perspective elements, which the validator
refuses ("There can only be up to two input attributes of
SV_Barycentrics with different perspective interpolation mode").
The second mode of the same kind is now an Unsupported reason rather
than a second element. Reusing the first element would hand centroid
reads center weights (or the reverse), which differ on edge pixels: a
silent wrong value. Before this PR such reads were refused anyway.
Test: center + centroid values are refused; centroid alone still
translates with one element.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
|
Independent offline verification for a cutscene shader that the runtime producer trace linked to two missing 1440p texture outputs. On Windows 10 22H2 / RTX 3070, the exact pixel-shader container previously failed translation with "the first half of an interpolation" at its color export. The trace followed the unavailable first-half value through SSA merges to that export. PR #1293 and PR #683 each left this specific failure in place in local offline comparisons. I tested this PR at d39a027 on the same container, selected by its runtime BLAKE3 prefix 7778fb128a65511e. It translated successfully, and Microsoft's DXIL validator accepted the emitted shader. Five focused first-half unit tests also passed in the integrated diagnostics build. This verifies the identified shader translation failure, while cutscene rendering and the separate driver hang still need a runtime comparison. No game content or disassembly attached. AI-assisted diagnostics and write-up. |
|
Runtime follow-up on the RTX 3070 / Windows 10 run with #1738 d39a027 added to the Agility, Wave64, buffer-transition, bounded root SRV, packed render-target and producer trace test stack. With the final presentation path enabled, the log explicitly reports that the previously rejected pixel shader translated. The prior interpolation error and producer warnings naming that shader were absent. Black frames still occurred, and the process eventually exited with DXGI_ERROR_DEVICE_HUNG following a 32-list submission. The DRED range contains a mesh dispatch (operation 42) without a marker identifying its pipeline. Windows recorded NVIDIA display-driver recovery one second later. This verifies the shader fix in-game. The overall black-screen and driver-reset issues remain open. AI-assisted log analysis. |
|
Automated triage for the maintainers. Needs work. What changed since the last triage: the head merges The content itself (first-half liveness in
The earlier suggestion to split out the P0-beside-interpolation fix ( Generated by Claude Code |
|
Tested #1738 (d39a027) against its base ffe310e with
Net +216 VS/PS programs. The 32 new "opaque lane mask" refusals are programs that now get past I/O and stop later; compute (1,441) and mesh (8,214) are unchanged. The 28 first halves match mercuryVM's count on #1099, and from the code a first half read as data keeps P0 + i·P10 rather than 0, which was the concern there. For comparison, #1682 on the same base gets 12,419: it clears the 207 + 13 but still refuses the 28 first halves. Not checked: DXIL validation (the Windows SDK 10.0.19041 dxil.dll crashes with 0xC0000005 under |
|
Follow-up with validation, using dxil.dll from DXC v1.9.2609 (my SDK validator was the crashing one). Same shader pack, per program, ffe310e → #1738:
Still not checked in game. AI-assisted. |
|
Current head 08e2e07 includes main 940d32f and the synthetic-test interface updates. The needs-rebase triage on d39a027 is addressed. The previous 351dc2d CI passed; this new follow-up is uploaded for CI. The archive measurements above concern the old ffe310e/d39a027 stack. I have not independently run that archive. Current main already harmonizes unused generic-float siblings in a signature row, so the three old row-validator reports do not by themselves establish the same defect on the current head. A separate current failure is now reproduced and fixed: a P0 vertex read beside an ordinary interpolation of the same row returned Final targeted run: 20 tests pass, including 13 render cases / 6,656 checked channel results; Clippy all targets/all features with warnings denied and asset policy pass. Full shader/CI reruns will be recorded in the description. Follow-up claim: #1633 (comment). #1682's broader, now-closed manual-row work and #2038's isolated P10 handling were checked for overlap. Synthetic fixtures only, no title data or game-playability claim. AI-assisted with independent coordinator review and GPU checks. |
|
Code review and RTX 5090 + WARP + DXIL verification at head
Implementation and hardware rendering look great — just needs extracting helpers out of |
|
From a tester working with Claude (AI-assisted, Claude Code): an offline check of this PR over a whole title's shader pack (25,889 distinct containers through
Not run: your GPU tests, NVIDIA, and the title in a game run, so this says nothing about the pictures of the 10,236 programs that changed but were already translating. Translation and conversion only. |
|
Measured offline on the title's shaders (the method in #1247), head That makes it the last piece. With the stack in #1247 (#1924 port, #2978, #385, #2999, #1737, #3016, #2363), every program of the title except the 71 mesh programs over the validator's output size would validate. One caution for the merge order: this PR edits |
|
Tested Thanks for Census ( Tests (WARP, The unit tests are synthetic. Local title data was used offline for the census: a translation of the title's shader pack, with only counts and refusal reasons reported. AI-assisted |
|
Following up on the merge-order note above: I ported this PR (
Measured on that port (offline, the title's shaders, RX 7900 XTX): +1 on the stack, 26,013 of 26,084 validated (+1,163 on |
Keep the real value of an interpolation first half, P0 + i*(P1-P0), when it is exported alone, consumed beside a folded pair, used through a phi, or used as another interpolation's weight. Omitting it can refuse translation or lose the partial result.
Includes #453's barycentric/Weighted infrastructure, with its original author commit retained. Updated against main 940d32f, preserving Elsewhere/unless proofs, packed input/signature handling, initialized pixel SGPRs, and the merged f16 output-modifier fix in #1696. Coordination: PR #1738 in #1633. This complements #1099: replacing an unlinked first half with zero does not preserve its value.
Track demanded first halves through SSA dependencies and phis, retaining the unwritten destination half of f16 P2.
Allow P0 vertex reads beside ordinary interpolation of the same row: retain flat vertex access and evaluate the interpolated value from vertices. P0-only and ordinary-only paths retain their existing feature requirements.
Avoid extra barycentric requirements for a dead first half overwritten under entry EXEC or a safe ordinary pair after register reuse. Keep masked-move dependencies.
Resolve conditional pairs using the existing avoids proof before final liveness/signature selection. Unsafe pairs use actual native weights, including transitive first-half dependencies.
Preserve op_sel destination halves, omod and clamp in both ordinary and Weighted f16 paths.
Validation: Windows 11, NVIDIA GeForce RTX 3080, driver 32.0.16.2140; Rust 1.98.1 Windows GNU.
Standalone, dead-overwrite, safe-ordinary/no-extra-feature and f16-preservation regressions fail before their respective corrections.
Final targeted suite: 20 barycentric tests pass, including real GPU rendering. An 8x8 synthetic triangle checks 6,656 channel results across RTX 3080 and WARP: standalone f32, partial+full f32, exact f16 bit preservation, computed i/j in place, high-half writes with omod/clamp and a preserved low-half marker, and P0 before/after an interpolation in the same/different channel.
CPU tests also cover phi reads, masked moves, transitive computed weights, upstream ordinary-register reuse and output modifiers. Clippy, all targets/all features, warnings denied: passed. Asset policy passed.
Fixtures contain synthetic instructions and vertex data only. No game boot, image-quality or FPS claim is made. Hosts without barycentrics skip render checks; existing barycentric-mode restrictions remain.
AI-assisted with Codex: separate worktrees for research and implementation, followed by independent reviews and coordinator GPU validation. GPU test processes were serialized centrally.
Combined local validation before the P0 follow-up (main 940d32f + all three contributions, integration cfa116d):
cargo clippy --locked --workspace --all-targets --all-features -- -D warnings: passed.cargo test --locked --workspace --all-features --no-fail-fast -- --test-threads=1: completed unfiltered; six tests fail. Shader suite: 271 passed, 3 failed, 3 ignored. GPU suite: 145 passed, 2 failed, 2 ignored. The five GPU/shader failures were independently reproduced on bare main 940d32f. The sixth isloads_binds_and_calls_probe: its unchanged fixture passes MSVC/DELAYLOADto the local GNU linker, which rejects it.The baseline failures are
dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views,a_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zeros, andgathers_at_a_level_match_the_hardware. The full local workspace run is therefore explicitly not reported as passing.New regression tests and the repository asset policy pass. All three PRs also pass GitHub's Windows MSVC CI. Green CI does not substitute for the separately reported RTX readback evidence.
P0 follow-up 08e2e07: the synthetic mixed P0/ordinary-row case failed before the correction with
one input interpolated two ways; all four order/channel combinations now validate and render correctly. Twenty targeted tests, shader Clippy (all targets/all features, warnings denied), and asset policy pass. Claim: #1633 (comment). Full current-head shader rerun: 267 passed, 3 failed, 3 ignored. The three failures are exactly the independently reproduced main-940d32f heap/stride/gather baseline cases listed above. Windows MSVC GitHub CI passes on 08e2e07 (run https://github.com/Marvisak/VIctory/actions/runs/45600161321).Refresh against main 67e8ae1 (2026-11-25)
Current-main refresh: head
9d59892merges main67e8ae1401df112248aed36d0024483181b718b7and adapts the new countedv_movreldinput-initialization proof to lazy barycentric reads. The overwrite proof is checked before loading a phi's original input, so a complete overwrite still introduces no BARYCENTRICS requirement. The upstream test's former unsupported-barycentric outcomes now verify the retained input instead of rejecting a newly supported shader: 2 complete-overwrite cases have no barycentric feature/input, and all 13 other cases retain exactly one barycentric element. All 15 generated shaders pass the local DXIL validator.On the refreshed stack: 17 general emitter tests and all 20 interpolation tests pass, including the 13 render cases / 6,656 channel checks on RTX 3080 and built-in WARP. Workspace Clippy, all targets/all features with warnings denied, passes on the combined stack. The asset policy passes. GitHub Windows MSVC CI: https://github.com/Marvisak/VIctory/actions/runs/45652319615 (passed on this head). Earlier full-suite results above are explicitly tied to their older main revisions; no new full native-workspace pass is claimed.
Coordination bookkeeping: the earlier claim label was incorrect; see the correction. The completed P0 follow-up is assigned as NEW-120.