Skip to content

Shaders: translate the title's FidelityFX upscaler programs (FSPX images) - #258

Open
Ortomanic wants to merge 9 commits into
fxceless:mainfrom
Ortomanic:fx/fspx-upscaler
Open

Ortomanic wants to merge 9 commits into
fxceless:mainfrom
Ortomanic:fx/fspx-upscaler

Conversation

@Ortomanic

Copy link
Copy Markdown

Changes

The title's FidelityFX upscaler keeps its compute programs in FSPX images inside the container, with no DXIL part. They failed with malformed shader: no DXIL part and their dispatches were dropped, so the upscaled scene was never written.

  • First commit: an FSPX image is read as a native program (victory_shader::program_part, new fspx.rs).
  • The other eight commits are the instructions and descriptor forms those programs use that did not lower yet: v_dot4_* as Dot4AddPacked, v_pk_fmac_f16, src_scc as an operand, s_bfm_b32/s_mov_b64 literals in descriptor constants, image atomics with 16-bit coordinates, partial-channel image stores, raw views of a loaded buffer descriptor, and v_readlane_b32 at constant lanes after a whole-wave section.

Programs outside the upscaler are not affected by the first commit. This is the title's own upscaler running as translated code, so it is independent of #86 (a PC FSR path) and of #188 (a plain stretch for the dispatch); either can sit beside it.

Validation

  • CachyOS, Wine 11.22, vkd3d-proton 3.1.r64, RTX 5080 (32-lane waves).
  • In the title, before: 20 compute programs logged no DXIL part. After: none, and the upscaler's dispatches run.
  • Offline over the shader pack on a 32-lane host: of the 29 FSPX programs, 23 translate on plain upstream ffe310e with this series; all that translate convert with dxil-spirv. On this fork three more still refuse on a 32-lane host because they need a 64-lane form.
  • On NVIDIA the upscaler's output texture is an R9G9B9E5 render target with unordered access, which the host refuses; the picture only appears together with GPU: 16-bit float RGBA stands in for R9G9B9E5 render targets #32. With both, the lit world frame is shown through the title's own upscale.
  • cargo clippy --workspace --all-targets --locked -- -D warnings for the Windows target, with and without --all-features, and cargo test -p victory-shader -p xtask pass on this branch (cross-compiled from Linux with the pinned toolchain). Four unit tests are added.
  • Not run on Windows or on AMD.

AI-assisted patch with local build and runtime validation.

The upscaler's containers have no DXIL part: an ACCC part holds an FSPX
image. Its kind 0 section gives the thread-group size, wave size and
COMPUTE_PGM_RSRC1/2; kind 6 the GFX10 code, uncompressed; kind 7 the
bindings (resource and root type, table offset, register, descriptor
dwords, user-data dword, root slot), from which the used resources and
the root layout follow. Immediate samplers take no user SGPRs: the code
builds their words itself.

program_part() picks a container's DXIL part, else its ACCC part, and
native_programs() reads an FSPX image where it finds one; translate(),
victory-gpu's pipelines and the shader and translate listings use them.

(cherry picked from commit 6c43bda432578fad4897f44e8400f7e2398a549c)
The FidelityFX upscaler's programs clear a loaded buffer descriptor's
stride, multiply its record count into bytes and set its out-of-bounds
mode before byte-addressed access. The base address and everything else
stay as loaded, so it is traced as the loaded descriptor; the host reads
the buffer raw through its view. A moved base address is still another
buffer.

(cherry picked from commit 474a49135871f92be3296c7213b85685a9e0baee)
…cked

The FidelityFX upscaler's int8 network layers accumulate with them. DXIL
has the same operations: Dot4AddI8Packed and Dot4AddU8Packed (163, 164),
with the accumulator as their first operand; v_dot4c_i32_i8 accumulates
into its destination.

(cherry picked from commit d44f7518f271479cd9f27d562bae6c4b8b7b2dd6)
…read as data

src_scc reads the scalar condition as 0 or 1. The SCC a lane-mask
operation leaves (whether its result has a lane set) is whether that
mask's ballot is not zero, computed only where it is read (s_cselect on
it, say).

(cherry picked from commit b2312eb27d1afb986ccd3e261dcb36b9f736e2c0)
…ection belong to it

A wave64 reduction that joins its halves with lane 31's value is read
from lane 63 after EXEC is restored: those reads pick one lane of the
section's partial result, so they are folded into the section.

(cherry picked from commit e04ee827c53b6a8ba2a6e88f63a2063f21ae865e)
The VOP2 form has no op_sel: each half reads its own half of the
sources, and the destination's is the addend.

(cherry picked from commit 985c35654d70be389d038cb906ba36bedea58ea3)
…nstants

The FidelityFX upscaler builds its static sampler's words in the code
(s_movk_i32, s_bfm_b32, s_mov_b64 of a literal). A bit field of constant
width and offset is a constant; a 64-bit move of a literal below 2^31 is
the literal and 0 (zero and sign extension agree there).

(cherry picked from commit e123f48b32d6f0bda1f6375607247a14cacc0a91)
With a16 the coordinates are 16-bit integers, two per VGPR, unpacked as
for image loads (the FidelityFX upscaler's single-pass reduction counts
its groups so). 16-bit data still has no atomic form.

(cherry picked from commit e1f27dfeaec4701295525247d820565581533dc1)
…l holds them

DXIL's typed stores write all four channels; the console's image_store
writes those of its dmask, its data packed in channel order (d16: two
per VGPR). The others are read from the texel first (a typed UAV load,
as our image loads of UAVs are) and stored back unchanged, which is
right whatever the view's format. Unlike the console's masked write, it
races with other lanes' stores to those channels of the same texel.
A store of all four channels reads nothing.

(cherry picked from commit 57b302bf6f2612d85cb39ae0cfdc39bd07121766)
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
… rate reported; control not confirmed)

With the title's files on an NVMe SSD and a test build (abf1575 plus fxceless#258,
not in main):

- Series X: first 3D scene of the introduction after about 4.5 minutes;
  stopped at 295 s by the harness's memory guard with 201 MB of physical
  memory available and 20.1 GiB private in the process.
- Series S: 800 s without a crash, closed on request; 16.7 GiB private at
  most. Picture dark, with incomplete geometry and faces.
- No frame rate is reported: an unrelated job held about ten of the twelve
  threads, the pipeline cache was cold and texture refreshes waited for the
  mapping lock.

Next steps rewritten accordingly. Measured by Codex. English and Spanish.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
…less#258 in the paired form)

A v_readlane_b32 at a constant lane right after a whole-wave section's
restore of EXEC belongs to the section (445ef95, Section::after). The new
test takes WAVE_OR_V7_TO_S7 with its last readlane moved past the restore,
reading lane 0, or lane 63 with the halves joined by lane 31's value as the
title's wave64 reductions do, and checks (1) that wave::sections folds the
readlane in as a whole-wave OR, (2) the OR of both halves in the paired form
on the card and (3) in two host waves with the branch taken wave-wide. It
counts the paired dispatches that ran and says when none could.

program() and a_wave_or_inside() take the wave OR as an argument; the
existing tests are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 6235d3ad991f6f1332c3d34aa9d6f24cb5b3bca3)
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
…s test

The nine commits of fxceless#258 as resolved on this fork (6235d3ad, carried onto
main as 6dc5f86) and the test of the folded readlane in the paired form:
the FidelityFX upscaler's FSPX images read as native programs, v_dot4*,
v_pk_fmac_f16, src_scc as an operand, image atomics with 16-bit coordinates,
partial-channel image stores, descriptor constants from s_bfm_b32 and
s_mov_b64, and v_readlane_b32 right after a whole-wave section.

What is checked: victory-shader 252 passed, 2 ignored; the new test 10 of
10 runs with 24 of 24 paired dispatches on an RTX 4060 Ti, and three
mutations that make it fail; victory-gpu 3 of 3 runs. Of the title's 29
upscaler programs, 28 translate, validate and create pipelines on that card
(none did before); one is refused with "a root descriptor". Two sessions
ran with it, 295 s on the Series X profile (stopped by the harness's memory
guard) and 800 s on Series S, without a crash.

What is not: the picture with it has not been compared with the picture
without it, and no frame-rate effect is claimed. The Series S profile needs
it to draw at all.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
KomanderDG88 added a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
The table of what the fork adds gains fxceless#258 with its measured coverage (28 of
the title's 29 upscaler programs translate, validate and create pipelines;
none did before) and its limits (picture not compared, no frame-rate
claim). The validation table gains the folded lane read test and the shader
suite count with fxceless#258. English and Spanish.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Tresillo2017 added a commit to Tresillo2017/victory-fork that referenced this pull request Nov 25, 2026
…r the size policy)

origin/main moved by four commits after the bundle was opened.

- crates/victory-gpu/src/host.rs: one conflict in copy_mapped. fxceless#827 adds the
  COPY_MOVED counters and main adds a diagnostics-only backreads::touched
  call at the same spot. They are independent, so both are kept, in that
  order.
- crates/victory-shader/src/emit/lower.rs: main grew it to 517,382 bytes, so
  with fxceless#258 it reached 525,543, past the 512 KiB asset-policy limit. The
  self-contained method mask_scc (from fxceless#258) moves unchanged into the child
  module emit/lower/mask_scc.rs; lower.rs is 524,036 bytes. No exception was
  added to xtask/src/policy.rs.

Checked: cargo xtask policy ok; release build ok; cargo test --release for
victory-shader (100), victory-hle (220) and victory-gpu (186) all pass.
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.

1 participant