Skip to content

GPU: 16-bit float RGBA stands in for R9G9B9E5 render targets - #32

Closed
arminkhaleghirod wants to merge 2 commits into
fxceless:mainfrom
arminkhaleghirod:rgb9e5-stand-in
Closed

arminkhaleghirod wants to merge 2 commits into
fxceless:mainfrom
arminkhaleghirod:rgb9e5-stand-in

Conversation

@arminkhaleghirod

Copy link
Copy Markdown

The game renders to R9G9B9E5 (format 67). No PC GPU can, so the texture was refused and the render target view made for it removed the device: on an RTX 4080 in Series S mode that happened at the first loading screen, every run (debug layer: CreateRenderTargetView: The format (0x43, R9G9B9E5_SHAREDEXP) cannot be used with a RenderTarget view).

This adds 67 → R16G16B16A16_FLOAT to the stand-in table target_format already uses for the 16-bit colour formats, so views, pipelines and clear values follow it. FP16 holds RGB9E5's precision and range.

With it the same machine gets through loading into the opening cutscene. Built and cargo test -p victory-gpu passes.

Upstream has the same idea in Marvisak/VIctory#492.

armin added 2 commits November 24, 2026 12:39
No PC GPU renders to R9G9B9E5, so CreateRenderTargetView on such a
target removes the device. Add it to the existing stand-in table, next
to the 16-bit colour formats.
@adriaespii

Copy link
Copy Markdown

Independent test run on commit 9ba864a (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: 496 passed, 0 failed, 7 ignored (victory-gpu: 110 passed, 0 failed, 1 ignored; victory-shader: 210 passed, 0 failed, 2 ignored)
  • Not tested: live Series S / retail title run (no game files on this machine)
  • Small note: target_format checks Support1 (D3D12_FORMAT_SUPPORT1_RENDER_TARGET | D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW), but not Support2 & D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE. Checking UAV_TYPED_STORE as well would guard against adapters that expose typed UAVs for R9G9B9E5 without typed UAV store support.

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

@arminkhaleghirod

Copy link
Copy Markdown
Author

Thanks for testing. On the typed-store check: target_format already asks whether the host takes 67 as a render target and typed UAV, and uses the stand-in only when it doesn't. The stand-in, R16G16B16A16_FLOAT, is one D3D12 requires for both on every feature level the project targets, so the stand-in itself doesn't need checking.

@HenriqueSBueno

Copy link
Copy Markdown
Contributor

A regression report for this PR on the Series X profile (RTX 3080 10 GB, driver 616.92, this fork at 4e17478 with this PR merged locally, diag build, same switches and save in all runs):

build profile picture
4e17478 Series X lit prologue (run 1)
4e17478 + this PR Series S boots and reaches the world, as reported in #13, but black (#176)
4e17478 + this PR Series X black from about frame 2400 on (internal captures and window), no device loss
4e17478 (PR removed again) Series X lit again, same save and switches

So the R9G9B9E5 → RGBA16F stand-in fixes the Series S device removal but blacks out the Series X picture on this card. One guess: views of the packed-light textures that the title places at the same addresses, which on Series X sample those textures as R9G9B9E5 (resource.rs around the comment at line 1192). If the stand-in changes what those views read, the light reads as zero. Could the stand-in be limited to targets the host cannot render to as R9G9B9E5, leaving the compute-packed light textures alone?

AI-assisted (Claude Code)

@AwkGrep256

AwkGrep256 commented Nov 24, 2026 •

Copy link
Copy Markdown

That fits how upstream handles it. Main keeps RGB9E5 textures as real RGB9E5 textures and makes them castable to the other 32-bit formats, so a compute pass writing the packed light as R32_UINT and a view reading it as RGB9E5 share one host texture (draw.rs has a test for that exact case, the sky tables). The only place that needs a stand-in is where something writes RGB9E5 through a typed UAV, which is the FSR output: in Marvisak/VIctory#1793 the upscaler writes an FP16 stand-in that gets packed back into the RGB9E5 texture. Moving the fork to castable textures would keep the light textures reading what the compute pass wrote, instead of swapping the whole format.

Edit: The FP16 stand-in described above was removed from Marvisak/VIctory#1793. Main’s host upscaler writes RGB9E5 directly, and both the RX 9070 XT and WARP report typed UAV store support for that format.

sagouindupm added a commit to sagouindupm/victory-fork that referenced this pull request Nov 24, 2026
In its Series S mode the title renders at 1280x720 and calls the console's
FidelityFX upscaler (`ffxDispatch` of amd_fidelityfx_loader_xbox.dll) to make
the 1920x1080 output. The loader and upscaler are the title's own DLLs and
run, but the upscaler's passes are compute pipelines in a container that is
not translated ("falling back to NewBE" in the title's log), so the output
was never written: the world was black behind the interface.

The executable's import of `ffxDispatch` is now bound to ours. An upscale
dispatch (type 0x10001, the public FidelityFX API's layout) is recorded as
`victory_gpu::list::upscale_stretch` of its colour input into its output;
any other dispatch, and an upscale that could not be stretched, goes to the
title's DLL. The DLL is not registered as an HLE module: that kept the
title's own from loading and left its other three entry points missing.

Measured on an RTX 3050 8 GB, Windows 11, release build, on top of the
R9G9B9E5 stand-in (fxceless#32): the Series S world renders (opening cutscene), 0.4
to 1.2 s a frame with peaks of 3 s, the card about a quarter busy, 7 GB of
video memory, no host error in a five-minute run. Series X is not affected
in the run made (it does not dispatch the upscaler).

Not done: temporal accumulation, sharpening, use of the depth and motion
inputs. No test yet. Only the opening cutscene was looked at.
@arminkhaleghirod

Copy link
Copy Markdown
Author

Thanks @HenriqueSBueno, and @AwkGrep256 for the explanation. That's it: the stand-in also caught the packed-light textures, which the title writes as R32_UINT through another view.

I'm narrowing it so R9G9B9E5 gets the stand-in only when it's a render target (the Series S upscaler output). Unordered-access-only R9G9B9E5 textures keep their format, as on main. Series S still gets past the old crash here (no device loss to frame 1890). I'm checking Series X past frame 2400 now, and I'll push once it holds.

justlovett0 pushed a commit to justlovett0/victory-gta6 that referenced this pull request Nov 25, 2026
In its Series S mode the title renders at 1280x720 and calls the console's
FidelityFX upscaler (`ffxDispatch` of amd_fidelityfx_loader_xbox.dll) to make
the 1920x1080 output. The loader and upscaler are the title's own DLLs and
run, but the upscaler's passes are compute pipelines in a container that is
not translated ("falling back to NewBE" in the title's log), so the output
was never written: the world was black behind the interface.

The executable's import of `ffxDispatch` is now bound to ours. An upscale
dispatch (type 0x10001, the public FidelityFX API's layout) is recorded as
`victory_gpu::list::upscale_stretch` of its colour input into its output;
any other dispatch, and an upscale that could not be stretched, goes to the
title's DLL. The DLL is not registered as an HLE module: that kept the
title's own from loading and left its other three entry points missing.

Measured on an RTX 3050 8 GB, Windows 11, release build, on top of the
R9G9B9E5 stand-in (fxceless#32): the Series S world renders (opening cutscene), 0.4
to 1.2 s a frame with peaks of 3 s, the card about a quarter busy, 7 GB of
video memory, no host error in a five-minute run. Series X is not affected
in the run made (it does not dispatch the upscaler).

Not done: temporal accumulation, sharpening, use of the depth and motion
inputs. No test yet. Only the opening cutscene was looked at.
@Seenko Seenko mentioned this pull request Nov 25, 2026
KomanderDG88 pushed a commit to KomanderDG88/VIniVIdiVIci that referenced this pull request Nov 25, 2026
In its Series S mode the title renders at 1280x720 and calls the console's
FidelityFX upscaler (`ffxDispatch` of amd_fidelityfx_loader_xbox.dll) to make
the 1920x1080 output. The loader and upscaler are the title's own DLLs and
run, but the upscaler's passes are compute pipelines in a container that is
not translated ("falling back to NewBE" in the title's log), so the output
was never written: the world was black behind the interface.

The executable's import of `ffxDispatch` is now bound to ours. An upscale
dispatch (type 0x10001, the public FidelityFX API's layout) is recorded as
`victory_gpu::list::upscale_stretch` of its colour input into its output;
any other dispatch, and an upscale that could not be stretched, goes to the
title's DLL. The DLL is not registered as an HLE module: that kept the
title's own from loading and left its other three entry points missing.

Measured on an RTX 3050 8 GB, Windows 11, release build, on top of the
R9G9B9E5 stand-in (fxceless#32): the Series S world renders (opening cutscene), 0.4
to 1.2 s a frame with peaks of 3 s, the card about a quarter busy, 7 GB of
video memory, no host error in a five-minute run. Series X is not affected
in the run made (it does not dispatch the upscaler).

Not done: temporal accumulation, sharpening, use of the depth and motion
inputs. No test yet. Only the opening cutscene was looked at.

(cherry picked from commit 19a0240)
@arminkhaleghirod arminkhaleghirod closed this by deleting the head repository Nov 26, 2026
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.

4 participants