GPU: strip unsupported UAV/RT format flags and skip redundant pipeline library write #2180

Closed
github-bot wants to merge 1 commit from gh-pr/2180/head into gh-pr/2180/base
Owner

@⁠n-romanovich on GitHub · 2026-11-25 07:06 UTC · original
n-romanovich:pr/format-support-and-library-save → main · +152 −19 · 4 files · 1 commits · closed without merging

Summary

  1. resource.rs (host_desc): Query D3D12_FEATURE_FORMAT_SUPPORT (format_support1) and strip or widen ALLOW_UNORDERED_ACCESS / ALLOW_RENDER_TARGET when a format (such as B5G5R5A1_UNORM or B4G4R4A4_UNORM) cannot support or cast to a format supporting those flags, preventing D3D12 GetResourceAllocationInfo / CreateCommittedResource failures. Adds unit test host_desc_strips_unsupported_uav_and_rt_flags.
  2. pipeline/library.rs (save): When l.added == 0 && !l.prebuilt_changed and only early-pipelines.txt changed, skip re-serializing and rewriting the 1+ GiB host-pipelines.bin blob.

Verification

Tested on NVIDIA GeForce RTX 5060 Ti:

  • cargo test --release -p victory-gpu --lib -- resource::tests pipeline::library: 19 passed; 0 failed
**@⁠n-romanovich** on GitHub · 2026-11-25 07:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180) `n-romanovich:pr/format-support-and-library-save` → `main` · +152 −19 · 4 files · 1 commits · closed without merging ## Summary 1. **`resource.rs` (`host_desc`):** Query `D3D12_FEATURE_FORMAT_SUPPORT` (`format_support1`) and strip or widen `ALLOW_UNORDERED_ACCESS` / `ALLOW_RENDER_TARGET` when a format (such as `B5G5R5A1_UNORM` or `B4G4R4A4_UNORM`) cannot support or cast to a format supporting those flags, preventing D3D12 `GetResourceAllocationInfo` / `CreateCommittedResource` failures. Adds unit test `host_desc_strips_unsupported_uav_and_rt_flags`. 2. **`pipeline/library.rs` (`save`):** When `l.added == 0 && !l.prebuilt_changed` and only `early-pipelines.txt` changed, skip re-serializing and rewriting the 1+ GiB `host-pipelines.bin` blob. ## Verification Tested on NVIDIA GeForce RTX 5060 Ti: - `cargo test --release -p victory-gpu --lib -- resource::tests pipeline::library`: `19 passed; 0 failed`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:57:37 +00:00
github-bot closed this pull request 2026-11-26 04:57:37 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-25 08:52 UTC · original

Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head e1bf6701 into main 940d32f in a throwaway tree (no conflict). cargo clippy --workspace --all-targets --locked -- -D warnings: clean; the same with --all-features: clean. cargo test --workspace --locked: 702 passed, 0 failed, 10 ignored, two runs (main alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-25 08:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180#issuecomment-7157574387) Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present, so the hardware-only shader checks run. I merged this PR's head `e1bf6701` into `main` `940d32f` in a throwaway tree (no conflict). `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean; the same with `--all-features`: clean. `cargo test --workspace --locked`: 702 passed, 0 failed, 10 ignored, two runs (`main` alone on the same machine: 701 passed, 0 failed, 10 ignored). The title was not run, so this says nothing about in-game effect. No game data. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:28 UTC · original · edited 2026-11-25 14:51 UTC

Automated triage for the maintainers.

Merge candidate. The PR now holds only the format-support change. host_desc (crates/victory-gpu/src/resource.rs) queries the host's Support1 bits through the shared cache, descriptor::host::format_support1. typed_store now wraps that cache, so there is no second cache. For a texture asking for UAV or render-target use in a format the host can't serve, it switches to the typeless family when a sibling format supports that use, and otherwise drops the flag with a warning. On main such a texture is not created at all, so the title gets no texture. Here it gets one it can sample. Later UAVs are still refused by fits. Later RTVs are now skipped with a warning in State::set_targets (draw.rs) and clear_rtv (list.rs), the same way set_targets already skips a target with no host texture. The author gives the title's log line for the case (a 2560x1440 B4G4R4A4_UNORM render target refused with 0x80070057). CI (check) passes, and it merges cleanly.

For the maintainer:

  • A skipped target shifts later targets down a slot, as the existing skip in set_targets already does.
  • A tester on #2121 links #1630 and #1832 to the same missing format-115 texture. If those convert the format instead, pick one of the three approaches.
  • The PR title and description still describe the library-save change that was split out. Please update them.

Reply to @⁠n-romanovich: thanks, all three points are addressed (the split, the reused cache, the logged handling of later views), plus the title evidence.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180#issuecomment-7163825443) · edited 2026-11-25 14:51 UTC <!-- victory-triage v1 head=a4abd0788857ef68581de4372f8442bc8303ea7f verdict=merge-candidate at=2026-11-25T14:50:52Z --> Automated triage for the maintainers. **Merge candidate.** The PR now holds only the format-support change. `host_desc` (`crates/victory-gpu/src/resource.rs`) queries the host's `Support1` bits through the shared cache, `descriptor::host::format_support1`. `typed_store` now wraps that cache, so there is no second cache. For a texture asking for UAV or render-target use in a format the host can't serve, it switches to the typeless family when a sibling format supports that use, and otherwise drops the flag with a warning. On `main` such a texture is not created at all, so the title gets no texture. Here it gets one it can sample. Later UAVs are still refused by `fits`. Later RTVs are now skipped with a warning in `State::set_targets` (`draw.rs`) and `clear_rtv` (`list.rs`), the same way `set_targets` already skips a target with no host texture. The author gives the title's log line for the case (a 2560x1440 `B4G4R4A4_UNORM` render target refused with `0x80070057`). CI (`check`) passes, and it merges cleanly. For the maintainer: - A skipped target shifts later targets down a slot, as the existing skip in `set_targets` already does. - A tester on #2121 links #1630 and #1832 to the same missing format-115 texture. If those convert the format instead, pick one of the three approaches. - The PR title and description still describe the library-save change that was split out. Please update them. Reply to @⁠n-romanovich: thanks, all three points are addressed (the split, the reused cache, the logged handling of later views), plus the title evidence. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠n-romanovich on GitHub · 2026-11-25 13:57 UTC · original

@⁠Marvisak, updated pr/format-support-and-library-save (a4abd07) to address all triage points:

  1. Split unrelated change: moved the pipeline/library.rs save() optimization (with the USED_CHANGED swap moved after Serialize succeeds) to a separate branch perf/skip-redundant-library-save. This PR now contains only the format-support / host_desc change.
  2. Reused CheckFeatureSupport cache: extended descriptor::host::typed_store into pub(crate) fn format_support1(format: u32) -> Option<u32> so resource.rs reuses the single cache instead of adding a second one.
  3. Later UAV / RTV handling & logging:
    • host_desc logs (tracing::warn!) when stripping ALLOW_UNORDERED_ACCESS or ALLOW_RENDER_TARGET.
    • Later UAVs on a stripped texture are already refused and logged by descriptor::host::fits.
    • Later RTVs in draw.rs (OMSetRenderTargets) and list.rs (ClearRenderTargetView) now check resource::allows_render_target(texture) and warn + skip instead of calling CreateRenderTargetView on a non-RT host texture.
  4. Title evidence: GTA VI creates B4G4R4A4_UNORM (format: 115) textures with ALLOW_RENDER_TARGET (flags: 1), which previously failed on the host with 0x80070057:
    WARN victory_gpu::resource: no host texture error=... (0x80070057) desc=ResourceDesc { dimension: 3, alignment: 0, width: 2560, height: 1440, depth_or_array_size: 1, mip_levels: 1, format: 115, sample_count: 1, sample_quality: 0, layout: 0, flags: 1 }
**@⁠n-romanovich** on GitHub · 2026-11-25 13:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180#issuecomment-7164530266) @⁠Marvisak, updated `pr/format-support-and-library-save` (`a4abd07`) to address all triage points: 1. **Split unrelated change**: moved the `pipeline/library.rs` `save()` optimization (with the `USED_CHANGED` swap moved after `Serialize` succeeds) to a separate branch `perf/skip-redundant-library-save`. This PR now contains only the format-support / `host_desc` change. 2. **Reused `CheckFeatureSupport` cache**: extended `descriptor::host::typed_store` into `pub(crate) fn format_support1(format: u32) -> Option<u32>` so `resource.rs` reuses the single cache instead of adding a second one. 3. **Later UAV / RTV handling & logging**: - `host_desc` logs (`tracing::warn!`) when stripping `ALLOW_UNORDERED_ACCESS` or `ALLOW_RENDER_TARGET`. - Later UAVs on a stripped texture are already refused and logged by `descriptor::host::fits`. - Later RTVs in `draw.rs` (`OMSetRenderTargets`) and `list.rs` (`ClearRenderTargetView`) now check `resource::allows_render_target(texture)` and warn + skip instead of calling `CreateRenderTargetView` on a non-RT host texture. 4. **Title evidence**: GTA VI creates `B4G4R4A4_UNORM` (`format: 115`) textures with `ALLOW_RENDER_TARGET` (`flags: 1`), which previously failed on the host with `0x80070057`: `WARN victory_gpu::resource: no host texture error=... (0x80070057) desc=ResourceDesc { dimension: 3, alignment: 0, width: 2560, height: 1440, depth_or_array_size: 1, mip_levels: 1, format: 115, sample_count: 1, sample_quality: 0, layout: 0, flags: 1 }`
Author
Owner

@⁠Slay326 on GitHub · 2026-11-25 14:13 UTC · original

Measured on an RTX 3070 with a 3,843 MB library (27,160 pipelines): read whole it is one 3,665 MB private allocation for the run, and save rewrote all of it six times in 130 s with made=0 (only the early list had changed), each time with a second copy in memory: process commit swung between 37.6 and 42.1 GB. With both PRs merged, process commit at start is 10.3 GB instead of 15.6 GB, and no save rewrites the library in a 480 s run.

AI-assisted.

**@⁠Slay326** on GitHub · 2026-11-25 14:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180#issuecomment-7164940220) Measured on an RTX 3070 with a 3,843 MB library (27,160 pipelines): read whole it is one 3,665 MB private allocation for the run, and `save` rewrote all of it six times in 130 s with `made=0` (only the early list had changed), each time with a second copy in memory: process commit swung between 37.6 and 42.1 GB. With both PRs merged, process commit at start is 10.3 GB instead of 15.6 GB, and no save rewrites the library in a 480 s run. AI-assisted.
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 19:36 UTC · original

RTX 4060 Laptop (610.47): merges cleanly onto main 13f91cae but does not build (allows_render_target(texture) at draw.rs:421 and list.rs:1016 needs &texture). With that fix: B5G5R5A1 UAV half fixed (flag dropped), B4G4R4A4 half no longer crashes but the target loses its render-target use, so its draws and clears are skipped; no new failures. Details and the side-by-side table with the other #1753 PRs: #1753. Tested with the help of an AI assistant (Claude Code).

**@⁠KainanP** on GitHub · 2026-11-25 19:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180#issuecomment-7172523176) RTX 4060 Laptop (610.47): merges cleanly onto main 13f91cae but **does not build** (`allows_render_target(texture)` at draw.rs:421 and list.rs:1016 needs `&texture`). With that fix: B5G5R5A1 UAV half **fixed** (flag dropped), B4G4R4A4 half no longer crashes but the target loses its render-target use, so its draws and clears are skipped; no new failures. Details and the side-by-side table with the other #1753 PRs: https://git.gtahub.st/github/Marvisak--VIctory/issues/1753. Tested with the help of an AI assistant (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:06 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because it does not build on main and its rule is stricter than the host. host_resource returns an owned ID3D12Resource now, so allows_render_target(texture) fails to compile in draw.rs and list.rs. The format-support query ignores the castable-format lists that make_texture passes, so on an RX 6700 XT and on WARP this strips flags from textures main creates fine (B8G8R8X8 with unordered access, formats 68, 69 and 89 with either flag). The skip messages also warn on every call rather than once. The problem in #1600 is real; dropping a use only after the host has refused the creation, in make_texture's last fallback, would fix it without those side effects.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 22:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2180#issuecomment-7175938347) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because it does not build on `main` and its rule is stricter than the host. `host_resource` returns an owned `ID3D12Resource` now, so `allows_render_target(texture)` fails to compile in `draw.rs` and `list.rs`. The format-support query ignores the castable-format lists that `make_texture` passes, so on an RX 6700 XT and on WARP this strips flags from textures `main` creates fine (B8G8R8X8 with unordered access, formats 68, 69 and 89 with either flag). The skip messages also warn on every call rather than once. The problem in #1600 is real; dropping a use only after the host has refused the creation, in `make_texture`'s last fallback, would fix it without those side effects. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

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!2180
No description provided.