Repository navigation
FidelityFX: write an RGB9E5 output NVIDIA cannot store to through an FP16 texture (fixes a device removal) - #1868
marquezinii wants to merge 2 commits into
Conversation
|
Checked on an RTX 3070 (Ampere, driver 616.56, Windows 11) at The packer is exact. I uploaded a 256×256 FP16 texture: R takes every one of the 65 536 half patterns, including NaN, ±Inf, negatives and denormals, and G and B take other patterns. That went through On Ampere the title's texture is never made, so the bridge is never reached. This driver reports RGB9E5 as Your RTX 5070 on 621.40 does create the texture, so this looks like a difference between drivers or generations. One way to cover both: when Batch on the same machine: AI-assisted (Claude Code). Synthetic tests only. |
catminou4
left a comment
There was a problem hiding this comment.
Mixed PR: shader/formats parts are macOS-tested in the batch; GPU/HLE parts are Windows-only statics.
FidelityFX RGB9E5 output for NVIDIA (gpu+hle): third FidelityFX PR this wave after #1793 — check which one the maintainer intends to land.
…n FP16 texture The title upscales into an RGB9E5 texture with render-target and unordered-access uses. NVIDIA creates such a texture, so its host copy takes UNORDERED_ACCESS, but it cannot store to RGB9E5 through a typed unordered access view: the host upscaler writing it removes the device (0x887A0005 in the test below). Where the host does not store to the output's format (format support: typed UAV and UAV typed store), the output is moved to COPY_DEST and the upscaler writes an FP16 texture of ours instead. Its rows are copied to a buffer, a compute shader packs them into RGB9E5 by D3D's rule, and a buffer-to-texture copy writes the title's texture. The packer is a 5.1 shader with its root signature inside, as indirect.rs does, and needs no descriptor heap. Hosts that store RGB9E5 write it directly, as before. tests/fidelityfx.rs upscales into an RGB9E5 output too, made with the title's uses, and checks every pixel of both outputs.
… without it Formats such as RGB9E5 and B4G4R4A4 support neither render targets nor typed unordered views on NVIDIA. An RTX 5070 still makes such a texture with those flags, unless a clear value comes with it, and the title passes one: 2560x1440 B4G4R4A4 and RGB9E5 targets got no host texture. An RTX 3070 refuses them with either flag. When creation fails, make_texture retries without the render target and unordered access flags that D3D12_FEATURE_FORMAT_SUPPORT doesn't list for the format, and without the clear value. The texture then exists and is written by copies. An RGB9E5 upscaler output goes through the FP16 bridge. Render target views are not made on such a texture, because one would remove the device: set_targets leaves it unbound and a clear skips it.
3d579a7 to
7db1c07
Compare
|
@upipibi thanks for the exhaustive packer check and the Ampere report. I took your suggestion in 7db1c07 (rebased on
It turned out to matter on the RTX 5070 as well. This card makes RGB9E5 or B4G4R4A4 render targets without a clear value, but refuses them with one, and the title passes one. In the title (Series S profile) the log now shows On the overlap question in the review above: #1704 (DLSS) is now stacked on this PR and uses its |
|
Ran the test you asked for on the RTX 3070 (Ampere, driver 616.56), Windows 11, debug build, at AI-assisted (Claude Code). |
|
Automated triage for the maintainers. This is a useful fix with hardware evidence (RTX 5070, with the debug layer on). One correctness problem in
Minor:
CI: passing. Generated by Claude Code |
|
Additional Linux/Wine NVIDIA capability evidence relevant to the allocation retry in this PR. This is not a full PR/fallback verification. Host: RTX 4060 Laptop 8 GB, NVIDIA 590.48.01, Linux 6.17.0-40; vkd3d-proton 3.2.0 ( For Allocation parameters: DEFAULT heap, 16x16 TEXTURE2D, one mip/array slice/sample, UNKNOWN layout. The first two calls requested This host needs the texture-creation retry, not just the dispatch-time FP16 bridge: unlike the NVIDIA case where allocation succeeds despite missing typed stores, vkd3d rejects the original combined uses outright. Probe detail: the first attempt selected by PCI vendor ID and stopped before device creation because DXVK's default NVIDIA-hiding behavior reported AMD's ID. For the measurement above only, Not tested: your PR's implementation, FP16 packing/readback, PC FSR context/dispatch, output image, gameplay, or long-run stability. Reporting against the existing PR rather than proposing a duplicate NVIDIA-specific patch. The temporary probe is being removed after this check. AI assistance: OpenAI coding assistant wrote and ran the probe and drafted this report from its output. Follow-up: allocation and pixel tests now pass locallyIntegrated the diff at The latter ran both frames per format and checked the readback pixels in both FP16 and RGB9E5 with the PR's existing assertions. It did not skip for a missing SDK/GPU. Same headless Wine/NVIDIA environment as above; fetched only SDK v2.4.0's official Integration qualifications: this is not an unmodified checkout of the PR. Existing deferred-texture work adds an No title gameplay or long-run stability claim. No competing PR proposed. |
|
@marquezinii I put the requested bridge-format correction in one commit on top of
The original-head comparison stopped immediately after selection, before submitting the invalid combinations. The new cases exercise the real
The three existing FidelityFX module tests, strict all-feature Clippy for the HLE and GPU crates, and the asset-policy check passed. From the PR branch: git fetch https://github.com/steven-seagull27/VIctory.git codex/pr1868-rgb9e5-selection
git cherry-pick 85b26e892db80d35f48bf1497a667a2bbabc795cCurrent-main integration. Git merged the PR into I also checked compatibility with the newly adopted #2626 head AI-assisted with Codex. Synthetic textures only. |
main's host FidelityFX path (0b35b7f) removes the device on NVIDIA when the title's output is RGB9E5. This fixes it.What's wrong
Grand Theft Auto VI upscales into an RGB9E5 texture (#1793's log: host formats
[10, 19, 34, 67]), made with render-target and unordered-access uses. NVIDIA creates that texture, so its host copy takesUNORDERED_ACCESSandffxDispatchhands it to the upscaler. But NVIDIA cannot store to RGB9E5 through a typed unordered access view. When the upscaler writes it, the device is removed:0x887A0005in the test below, on an RTX 5070.AMD's RX 9070 XT and WARP store RGB9E5 (#1793), so this only shows on NVIDIA.
What the fix does
victory_gpu::rgb9e5::stores(texture): whether the host stores to the texture's format through a typed UAV. It asks format support for bothTYPED_UNORDERED_ACCESS_VIEW(support 1) andUAV_TYPED_STORE(support 2), once per format. The state alone is not enough, as above.Where it does not,
ffxDispatchmoves the output toCOPY_DEST, and the upscaler writes an FP16 texture of ours instead (victory_gpu::rgb9e5::Bridge, one per output size, kept). After the upscaler:The bridge's resources end in the states they started in. The title's texture is left in
COPY_DEST, where the list was told it is.The packer is a 5.1 shader with its root signature inside, compiled by the system's compiler, as
indirect.rsdoes. It needs no descriptor heap: root constants, a root SRV and a root UAV.Hosts that store RGB9E5 write it directly, as before.
Some hosts refuse to make the title's texture at all. An RTX 3070 refuses an RGB9E5 texture with either use (reported in the comments). An RTX 5070 refuses it, and a B4G4R4A4 one, when a clear value comes with the render target use, and the title passes one. When
make_texturefails, it now retries without the render target and unordered access uses thatD3D12_FEATURE_FORMAT_SUPPORTdoesn't list for the format, and without the clear value. The texture then exists inCOPY_DEST, and the bridge writes it. Render target views are not made on such a texture, because one would remove the device:set_targetsleaves it unbound and a clear skips it.Tested
Windows 11 26300, RTX 5070 (driver 621.40), FidelityFX SDK 2.4.0
signedbin(provider 3.1.6):tests/fidelityfx.rsnow also upscales into an RGB9E5 output made with the title's uses (render target and unordered access). It checks every pixel of both outputs within 0.05 after two upscalings each, with the debug layer on and no errors from it, and logs which way the RGB9E5 output went. Here:RGB9E5 output written through an FP16 texture. It passes.With the output's way decided by its state only, which is what
maindoes, the same test removed the device while copying back.cargo test -p victory-gpu(76 passed, plus the two NVIDIA heap-cap failuresmainhas, Test report: RTX 5070 (Blackwell), Windows 11, 70564ae: 471 passed, 5 failed, 7 ignored (4 from the 1,000,000 view heap cap) #1744) andcargo test -p victory-hlepass.Clippy with
-D warnings, with and withoutdiagnostics,cargo docandcargo xtask policypass.textures_are_made_without_uses_their_format_does_not_support: B4G4R4A4, RGB9E5, B5G5R5A1 and R8G8B8A8 textures asked for with both uses and a clear value are made, and keep the uses their format supports. Without the retry it fails on the RTX 5070 (no host texture of format 115).In the title (RTX 5070,
mainat940d32fplus #1775 and #1751, without whichmainremoves the device at boot on NVIDIA (#1753); Series S, since only that profile takes the FidelityFX path):a host texture without the uses its format does not support ... format=67 asked=5 made=0. Without it the upscaling never runs. In a run of FidelityFX: answer the upscale calls with DLSS through Streamline (stacked on #1868) #1704 before it was stacked here:FidelityFX: a resource has no host texture in its state; the upscaling did not run state=2.FidelityFX: upscaler context on the host provider="3.1.6" render=[1280, 720] output=[1920, 1080], thenthe output is written through an FP16 textureandfirst upscaling, host formats of its textures formats=[10, 19, 34, 10].VICTORY_SKIP_PIPELINES=f607780aa8e502d0, the world ran about 4½ minutes past the first upscaling, and no device removal came from it. Without that skip, the GPU hangs within a minute on an indirect dispatch of that compute pipeline, with or without FidelityFX (DRED names it), which is unrelated to this PR. The world's frames are still dark on this machine, so the picture couldn't be judged.Not tested: AMD, where the direct path is unchanged; Ampere (the retry is meant for it, from the comments' report).
#1704 (DLSS on the same module) is now stacked on this PR and uses this module, so there's one copy of the bridge.