GPU: substitute R9G9B9E5_SHAREDEXP render targets and UAVs with R16G16B16A16_FLOAT #492

Open
github-bot wants to merge 4 commits from github-bot/gh-492 into main AGit
Owner

@⁠Yaekai on GitHub · 2026-11-24 04:04 UTC · original
Yaekai:fix/gpu-r9g9b9e5-render-target → main · +565 −18 · 5 files · 4 commits · open

Summary

On Xbox Series X|S, GTA VI allocates HDR scene/lighting targets in DXGI_FORMAT_R9G9B9E5_SHAREDEXP (format 67) with ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS (e.g. 1920x1080, flags: 5 and flags: 4). PC D3D12 forbids R9G9B9E5_SHAREDEXP as a render target or unordered-access resource, causing CreateCommittedResource to fail with E_INVALIDARG (no host texture) and leaving those passes without a host texture.

Changes

  • crates/victory-gpu/src/resource.rs:
    • Added target_format() substituting R9G9B9E5_SHAREDEXP (67) → R16G16B16A16_FLOAT (10) for resources created with ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS and their clear values.
    • Read-only sampled R9G9B9E5_SHAREDEXP textures keep format 67 (pc_format).
    • Updated view_format() so substituted typed targets are not mistaken for typeless resources.
    • Added unit tests (r9g9b9e5_target_format_substitutes_rgba16f and r9g9b9e5_render_target_and_uav_textures_create_on_host).
  • crates/victory-gpu/src/descriptor.rs: Target::desc() maps RTV formats through target_format().
  • crates/victory-gpu/src/descriptor/host.rs: fits() accepts SRV/UAV views requesting R9G9B9E5_SHAREDEXP on a substituted R16G16B16A16_FLOAT host texture and binds the host format.
  • crates/victory-gpu/src/pipeline/host.rs: PSO RTFormats map through target_format().

Verification

  • cargo test -p victory-gpu --lib: 45 passed, 0 failed (including both new r9g9b9e5 tests on D3D12).
  • Verified live on GTA VI (--console series-s): no host texture warnings for format: 67 dropped to 0.

Known Limitations (Widening Hosts Only)

  • Skipped cross-family copies: On hosts that widen R9G9B9E5_SHAREDEXP to R16G16B16A16_FLOAT (e.g. NVIDIA), a CopyResource or CopyTextureRegion between a widened texture and a non-widened format-67 or R32_UINT texture/footprint is skipped with a one-time warning rather than converted, so the destination keeps its previous contents instead of triggering an invalid D3D12 copy / device removal.
  • R32_UINT placed aliases: On widening hosts, a placed R32_UINT writer / R9G9B9E5_SHAREDEXP reader pair on the same memory still gets separate host textures and does not share the writer's data; bit-converting or bridging that alias path is out of scope for this PR.
**@⁠Yaekai** on GitHub · 2026-11-24 04:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/492) `Yaekai:fix/gpu-r9g9b9e5-render-target` → `main` · +565 −18 · 5 files · 4 commits · open ## Summary On Xbox Series X|S, GTA VI allocates HDR scene/lighting targets in `DXGI_FORMAT_R9G9B9E5_SHAREDEXP` (format `67`) with `ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS` (e.g. `1920x1080`, `flags: 5` and `flags: 4`). PC D3D12 forbids `R9G9B9E5_SHAREDEXP` as a render target or unordered-access resource, causing `CreateCommittedResource` to fail with `E_INVALIDARG` (`no host texture`) and leaving those passes without a host texture. ## Changes - **`crates/victory-gpu/src/resource.rs`**: - Added `target_format()` substituting `R9G9B9E5_SHAREDEXP` (`67`) → `R16G16B16A16_FLOAT` (`10`) for resources created with `ALLOW_RENDER_TARGET | ALLOW_UNORDERED_ACCESS` and their clear values. - Read-only sampled `R9G9B9E5_SHAREDEXP` textures keep format `67` (`pc_format`). - Updated `view_format()` so substituted typed targets are not mistaken for typeless resources. - Added unit tests (`r9g9b9e5_target_format_substitutes_rgba16f` and `r9g9b9e5_render_target_and_uav_textures_create_on_host`). - **`crates/victory-gpu/src/descriptor.rs`**: `Target::desc()` maps RTV formats through `target_format()`. - **`crates/victory-gpu/src/descriptor/host.rs`**: `fits()` accepts SRV/UAV views requesting `R9G9B9E5_SHAREDEXP` on a substituted `R16G16B16A16_FLOAT` host texture and binds the host format. - **`crates/victory-gpu/src/pipeline/host.rs`**: PSO `RTFormats` map through `target_format()`. ## Verification - `cargo test -p victory-gpu --lib`: 45 passed, 0 failed (including both new `r9g9b9e5` tests on D3D12). - Verified live on GTA VI (`--console series-s`): `no host texture` warnings for `format: 67` dropped to **0**. ## Known Limitations (Widening Hosts Only) - **Skipped cross-family copies:** On hosts that widen `R9G9B9E5_SHAREDEXP` to `R16G16B16A16_FLOAT` (e.g. NVIDIA), a `CopyResource` or `CopyTextureRegion` between a widened texture and a non-widened format-`67` or `R32_UINT` texture/footprint is skipped with a one-time warning rather than converted, so the destination keeps its previous contents instead of triggering an invalid D3D12 copy / device removal. - **`R32_UINT` placed aliases:** On widening hosts, a placed `R32_UINT` writer / `R9G9B9E5_SHAREDEXP` reader pair on the same memory still gets separate host textures and does not share the writer's data; bit-converting or bridging that alias path is out of scope for this PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:06:01 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 04:20 UTC · original

Tested b57e10d (on main d2a4bae) on NVIDIA.

Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 x86_64-pc-windows-msvc, debug.

Tested

  • cargo test --locked -p victory-gpu --lib: 45 passed, 0 failed, 1 ignored, including r9g9b9e5_target_format_substitutes_rgba16f and r9g9b9e5_render_target_and_uav_textures_create_on_host (which runs on the hardware adapter here).

  • cargo test --locked --workspace: 266 passed, 0 failed, 4 ignored.

  • cargo xtask policy: 151 files ok.

  • cargo clippy -p victory-gpu --all-targets: one undocumented_unsafe_blocks warning in host.rs:267; cargo fmt --check lists files this PR doesn't touch. Both are the same on main, and the PR's one formatting hunk removes resource.rs from that list.

  • The premise on this GPU: a throwaway local test (not pushed) asked the device for CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT):

    format render target typed UAV UAV typed store sample
    67 R9G9B9E5_SHAREDEXP no no no yes
    10 R16G16B16A16_FLOAT yes yes yes yes

    So the substitution is needed on NVIDIA as well, and sampled-only textures can keep 67 as the PR does.

Reading the code

  • Uploads from title memory are safe: texture::title_written limits them to textures without render-target/depth/UAV flags, and only those keep format 67, so a 4-byte detile never lands in an 8-byte host texture.
  • One question: copy_texture_region and copy_resource hand the title's formats to the host unchanged. A copy between a substituted target (now f10, 8 bytes) and a sampled-only f67 texture, or from an f67 placed footprint into a substituted target, would have mismatched formats and texel sizes on the host, which D3D12 doesn't allow. Did the live run show copies to or from these targets (for example with VICTORY_D3D12_DEBUG=1)? If the title never does that, nothing more is needed.

Not tested: no game data, so the live no host texture result is the description's, not mine.

AI-assisted (Claude Code) ran the checks and drafted this comment.

**@⁠fromthemoonx** on GitHub · 2026-11-24 04:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7121930482) Tested `b57e10d` (on `main` `d2a4bae`) on NVIDIA. **Environment:** Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 `x86_64-pc-windows-msvc`, debug. **Tested** - `cargo test --locked -p victory-gpu --lib`: 45 passed, 0 failed, 1 ignored, including `r9g9b9e5_target_format_substitutes_rgba16f` and `r9g9b9e5_render_target_and_uav_textures_create_on_host` (which runs on the hardware adapter here). - `cargo test --locked --workspace`: 266 passed, 0 failed, 4 ignored. - `cargo xtask policy`: 151 files ok. - `cargo clippy -p victory-gpu --all-targets`: one `undocumented_unsafe_blocks` warning in `host.rs:267`; `cargo fmt --check` lists files this PR doesn't touch. Both are the same on `main`, and the PR's one formatting hunk removes `resource.rs` from that list. - The premise on this GPU: a throwaway local test (not pushed) asked the device for `CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT)`: | format | render target | typed UAV | UAV typed store | sample | |---|---|---|---|---| | 67 `R9G9B9E5_SHAREDEXP` | no | no | no | yes | | 10 `R16G16B16A16_FLOAT` | yes | yes | yes | yes | So the substitution is needed on NVIDIA as well, and sampled-only textures can keep 67 as the PR does. **Reading the code** - Uploads from title memory are safe: `texture::title_written` limits them to textures without render-target/depth/UAV flags, and only those keep format 67, so a 4-byte detile never lands in an 8-byte host texture. - One question: `copy_texture_region` and `copy_resource` hand the title's formats to the host unchanged. A copy between a substituted target (now f10, 8 bytes) and a sampled-only f67 texture, or from an f67 placed footprint into a substituted target, would have mismatched formats and texel sizes on the host, which D3D12 doesn't allow. Did the live run show copies to or from these targets (for example with `VICTORY_D3D12_DEBUG=1`)? If the title never does that, nothing more is needed. **Not tested:** no game data, so the live `no host texture` result is the description's, not mine. AI-assisted (Claude Code) ran the checks and drafted this comment.
Author
Owner

@⁠Mesrine67 on GitHub · 2026-11-24 04:25 UTC · original

Local AMD results for PR head b57e10d719b3a3ffb7a8fd04e63a94ea088787d7:

Environment: Windows 11 Pro build 26300, AMD Radeon RX 6750 XT, driver 32.0.21045.29003, rustc 1.100.0.

  • cargo test --locked -p victory-gpu r9g9b9e5 -- --test-threads=1: 2 passed, including host D3D12 texture creation for sampled-only, UAV, and render-target+UAV flags.
  • cargo test --locked -p victory-gpu --lib -- --test-threads=1: 45 passed, 0 failed, 1 ignored.

This confirms the synthetic host-resource substitution path on this AMD adapter. It does not test a title render, PSO acceptance, or title texture copies.

I also checked the copy wrappers in crates/victory-gpu/src/list.rs: copy_resource forwards the host resources to CopyResource, and copy_texture_region forwards them to CopyTextureRegion; neither path converts formats. If the title copies between a sampled-only format-67 resource and a substituted format-10 target, that copy would violate D3D12 format/size compatibility. Microsoft documents the CopyResource restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copyresource and CopyTextureRegion format compatibility here: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion.

I could not confirm whether GTA VI makes such copies without a live title diagnostic capture. If an existing run has D3D12 debug output or copy diagnostics for these format-67 targets, that would settle the remaining question.

**@⁠Mesrine67** on GitHub · 2026-11-24 04:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7121999903) Local AMD results for PR head b57e10d719b3a3ffb7a8fd04e63a94ea088787d7: Environment: Windows 11 Pro build 26300, AMD Radeon RX 6750 XT, driver 32.0.21045.29003, rustc 1.100.0. - cargo test --locked -p victory-gpu r9g9b9e5 -- --test-threads=1: 2 passed, including host D3D12 texture creation for sampled-only, UAV, and render-target+UAV flags. - cargo test --locked -p victory-gpu --lib -- --test-threads=1: 45 passed, 0 failed, 1 ignored. This confirms the synthetic host-resource substitution path on this AMD adapter. It does not test a title render, PSO acceptance, or title texture copies. I also checked the copy wrappers in crates/victory-gpu/src/list.rs: copy_resource forwards the host resources to CopyResource, and copy_texture_region forwards them to CopyTextureRegion; neither path converts formats. If the title copies between a sampled-only format-67 resource and a substituted format-10 target, that copy would violate D3D12 format/size compatibility. Microsoft documents the CopyResource restrictions here: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copyresource and CopyTextureRegion format compatibility here: https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion. I could not confirm whether GTA VI makes such copies without a live title diagnostic capture. If an existing run has D3D12 debug output or copy diagnostics for these format-67 targets, that would settle the remaining question.
Author
Owner

@⁠Raxstreams on GitHub · 2026-11-24 04:41 UTC · original

The widened render-target format works in a local Windows integration on an RTX 3080 Ti. There is also a distinct title use case worth preserving: a placed R9G9B9E5 SRV at exactly the same address and dimensions as a writable R32_UINT texture. I verified in a separate GPU test that a castable R32_UINT allocation sampled through the packed SRV decodes a unit red channel correctly. The title creates these pairs during its first scene. An independent RGBA16 allocation for the reader loses the writer's pixels in that case. The tested widening and the packed alias path coexist locally. World lighting is still under investigation.

**@⁠Raxstreams** on GitHub · 2026-11-24 04:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7122251673) The widened render-target format works in a local Windows integration on an RTX 3080 Ti. There is also a distinct title use case worth preserving: a placed R9G9B9E5 SRV at exactly the same address and dimensions as a writable R32_UINT texture. I verified in a separate GPU test that a castable R32_UINT allocation sampled through the packed SRV decodes a unit red channel correctly. The title creates these pairs during its first scene. An independent RGBA16 allocation for the reader loses the writer's pixels in that case. The tested widening and the packed alias path coexist locally. World lighting is still under investigation.
Author
Owner

@⁠RussoJr on GitHub · 2026-11-24 12:31 UTC · original

I reproduced the R32_UINT writer → placed RGB9E5 reader in Raxstreams’ first-scene report. A compute shader wrote red and then green through the integer UAV. The RGB9E5 reader at the same guest address returned black both times.

The attached patch builds on #643 at e7b2182e. When a table-bound SRV has one matching live R32_UINT producer with a GPU write, it records a bit-preserving D3D12 copy before sampling. Microsoft lists this pair under CopyResource reinterpret copies.

With the patch, the shader read red, then green, and still read green from a second command list. CPU-supplied blue survived both before the first GPU write and after the producer was released. Three controls (different address, width, or tiling) stayed black. All nine reads passed on #643 and on a local integration of main@ffe310eb + #643 + #492. The two default-suite failures on that main snapshot with #643 were present before and after this patch.

The test ran as a Windows x64 binary under Wine 10 with vkd3d-proton 2.14.1 and Mesa llvmpipe (software rendering). Direct heap indexing and recording a consumer on another list before the producer’s first submission remain untested and outside this patch. The first mission still needs an in-game check on native D3D12.

The ZIP contains the source diff and regression test. On a D3D12 machine with D3DCompiler 47, apply the diff on top of #643 and run

cargo test --locked -p victory-gpu --lib -- --ignored --exact draw::packed_tests::placed_rgb9e5_reads_the_latest_r32_writer --nocapture

Implementation and testing were assisted by Codex.

VIctory-RGB9E5.zip

**@⁠RussoJr** on GitHub · 2026-11-24 12:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7131555365) I reproduced the R32_UINT writer → placed RGB9E5 reader in [Raxstreams’ first-scene report](https://git.gtahub.st/github/Marvisak--VIctory/pulls/492). A compute shader wrote red and then green through the integer UAV. The RGB9E5 reader at the same guest address returned black both times. The attached patch builds on #643 at `e7b2182e`. When a table-bound SRV has one matching live R32_UINT producer with a GPU write, it records a bit-preserving D3D12 copy before sampling. Microsoft lists this pair under [CopyResource reinterpret copies](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copyresource#reinterpret-copy). With the patch, the shader read red, then green, and still read green from a second command list. CPU-supplied blue survived both before the first GPU write and after the producer was released. Three controls (different address, width, or tiling) stayed black. All nine reads passed on #643 and on a local integration of `main@ffe310eb` + #643 + #492. The two default-suite failures on that main snapshot with #643 were present before and after this patch. The test ran as a Windows x64 binary under Wine 10 with vkd3d-proton 2.14.1 and Mesa llvmpipe (software rendering). Direct heap indexing and recording a consumer on another list before the producer’s first submission remain untested and outside this patch. The first mission still needs an in-game check on native D3D12. The ZIP contains the source diff and regression test. On a D3D12 machine with D3DCompiler 47, apply the diff on top of #643 and run ```sh cargo test --locked -p victory-gpu --lib -- --ignored --exact draw::packed_tests::placed_rgb9e5_reads_the_latest_r32_writer --nocapture ``` Implementation and testing were assisted by Codex. [VIctory-RGB9E5.zip](https://github.com/user-attachments/files/35331003/VIctory-RGB9E5.zip)
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-24 12:57 UTC · original

@⁠RussoJr here is the native D3D12 run of your patch.

Environment: Windows 11 Pro build 26300, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 x86_64-pc-windows-msvc, system D3DCompiler_47, Graphics Tools installed. I read packed-rgb9e5.patch from the ZIP and applied it to #643 at e7b2182 (it applies cleanly).

cargo test --locked -p victory-gpu --lib -- --ignored --exact draw::packed_tests::placed_rgb9e5_reads_the_latest_r32_writer --nocapture:

build sampled RGBA (9 reads) result
#643 + patch blue, red, green, black, black, black, green, green, blue pass
#643 + patch, --features diagnostics with VICTORY_D3D12_DEBUG=1 the same pass, no debug-layer error
control: patch with the refresh_packed_reader call in readable replaced by false blue, black, black, black, black, black, black, black, blue fails

So on native hardware the control reproduces the black reads of Raxstreams' report, and the patch turns them into red then green. The green also holds from the second command list, and the CPU-written blue returns once the writer is released. The three controls (other address, width, tiling) stay black either way. cargo test -p victory-gpu --lib on #643 + patch: 46 passed, 0 failed, 2 ignored.

Like your run, this covers table-bound SRVs only. Direct heap indexing and a consumer recorded on another list before the producer's first submission aren't covered. No game data used.

AI-assisted (Claude Code).

**@⁠fromthemoonx** on GitHub · 2026-11-24 12:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7132142480) @⁠RussoJr here is the native D3D12 run of your patch. **Environment:** Windows 11 Pro build 26300, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1 `x86_64-pc-windows-msvc`, system `D3DCompiler_47`, Graphics Tools installed. I read `packed-rgb9e5.patch` from the ZIP and applied it to #643 at `e7b2182` (it applies cleanly). `cargo test --locked -p victory-gpu --lib -- --ignored --exact draw::packed_tests::placed_rgb9e5_reads_the_latest_r32_writer --nocapture`: | build | sampled RGBA (9 reads) | result | |---|---|---| | #643 + patch | blue, **red, green**, black, black, black, **green, green**, blue | pass | | #643 + patch, `--features diagnostics` with `VICTORY_D3D12_DEBUG=1` | the same | pass, no debug-layer error | | control: patch with the `refresh_packed_reader` call in `readable` replaced by `false` | blue, **black, black**, black, black, black, **black, black**, blue | fails | So on native hardware the control reproduces the black reads of Raxstreams' report, and the patch turns them into red then green. The green also holds from the second command list, and the CPU-written blue returns once the writer is released. The three controls (other address, width, tiling) stay black either way. `cargo test -p victory-gpu --lib` on #643 + patch: 46 passed, 0 failed, 2 ignored. Like your run, this covers table-bound SRVs only. Direct heap indexing and a consumer recorded on another list before the producer's first submission aren't covered. No game data used. AI-assisted (Claude Code).
Author
Owner

@⁠erLCoder on GitHub · 2026-11-24 13:07 UTC · original

Independent HDR resource check on GTX 1660 Ti (6 GB), NVIDIA 581.42, Windows 10 22H2 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. Base d2a4bae; PR b57e10d. Added a test-only adapter check requiring NVIDIA LUID 00000000:00017c52.

cargo test --offline --locked -p victory-gpu --features diagnostics --lib r9g9b9e5 -- --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored, 46 filtered out. At 64x64 the host resource was format 10 for flags 4 and 5, and format 67 for flags 0. Separately, a native D3D12 probe at 1920x1080 returned E_INVALIDARG for unmodified format 67 with flags 4 and 5, and succeeded with flags 0. The two checks use different sizes and paths. HDR pixel values, in-game lighting and final composition remain untested.

Codex prepared the worktree, ran the tests and drafted this report.

**@⁠erLCoder** on GitHub · 2026-11-24 13:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7132389133) Independent HDR resource check on GTX 1660 Ti (6 GB), NVIDIA 581.42, Windows 10 22H2 19045.6466, Ryzen 5 3600, Rust 1.98.1 MSVC and Agility SDK 1.620.2. Base d2a4bae; PR b57e10d. Added a test-only adapter check requiring NVIDIA LUID 00000000:00017c52. `cargo test --offline --locked -p victory-gpu --features diagnostics --lib r9g9b9e5 -- --nocapture --test-threads=1`: 2 passed, 0 failed, 0 ignored, 46 filtered out. At 64x64 the host resource was format 10 for flags 4 and 5, and format 67 for flags 0. Separately, a native D3D12 probe at 1920x1080 returned E_INVALIDARG for unmodified format 67 with flags 4 and 5, and succeeded with flags 0. The two checks use different sizes and paths. HDR pixel values, in-game lighting and final composition remain untested. Codex prepared the worktree, ran the tests and drafted this report.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 14:10 UTC · original

I tested the format-67 → RGBA16F render-target path on b57e10d with a 1×1 synthetic texture. I cleared the widened target to [0.5, 0.75, 0.125, 0.25] and fetched the texel through a guest format-67 SRV. A sampled-only native RGB9E5 texture with the same packed RGB values supplied the reference.

  • Default mapping and an implicit SRV both read alpha 0.25 on the widened target. Native RGB9E5 read 1.0.
  • A custom [A, B, ZERO, G] mapping moved 0.25 into red on the widened target. Native RGB9E5 produced [1, 0.125, 0, 0.75].

Follow-up commit maps every selector for missing source alpha to constant one when the underlying texture is widened. An implicit SRV gets an explicit full-texture view so it uses the same mapping. This follows the RGB9E5 decode rule.

The mismatch reproduced on both RTX 5090 and WARP. The follow-up passed six readbacks on each backend, including an ordinary RGBA16F control with alpha 0.25. The victory-gpu library suite passed 49 tests by default and 51 with diagnostics, with one benchmark ignored in each run. This verifies SRV component behavior on the substitution path. The link to the black world frame in #904 is unverified.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 14:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7133956074) I tested the format-67 → RGBA16F render-target path on `b57e10d` with a 1×1 synthetic texture. I cleared the widened target to `[0.5, 0.75, 0.125, 0.25]` and fetched the texel through a guest format-67 SRV. A sampled-only native RGB9E5 texture with the same packed RGB values supplied the reference. - Default mapping and an implicit SRV both read alpha `0.25` on the widened target. Native RGB9E5 read `1.0`. - A custom `[A, B, ZERO, G]` mapping moved `0.25` into red on the widened target. Native RGB9E5 produced `[1, 0.125, 0, 0.75]`. [Follow-up commit](https://github.com/fuzeofficlal/VIctory/commit/0b7679b58c5cc81ea1a33ebfba1d03620a1b62bf) maps every selector for missing source alpha to constant one when the underlying texture is widened. An implicit SRV gets an explicit full-texture view so it uses the same mapping. This follows the [RGB9E5 decode rule](https://microsoft.github.io/DirectX-Specs/d3d/D3D12R9G9B9E5Format.html#conversions-to-float-and-back). The mismatch reproduced on both RTX 5090 and WARP. The follow-up passed six readbacks on each backend, including an ordinary RGBA16F control with alpha `0.25`. The `victory-gpu` library suite passed 49 tests by default and 51 with diagnostics, with one benchmark ignored in each run. This verifies SRV component behavior on the substitution path. The link to the black world frame in #904 is unverified.
Author
Owner

@⁠EgoraWyn on GitHub · 2026-11-24 14:26 UTC · original

Test report: NVIDIA RTX 3060 Laptop 6 GB (Ampere), --console series-s: the refused format-67 targets are made with this PR.

Setup: Windows 11 build 26300, driver 596.21 (32.0.15.9621), title 1.0.2.1 (own copy), Rust 1.98.1, diag build. Base: 8e79c80 + #493 (c48b240) + #206 (05981dd) + #189 (d0fd9bf) + #454 (d2c93fa) + MIN_DYNAMIC = 1 << 18 (#747). This PR at b57e10d, clean merge.

no host texture … (0x80070057) lines per run:

run 1920×1080 format 67, flags 4 1920×1080 format 67, flags 5 other
series-s, base 1 1 1280×720 format 115 (flags 1), 1280×720 format 86 (flags 5)
series-s, base + this PR + #211 0 0 the same two
series-x, base 0 0 2560×1440 format 115 (flags 1), 2560×1440 format 86 (flags 5)

So on this card the format-67 refusals only occur in Series S mode, and this PR removes both.

What it does not do alone: with only this PR on the base, the Series S menus stay black (70 s, no input, 30 fps); the picture needs #211 (two present planes). With both merged the menus are correct and the world is reached in Series S mode for 4.5 minutes with no device removal; numbers in my report on #211.

Not tested: this PR in Series X mode, where no format-67 target was refused here anyway; other GPUs. One run per row.

AI use: Claude Code (Claude Fable 5.2) built the trees, ran the runs and wrote this report from the logs; a second tool (Codex) checked the numbers against the logs. The hardware, the title copy and the runs are the user's.

**@⁠EgoraWyn** on GitHub · 2026-11-24 14:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7134389789) **Test report: NVIDIA RTX 3060 Laptop 6 GB (Ampere), `--console series-s`: the refused format-67 targets are made with this PR.** Setup: Windows 11 build 26300, driver 596.21 (32.0.15.9621), title 1.0.2.1 (own copy), Rust 1.98.1, diag build. Base: `8e79c80` + #493 (`c48b240`) + #206 (`05981dd`) + #189 (`d0fd9bf`) + #454 (`d2c93fa`) + `MIN_DYNAMIC = 1 << 18` (#747). This PR at `b57e10d`, clean merge. `no host texture … (0x80070057)` lines per run: | run | 1920×1080 format 67, flags 4 | 1920×1080 format 67, flags 5 | other | |---|---|---|---| | `series-s`, base | 1 | 1 | 1280×720 format 115 (flags 1), 1280×720 format 86 (flags 5) | | `series-s`, base + this PR + #211 | 0 | 0 | the same two | | `series-x`, base | 0 | 0 | 2560×1440 format 115 (flags 1), 2560×1440 format 86 (flags 5) | So on this card the format-67 refusals only occur in Series S mode, and this PR removes both. What it does not do alone: with only this PR on the base, the Series S menus stay black (70 s, no input, 30 fps); the picture needs #211 (two present planes). With both merged the menus are correct and the world is reached in Series S mode for 4.5 minutes with no device removal; numbers in my report on #211. Not tested: this PR in Series X mode, where no format-67 target was refused here anyway; other GPUs. One run per row. *AI use: Claude Code (Claude Fable 5.2) built the trees, ran the runs and wrote this report from the logs; a second tool (Codex) checked the numbers against the logs. The hardware, the title copy and the runs are the user's.*
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 14:39 UTC · original

Following the flags-4 report, I ran a separate typed UAV write → SRV load test on b57e10d and the alpha follow-up. I created a 2×2 texture with guest format 67 and ALLOW_UNORDERED_ACCESS, then requested format 67 for both views. A synthetic compute shader wrote four distinct RGBA colors through the UAV. After the transition to shader-read state, a second shader loaded all four texels through the SRV.

RTX 5090, AMD Radeon Graphics and WARP all produced the expected RGB values on both revisions. The backing texture was RGBA16F on each device. The author's head returned the stored alpha 0.25; the follow-up returned RGB9E5's default alpha 1.0. The separate native RGBA16F control returned 0.25 on both revisions.

This covers the explicit typed UAV and default-mapped SRV on the widened flags-4 resource. The test uses Texture2D.Load with synthetic colors.

**@⁠fuzeofficlal** on GitHub · 2026-11-24 14:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7134745481) Following the flags-4 report, I ran a separate typed UAV write → SRV load test on `b57e10d` and [the alpha follow-up](https://github.com/fuzeofficlal/VIctory/commit/0b7679b58c5cc81ea1a33ebfba1d03620a1b62bf). I created a 2×2 texture with guest format 67 and `ALLOW_UNORDERED_ACCESS`, then requested format 67 for both views. A synthetic compute shader wrote four distinct RGBA colors through the UAV. After the transition to shader-read state, a second shader loaded all four texels through the SRV. RTX 5090, AMD Radeon Graphics and WARP all produced the expected RGB values on both revisions. The backing texture was RGBA16F on each device. The author's head returned the stored alpha `0.25`; the follow-up returned RGB9E5's default alpha `1.0`. The separate native RGBA16F control returned `0.25` on both revisions. This covers the explicit typed UAV and default-mapped SRV on the widened flags-4 resource. The test uses `Texture2D.Load` with synthetic colors.
Author
Owner

@⁠jamesn-xt on GitHub · 2026-11-24 16:39 UTC · original · edited 2026-11-24 16:48 UTC

Independent integrated test on Windows 11 x64 build 26200, Ryzen 5 5600, 32 GiB RAM, RTX 4080 / NVIDIA 617.42, Rust 1.98.1.

Tested stack: main ffe310e + #1146 + #211 (2fb7a8b) + #89 (081afbd) + this PR (c7bb83f), then #985 and #206. Reproducible source with original PR ancestry and local conflict resolutions: https://github.com/jamesn-xt/VIctory/tree/test/rtx4080-target-formats (abe05a3). This is an integration test, not an isolated attribution of every visual change to one PR.

  • The earlier #211-only hardware run refused format-86/115 targets and RGB9E5 UAVs. The integrated hardware log contains zero no host texture warnings within the bounded run. Correction: there were 23 host-pipeline refusal lines; my initial search matched only no host pipeline and missed host pipeline refused.
  • Series S character loading artwork rendered at 30 fps. Later, frame 2881 began binding mesh/pixel pipelines, but the available-commit guard stopped the process below 2 GiB headroom. No visible 3D world/gameplay or complete main menu is claimed; no device reset observed.
  • Diagnostics GPU tests: 66 passed, 1 ignored after #206. All-target/all-feature GPU Clippy, diagnostics build, asset policy and diff-whitespace checks passed.
  • Before #206, the format stack's GPU suite passed 64 tests on hardware. A WARP/debug run exposed the known frame timing test failure; with #985 the WARP suite passed 64 tests / 1 ignored. The timing failure and verification are recorded on #985.

Integration notes: #89's packed conversion/copy guards were combined with main's title-written texture upload handling. The ordinary host upload path retains defer_fill for the mapped staging destination. The target-format mapping combines packed16 substitutions with RGB9E5→RGBA16F, and preserves this PR's latest RGB9E5 SRV alpha/component handling. No source from the title was used in those conflict resolutions.

No retail files, captures or raw game logs attached.

Follow-up with 12 GiB additional active paging-file headroom: the same integrated runtime got past the earlier memory guard and attempted hundreds of draws per frame, roughly 1 fps. The first captured 3D-stage frame was black. The process then exited with DXGI_ERROR_DEVICE_REMOVED (0x887A0005), reported removal reason DXGI_ERROR_DEVICE_HUNG (0x887A0006), after a submission of 32 lists. Visible gameplay is not confirmed. That later run logged 104 host-pipeline refusal lines and 300 shader-translation refusal lines; the format fixes do not resolve those broader world-rendering problems. These counts are log lines, not a claim about all distinct shaders in the package.

**@⁠jamesn-xt** on GitHub · 2026-11-24 16:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7138003630) · edited 2026-11-24 16:48 UTC Independent integrated test on Windows 11 x64 build 26200, Ryzen 5 5600, 32 GiB RAM, RTX 4080 / NVIDIA 617.42, Rust 1.98.1. Tested stack: main `ffe310e` + #1146 + #211 (`2fb7a8b`) + #89 (`081afbd`) + this PR (`c7bb83f`), then #985 and #206. Reproducible source with original PR ancestry and local conflict resolutions: https://github.com/jamesn-xt/VIctory/tree/test/rtx4080-target-formats (`abe05a3`). This is an integration test, not an isolated attribution of every visual change to one PR. - The earlier #211-only hardware run refused format-86/115 targets and RGB9E5 UAVs. The integrated hardware log contains zero `no host texture` warnings within the bounded run. Correction: there were 23 host-pipeline refusal lines; my initial search matched only `no host pipeline` and missed `host pipeline refused`. - Series S character loading artwork rendered at 30 fps. Later, frame 2881 began binding mesh/pixel pipelines, but the available-commit guard stopped the process below 2 GiB headroom. No visible 3D world/gameplay or complete main menu is claimed; no device reset observed. - Diagnostics GPU tests: 66 passed, 1 ignored after #206. All-target/all-feature GPU Clippy, diagnostics build, asset policy and diff-whitespace checks passed. - Before #206, the format stack's GPU suite passed 64 tests on hardware. A WARP/debug run exposed the known frame timing test failure; with #985 the WARP suite passed 64 tests / 1 ignored. The timing failure and verification are recorded on #985. Integration notes: #89's packed conversion/copy guards were combined with main's title-written texture upload handling. The ordinary host upload path retains `defer_fill` for the mapped staging destination. The target-format mapping combines packed16 substitutions with RGB9E5→RGBA16F, and preserves this PR's latest RGB9E5 SRV alpha/component handling. No source from the title was used in those conflict resolutions. No retail files, captures or raw game logs attached. Follow-up with 12 GiB additional active paging-file headroom: the same integrated runtime got past the earlier memory guard and attempted hundreds of draws per frame, roughly 1 fps. The first captured 3D-stage frame was black. The process then exited with `DXGI_ERROR_DEVICE_REMOVED` (0x887A0005), reported removal reason `DXGI_ERROR_DEVICE_HUNG` (0x887A0006), after a submission of 32 lists. Visible gameplay is not confirmed. That later run logged 104 host-pipeline refusal lines and 300 shader-translation refusal lines; the format fixes do not resolve those broader world-rendering problems. These counts are log lines, not a claim about all distinct shaders in the package.
Author
Owner

@⁠465d6a0eac on GitHub · 2026-11-24 17:02 UTC · original · edited 2026-11-24 17:20 UTC

Thank you for this, @⁠Yaekai! Many pull requests here are still waiting to be merged, so I've ported this one to 465d6a0eac/AgentRecompVI, a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/34. You're credited as the author there. This pull request stays the original.

Test results

  • Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with #320/#439, #265 and #1019, cargo clippy (both variants) and cargo test --workspace pass (407 passed, 0 failed). r9g9b9e5_render_target_and_uav_textures_create_on_host passes on the RTX 3070 Ti, so these targets now exist on an NVIDIA host.
  • With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet. On the same path the title still asks for two textures NVIDIA refuses (B5G5R5A1 with UAV, and B4G4R4A4 as a render target); the same substitution could cover them.
**@⁠465d6a0eac** on GitHub · 2026-11-24 17:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7138598847) · edited 2026-11-24 17:20 UTC Thank you for this, @⁠Yaekai! Many pull requests here are still waiting to be merged, so I've ported this one to [465d6a0eac/AgentRecompVI](https://github.com/465d6a0eac/AgentRecompVI), a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/34. You're credited as the author there. This pull request stays the original. **Test results** - Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): together with #320/#439, #265 and #1019, `cargo clippy` (both variants) and `cargo test --workspace` pass (407 passed, 0 failed). `r9g9b9e5_render_target_and_uav_textures_create_on_host` passes on the RTX 3070 Ti, so these targets now exist on an NVIDIA host. - With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet. On the same path the title still asks for two textures NVIDIA refuses (B5G5R5A1 with UAV, and B4G4R4A4 as a render target); the same substitution could cover them.
Author
Owner

@⁠rafaconvaitis on GitHub · 2026-11-24 19:50 UTC · original · edited 2026-11-24 20:28 UTC

I independently checked the earlier bit-preserving alias-copy route on native Windows D3D12, with three mip levels and two array layers. A synthetic compute dispatch wrote different packed lighting words through R32_UINT UAVs. I used one CopyResource to copy to an otherwise matching R9G9B9E5_SHAREDEXP texture, then read back the packed bits and sampled the destination through a Texture2DArray SRV at each mip and layer.

The RTX 4070 and WARP both matched all 42 packed words (4×4, 2×2, and 1×1 on each layer) and all 42 expected RGBA tuples, with alpha 1. This corroborates the multi-subresource copy itself on native D3D12 for the alias case discussed in this thread. The fixture did not include VIctory's guest-address lookup, producer ordering, or resource lifetime. Those remain the integration questions before attributing any scene lighting change to it.

In two separate title runs on this RTX 4070, the fxceless/victory-gta6 578d459 alias path logged five multi-subresource matches for host format 42 written and format 67 read per run. The distinct shapes were 2048×456 with four subresources and 128×128 and 64×64 with six each. The runs used that fork's existing staging-copy implementation. This establishes that multi-subresource alias traffic occurs during the title and leaves its contribution to lighting open.

AI-assisted testing. No title files or images attached.

**@⁠rafaconvaitis** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7142666219) · edited 2026-11-24 20:28 UTC I independently checked the earlier bit-preserving alias-copy route on native Windows D3D12, with **three mip levels and two array layers**. A synthetic compute dispatch wrote different packed lighting words through `R32_UINT` UAVs. I used one `CopyResource` to copy to an otherwise matching `R9G9B9E5_SHAREDEXP` texture, then read back the packed bits and sampled the destination through a `Texture2DArray` SRV at each mip and layer. The RTX 4070 and WARP both matched all **42 packed words** (4×4, 2×2, and 1×1 on each layer) and all 42 expected RGBA tuples, with alpha 1. This corroborates the multi-subresource copy itself on native D3D12 for the alias case discussed in this thread. The fixture did not include VIctory's guest-address lookup, producer ordering, or resource lifetime. Those remain the integration questions before attributing any scene lighting change to it. In two separate title runs on this RTX 4070, the `fxceless/victory-gta6` `578d459` alias path logged five multi-subresource matches for host format 42 written and format 67 read per run. The distinct shapes were 2048×456 with four subresources and 128×128 and 64×64 with six each. The runs used that fork's existing staging-copy implementation. This establishes that multi-subresource alias traffic occurs during the title and leaves its contribution to lighting open. AI-assisted testing. No title files or images attached.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:21 UTC · original · edited 2026-11-25 15:58 UTC

Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-gpu/src/list.rs, crates/victory-gpu/src/resource.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge-candidate) was for an older state of main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/492#issuecomment-7148421403) · edited 2026-11-25 15:58 UTC <!-- victory-triage v1 head=e456e1e8840709ed473d05759d87cf7a18059e49 verdict=needs-rebase at=2026-11-25T15:57:30Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-gpu/src/list.rs`, `crates/victory-gpu/src/resource.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge-candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-gpu/src/list.rs
  • crates/victory-gpu/src/resource.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/492/head:github-bot/gh-492'
git switch 'github-bot/gh-492'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-492'
git switch 'github-bot/gh-492'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-492'
git switch 'github-bot/gh-492'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-492'
git switch 'main'
git merge --squash 'github-bot/gh-492'
git switch 'main'
git merge --ff-only 'github-bot/gh-492'
git switch 'main'
git merge 'github-bot/gh-492'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!492
No description provided.