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

Closed
github-bot wants to merge 2 commits from github-bot/gh-32 into main AGit
Owner

@⁠arminkhaleghirod on GitHub · 2026-11-24 20:39 UTC · original
rgb9e5-stand-in → main · +10 −4 · 1 files · 2 commits · closed without merging

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.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 20:39 UTC · [original](https://github.com/fxceless/victory-fork/pull/32) `rgb9e5-stand-in` → `main` · +10 −4 · 1 files · 2 commits · closed without merging 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.
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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:34:54 +00:00
Author
Owner

@⁠adriaespii on GitHub · 2026-11-24 20:54 UTC · original

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.

**@⁠adriaespii** on GitHub · 2026-11-24 20:54 UTC · [original](https://github.com/fxceless/victory-fork/pull/32#issuecomment-7144218963) 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.*
Author
Owner

@⁠arminkhaleghirod on GitHub · 2026-11-24 21:37 UTC · original

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.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 21:37 UTC · [original](https://github.com/fxceless/victory-fork/pull/32#issuecomment-7145175956) 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.
Author
Owner

@⁠HenriqueSBueno on GitHub · 2026-11-24 22:46 UTC · original

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)

**@⁠HenriqueSBueno** on GitHub · 2026-11-24 22:46 UTC · [original](https://github.com/fxceless/victory-fork/pull/32#issuecomment-7146629831) 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)
Author
Owner

@⁠arminkhaleghirod on GitHub · 2026-11-24 23:50 UTC · original

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.

**@⁠arminkhaleghirod** on GitHub · 2026-11-24 23:50 UTC · [original](https://github.com/fxceless/victory-fork/pull/32#issuecomment-7147863189) 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.
Author
Owner

@⁠AwkGrep256 on GitHub · 2026-11-24 22:53 UTC · original · edited 2026-11-25 00:56 UTC

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.

**@⁠AwkGrep256** on GitHub · 2026-11-24 22:53 UTC · [original](https://github.com/fxceless/victory-fork/pull/32#issuecomment-7146758300) · edited 2026-11-25 00:56 UTC 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.
github-bot closed this pull request 2026-11-26 06:07:33 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.