Skip to content

Shaders: retain live interpolation first halves - #52

Closed
jaschinski97-ops wants to merge 3 commits into
fxceless:mainfrom
jaschinski97-ops:fix/standalone-interpolation
Closed

jaschinski97-ops wants to merge 3 commits into
fxceless:mainfrom
jaschinski97-ops:fix/standalone-interpolation

Conversation

@jaschinski97-ops

@jaschinski97-ops jaschinski97-ops commented Nov 24, 2026 •

Copy link
Copy Markdown

A synthetic pixel shader exporting v_interp_p1_f32 without its second half fails with the first half of an interpolation. The same happens when the partial result is copied for another calculation before an otherwise ordinary loaded-i/j pair completes. That failure message is also reported in #7; the reported title shader itself was not available for validation.

I/O raising now records first halves whose SSA values are consumed outside a folded complete interpolation, including values reaching a consumer through phis. They use the existing weighted interpolation lowering (P0 + i * (P1 - P0)). Normal loaded-i/j pairs retain their current single host interpolation and do not gain barycentrics or per-vertex attribute reads. Computed-weight pairs retain their existing handling.

Validation on Windows 11 / NVIDIA RTX 3080, driver 32.0.16.2140, Rust 1.98.1 / Windows GNU:

  • Two synthetic emission regressions failed before the change and now pass: a standalone first half and a live partial result beside a complete pair. DXIL validation passes.
  • A synthetic full-screen triangle renders both cases on the RTX 3080 and WARP. All 1,024 returned channel values match the expected partial/full interpolation expressions within 1e-5.
  • Additional I/O tests cover first halves through a phi and registration of a standalone v_interp_p1ll_f16 (the f16 form was not executed on the GPU).
  • Existing interpolation_alone_declares_no_barycentrics and computed-weight tests pass, preserving the ordinary-pair optimization.
  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 215 passed, 0 failed, 2 existing ignored tests (90.94 seconds).
  • Clippy for victory-shader, all targets, diagnostics,host, with -D warnings: clean. Asset policy: 169 files OK.
  • Local integration with Shaders: lower row permutations on wave32 hosts #40: 217 shader tests passed, 0 failed, 2 existing ignored; combined Clippy with diagnostics,host and -D warnings and the asset policy pass. The changes combine without conflicts.

No gameplay or shader-corpus result is claimed. No title data, dumps or extracted code are included. Synthetic programs and tests are our own. Instruction semantics: AMD RDNA 2 ISA section 12.11, https://docs.amd.com/v/u/en-US/rdna2-shader-instruction-set-architecture

AI-assisted contribution with Codex; code and hardware/software rendering tests run locally.

Additional review corrections in c194f64: demand-based first-half tracking avoids unnecessary barycentrics for a dead value overwritten by a full move, preserves masked-move dependencies, and retains the old destination High16 of a folded f16 P2. The dead-overwrite test fails before the fix. The extended render test checks 1,536 channel results on RTX 3080 and WARP, including exact old-High16/new-f16-Low16 bits. Final branch shader suite: 218 passed, 2 pre-existing ignored; Clippy and asset policy pass. All fixtures remain synthetic.

@adriaespii

Copy link
Copy Markdown

Independent test run on commit 81a8e2e (AMD RDNA4):

  • Hardware: AMD Radeon RX 9070 (driver 32.0.32015.7029), AMD Ryzen 5 7600, Windows 11 Pro, Rust 1.98.1 (x86_64-pc-windows-msvc)
  • cargo clippy --workspace --all-targets -- -D warnings: 0 warnings
  • cargo test --workspace: 501 passed, 0 failed, 7 ignored (victory-shader: 215 passed, 0 failed, 2 ignored; victory-gpu: 110 passed, 0 failed, 1 ignored)
  • Not tested: live game run (no game files on this machine)

AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.

@rocobalt1

Copy link
Copy Markdown

Offline coverage of this PR on the retail pack, measured on its own (not stacked with the other first-half PRs, because #52 and #77 both edit emit/mod.rs and conflict).

Method: worktree at 4e17478 (this PR's base), cargo build --release -p victory, then victory.exe translate <shaders.rpf> --validate --list --jobs 20 with the same Windows SDK validator, compared program by program by the program hash printed in the --list line against the same command on 4e17478 alone.

programs validated
4e17478 26 531 25 370
+ this PR 26 531 25 218

+8 gained, -160 lost.

The 8 gained are the ones this PR is after, and they are real:

PS_DeferredTextured_9e3a1555   PS_DeferredTextured_c5fd36bb
PS_MirrorReflectionDeferredTextured_862306ef / f0a15084 / d3b47178
PS_MirrorReflectionDeferredDecalTextured_38f9dc3e / e3251b40

PS_DeferredTextured_9e3a1555 is refused in the title on my machine (GFX10 code at 0x1464: the first half of an interpolation is not supported), so these 8 are worth having.

The 160 lost are all pixel programs, and they cluster on peds and fire:

 51  PS_PedTextured_Eight_Decals
 51  PS_MirrorPedTextured_Eight
 28  PS_PedTexturedCutOutTint_Zero
 10  PS_PedAlphaPrepass_Fire
 10  PS_PedAlphaTransmission_Fire
 10  PS_PedTextured_Eight_Fire

For comparison, #77 on the same base gains the same 8 and loses 0, so the 8 do not need this PR, while the 160 do come from it.

Is that expected - are the ped/fire programs meant to be refused until something else lands? I did not look at the diff for a reason, only at what the translator does, so this may be a known trade. On my side it is the difference between "worth trying in the title" and "not": PS_PedAlphaPrepass_Fire/PS_PedTextured_*_Fire are exactly the programs a burning character needs, so I would not run this build to look at one.

No game data; counts and program names only.

@arminkhaleghirod

Copy link
Copy Markdown

Merged onto main 90228a7 and ran victory translate --validate over the full title (26,148 programs) on Windows 11 / RTX 4080. Changes against main, by failure reason:

  • the first half of an interpolation: 8 → 0 (DXIL emitted 14,168 → 14,176)
  • New: 160 programs now fail the validator with signature element TEXCOORD at location (0,2) size (1,2) has interpolation mode that differs from another element packed into the same row. On main they only had the common PSV mismatch.

For comparison, #77 clears the same 8 with no new failure reason.

@KaliemSB

Copy link
Copy Markdown

Tested on the title's own shaders: all 8 "first half of an interpolation" programs now translate, validate and get a pipeline on an RTX 4060, with no regressions in the rest of the archive.

Setup

  • CPU / RAM: Intel Core i5-12400F, 32 GB
  • GPU: NVIDIA GeForce RTX 4060 8 GB (32-lane waves), driver 621.24
  • OS: Windows 11 Pro 24H2 (build 26100)
  • Toolchain: rustc / cargo 1.98.1, cargo build --release -p victory
  • Validator: dxil.dll 1.9.2609.5 (VICTORY_DXIL)
  • Trees: base 4e17478 (fork main) against this PR's head 81a8e2e, which is main plus this PR. Nothing else merged.
  • Translation settings: VICTORY_HOST_WAVE=32 VICTORY_VIEW_LIMIT=999999, the same forms the runtime picks on this card (32-lane waves, view heap capped at 1,000,000)

Whole archive (victory translate <dump> --list, 26,599 containers, 26,148 programs):

base 4e17478 PR 81a8e2e
vertex/pixel DXIL emitted 14,168 of 14,259 14,176 of 14,259
the first half of an interpolation 8 0
programs that newly fail – 0
programs whose failure reason changed – 0

The 8 programs, each extracted and run on its own with --validate and then with --pipelines:

program hash base PR
PS_DeferredTextured 78f3f2fc53a69531 first half validated, pipeline created
PS_DeferredTextured 38bf0814e721a1b3 first half validated, pipeline created
PS_DeferredTextured 8445dcb2b63aa197 first half validated, pipeline created
PS_MirrorReflectionDeferredDecalTextured 5ddcaa08d4a51215 first half validated, pipeline created
PS_MirrorReflectionDeferredDecalTextured 464ea474374b8ecd first half validated, pipeline created
PS_MirrorReflectionDeferredTextured 288c43f50bc7abee first half validated, pipeline created
PS_MirrorReflectionDeferredTextured 15547db9d31b056b first half validated, pipeline created
PS_MirrorReflectionDeferredTextured 007bb29b393d08c5 first half validated, pipeline created

Two of these (78f3f2fc…, 38bf0814…) were also logged as shader does not translate in a 31-minute game run on this machine at 1684989.

Tests, cargo test -p victory-shader:

  • With the default validator, 81a8e2e gives 212 passed and 3 failed. 4e17478 alone gives 208 passed and 2 failed.
  • The 2 rect::tests failures already happen on main.
  • The third failure is this PR's new first_half_values_render_on_hardware_and_warp. It fails with the same error: Container part 'Pipeline State Validation' does not match expected for module.
  • With no VICTORY_DXIL, the tests pick the newest Windows SDK dxil.dll, here 10.0.22621.0 (1.6.2112). Using dxil.dll 1.9.2609.5, or merging Shaders: write every PSV0 semantic name again, as DXC does (fixes #12) #61 on top, makes all 7 related tests pass: the 5 new ones and the 2 rect ones.
  • So the failure comes from the validator's PSV check, which Shaders: write every PSV0 semantic name again, as DXC does (fixes #12) #61 addresses, and not from this change.

I didn't do a game run with this PR, so I haven't seen these draws on screen.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the translations and tests, and drafted this; the machine is mine. No game files or extracted shaders attached.

oceansde012 pushed a commit to oceansde012/victory-gta6 that referenced this pull request Nov 25, 2026
…rror-and-query-bounds

GPU: hold SHADER_HEAPS across descriptor mirror and check query offsets
(cherry picked from commit 1117251)
oceansde012 pushed a commit to oceansde012/victory-gta6 that referenced this pull request Nov 25, 2026
- gfx10::Instruction::new: upstream fxceless#1180 made the decoded name a private
  field; the fork's lane-mask unspill builds instructions, now through it.
- descriptor.rs: shader_slot kept beside upstream fxceless#52's locked mirror();
  the fork's late texture views still look slots up through it.
- semantics_tests: the HostShader of this fork (no memory/view_addresses
  flags; root_indexed_views).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FLuVRkN9XKxpoYQhz4KNXw
PiloteCode added a commit to PiloteCode/victory-fork that referenced this pull request Nov 25, 2026
…ull requests and the host FidelityFX on our layer; our translator, title memory and copy-back kept

319 commits past ffe310e, merged onto wave4. Most of its runtime pull
requests were here already, picked one by one (fxceless#653 and fxceless#716,
prhle, offpr): where a change arrived both ways, the copy this branch had
is kept (net, audio, xg, runtime, lifecycle with its one stand-in window
(#1677), files, kernel, xasync, xgamesave, xmem, gameinput, the loader's
crash, clzero and publish code, the pipeline cache, #1658's staging clamp).
The rest is the resolution first made on wave2 (offm-on-wave2, ab1d525),
carried over:

- crates/victory-shader: ours (every conflict --ours). Kept from theirs
  only what landed whole: fxceless#661 SP3 text operands, fxceless#1021 s_atc_probe's
  immediate, #1636 FLAT offsets. Reverted where half landed: fxceless#1180, range.rs,
  fxceless#617's bench, #1337's sampler, ACCC, SOURCE_HASH, and new test files whose
  mod lines are in conflicted files. The rest is to be ported on its own.
- victory-gpu: ours plus the official units taken, each from its own
  diff: host.rs (fxceless#615 switch=0 is off, fxceless#1082 TDR log, #1626 swap-chain
  retries throttled), descriptor/host.rs (fxceless#974, its walk no longer cut at
  2^18 steps by ours), descriptor.rs (fxceless#52: a mirror holds the heaps' lock
  while it uses the heap, a read lock on this branch's RwLock, and so does
  our re-mirror of waiting slots), resource.rs (fxceless#52, fxceless#504 depth/stencil
  footprints, #1390 A8), pipeline/host.rs (fxceless#618), pipeline.rs (a stream
  subobject past its end not read), capture.rs (fxceless#615, fxceless#1146, a D24 depth
  plane dumped as depth), frame.rs (fxceless#174, with our late-wait shortcut inside
  the tick reservation), device.rs (fxceless#928, feature queries 7/8/23), list.rs
  (#1446, fxceless#52), external.rs (host FidelityFX, VICTORY_FIDELITYFX_DIR, off
  unless set), switch.rs, tdr.rs, and the small PRs (fxceless#553, #1562, fxceless#270,
  fxceless#153, #1453, #1204, fxceless#1173, #1206, fxceless#474).
- Not taken, ours kept: title memory at raw addresses (27c3dc9, 0f63757,
  6d021fe: their memory.rs and Upload), page marks (cd94d35, 940d32f: with
  our shaders every write through a view would be lost), bindless.rs and the
  change journal (c75fdba), root views and retirement at execute end
  (d71c388: unsafe with flights in the air), rectangle GS and table
  constants in place (683ad7a), twins and shared host textures (13bbd6f),
  heap copies (86a5ed6, bacb06a), the shader cache key, warm-up, pipeline
  queue and library (c47b529, 9c58a1c, fxceless#1000, #1660), #1510, #1635, #1246,
  fxceless#322, #1322, fxceless#669, fxceless#197 (turned down by prhle), #1726 (ours waits longer;
  its test added), the console upscaler's UAV clears. `translate --cache` is
  `--warm all` (with the adapter probe); the pipeline pre-build is not in.
- Also taken: the shader pack and the database's effects (shader-info), the
  startup archive check (fxceless#12, on this branch's KnownBuild with its patches),
  and the runtime PRs not here yet (FidelityFX's config and module).
- The title is not named in the merged-in comments (4e17478).

Details, the overlaps and what to watch: README, "The official
repository, merged".
@jaschinski97-ops
jaschinski97-ops deleted the fix/standalone-interpolation branch November 26, 2026 18:11
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.

5 participants