GPU: mirror placed unordered texture views onto host textures #114

Open
github-bot wants to merge 1 commit from github-bot/gh-114 into main AGit
Owner

@⁠Kaivyyy on GitHub · 2026-11-24 21:35 UTC · original
Kaivyyy:gpu/placed-uav-textures → main · +314 −12 · 3 files · 1 commits · open

Summary

  • Add resource::uav_texture_at for placed unordered texture views (View::Placed(true, ...) where dimension != BUFFER): reuses a compatible unordered-access texture already recorded in TARGETS_AT at that address when present, or creates a placed ALLOW_UNORDERED_ACCESS texture starting in D3D12_RESOURCE_STATE_UNORDERED_ACCESS (normalizing mismatched resource vs. UAV formats such as R9G9B9E5_SHAREDEXP viewed as R32_UINT) and records it in TARGETS_AT.
  • Route placed unordered texture views through descriptor::host::placed_texture and make instead of dropping them with placed unordered texture view not mirrored, and mirror them when written into shader-visible view heaps (View::is_buffer returns false for placed unordered textures, matching texture-object UAVs) so shaders indexing ResourceDescriptorHeap directly see them as well.
  • Strip target/UAV flags on placed shader-resource views (View::Placed(false, ...)) before texture_at so they never overwrite TARGETS_AT and continue to GPU-copy texels from TARGETS_AT via resource::alias_of / texture::alias.

Addresses WARN victory_gpu::descriptor::host: placed unordered texture view not mirrored in #26.

Testing

  • Added descriptor::host::tests::placed_unordered_texture_view_mirrors_and_aliases_to_shader_view, covering 3D placed UAV mirroring on a shader-visible heap, reuse of existing TARGETS_AT resources, and GPU texel aliasing from an R32_UINT placed UAV into an R9G9B9E5_SHAREDEXP placed SRV.
  • cargo test -p victory-gpu --locked -- descriptor
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo xtask policy
**@⁠Kaivyyy** on GitHub · 2026-11-24 21:35 UTC · [original](https://github.com/fxceless/victory-fork/pull/114) `Kaivyyy:gpu/placed-uav-textures` → `main` · +314 −12 · 3 files · 1 commits · open ## Summary - Add `resource::uav_texture_at` for placed unordered texture views (`View::Placed(true, ...)` where `dimension != BUFFER`): reuses a compatible unordered-access texture already recorded in `TARGETS_AT` at that address when present, or creates a placed `ALLOW_UNORDERED_ACCESS` texture starting in `D3D12_RESOURCE_STATE_UNORDERED_ACCESS` (normalizing mismatched resource vs. UAV formats such as `R9G9B9E5_SHAREDEXP` viewed as `R32_UINT`) and records it in `TARGETS_AT`. - Route placed unordered texture views through `descriptor::host::placed_texture` and `make` instead of dropping them with `placed unordered texture view not mirrored`, and mirror them when written into shader-visible view heaps (`View::is_buffer` returns `false` for placed unordered textures, matching texture-object UAVs) so shaders indexing `ResourceDescriptorHeap` directly see them as well. - Strip target/UAV flags on placed shader-resource views (`View::Placed(false, ...)`) before `texture_at` so they never overwrite `TARGETS_AT` and continue to GPU-copy texels from `TARGETS_AT` via `resource::alias_of` / `texture::alias`. Addresses `WARN victory_gpu::descriptor::host: placed unordered texture view not mirrored` in #26. ## Testing - Added `descriptor::host::tests::placed_unordered_texture_view_mirrors_and_aliases_to_shader_view`, covering 3D placed UAV mirroring on a shader-visible heap, reuse of existing `TARGETS_AT` resources, and GPU texel aliasing from an `R32_UINT` placed UAV into an `R9G9B9E5_SHAREDEXP` placed SRV. - `cargo test -p victory-gpu --locked -- descriptor` - `cargo clippy --workspace --all-targets --locked -- -D warnings` - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` - `cargo xtask policy`
Give placed unordered texture views (2D, array and 3D) a host unordered-access texture at their placed address (reusing an existing compatible target at that address when present), mirror them immediately when written into shader-visible heaps, and keep TARGETS_AT intact when placed shader views carry target flags so cross-format placed SRVs alias the shader-written texels on the GPU.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:36:22 +00:00
Author
Owner

@⁠SkillIssueXO on GitHub · 2026-11-24 21:48 UTC · original

I tested d5c277e on an RTX 5070 Ti (621.24), Series X profile, with default renderer switches and VICTORY_DUMP_TARGETS=1 for the selected captures. The placed-UAV mirror/alias GPU test passed locally. The game reached Antonia’s dialogue, where the dark interior and missing wall/ceiling surfaces were still reproducible.

At frame 1900, the openings visible in the presented image were already visible in the 2560×1440 opaque depth and material targets. The main depth target was verified against the opaque draws in the same frame’s ops trace. It had stencil 0x08 set on 3,568,377 / 3,686,400 pixels (96.8%). At frame 2150 that was 3,684,729 / 3,686,400 (99.95%). The indoor marker survives on this run. The aggregate counts leave its per-surface accuracy open.

This was a PR-head verification of the remaining symptom. The run used no shader skips and no Relay. AI-assisted capture analysis (Codex, with Claude Code source review).

**@⁠SkillIssueXO** on GitHub · 2026-11-24 21:48 UTC · [original](https://github.com/fxceless/victory-fork/pull/114#issuecomment-7145409274) I tested `d5c277e` on an RTX 5070 Ti (621.24), Series X profile, with default renderer switches and `VICTORY_DUMP_TARGETS=1` for the selected captures. The placed-UAV mirror/alias GPU test passed locally. The game reached Antonia’s dialogue, where the dark interior and missing wall/ceiling surfaces were still reproducible. At frame 1900, the openings visible in the presented image were already visible in the 2560×1440 opaque depth and material targets. The main depth target was verified against the opaque draws in the same frame’s ops trace. It had stencil `0x08` set on 3,568,377 / 3,686,400 pixels (96.8%). At frame 2150 that was 3,684,729 / 3,686,400 (99.95%). The indoor marker survives on this run. The aggregate counts leave its per-surface accuracy open. This was a PR-head verification of the remaining symptom. The run used no shader skips and no Relay. AI-assisted capture analysis (Codex, with Claude Code source review).
Author
Owner

@⁠ThomasHFWright on GitHub · 2026-11-24 21:57 UTC · original

Linux/NVIDIA integration test of d5c277e on 4e17478b + #20 (14a1f07) + #98 (e8cad1e). RTX 5090 / Linux NVIDIA 620.73.4 / GE-Proton11-14. All title and GPU tests offline.

The new placed_unordered_texture_view_mirrors_and_aliases_to_shader_view test passes here. Complete GPU suite: 119 passed, 2 known vkd3d pipeline-library failures, 3 ignored (two ignored tests are local diagnostics). Diagnostic build, workspace all-target/all-feature Clippy with -D warnings, and native asset policy pass. The full workspace before adding this PR had 501 passes and 6 existing compatibility failures; only the affected GPU suite was rerun after adding it.

Runtime evidence:

  • With #98 alone, the world-loading run logs placed unordered texture view not mirrored dimension=3 once.
  • With this PR added, that warning is absent. The normal run still ends in Xid 13 / MMU fault after 101.1 s (exit 5). Per-command timestamp readback reaches an indirect dispatch of 0452fc2d2e2fc4c3; the next marker remains zero. 893/893 dumped SPIR-V modules validate for Vulkan 1.3 with scalar block layout.
  • A second run of the same binary, adding shader and render-target capture, advances farther and ends after 233.1 s (exit 5, Xid 109). Its last reached marker is before direct dispatch 55679a0547649d0b; the next marker remains zero. 1461/1461 dumped modules validate. The missing placed-UAV warning remains absent.

The final captures are still story-card/blank output, and sampled intermediate targets do not establish recognizable world geometry. This verifies the added texture path and removes the observed warning, but does not demonstrate a crash fix or normal world visuals. Capture readbacks and warm caches change timing, so the longer second run is not a stability claim. The timeout/marker instrumentation is local, opt-in diagnostic code; timestamps locate an interval rather than proving the cause of corruption. Normal shaders, loop limit 256, no shader skips.

Heap-clamp findings and baseline details: #98. No game data, images, or raw crash logs attached.

**@⁠ThomasHFWright** on GitHub · 2026-11-24 21:57 UTC · [original](https://github.com/fxceless/victory-fork/pull/114#issuecomment-7145610092) Linux/NVIDIA integration test of `d5c277e` on `4e17478b` + #20 (`14a1f07`) + #98 (`e8cad1e`). RTX 5090 / Linux NVIDIA 620.73.4 / GE-Proton11-14. All title and GPU tests offline. The new `placed_unordered_texture_view_mirrors_and_aliases_to_shader_view` test passes here. Complete GPU suite: **119 passed, 2 known vkd3d pipeline-library failures, 3 ignored** (two ignored tests are local diagnostics). Diagnostic build, workspace all-target/all-feature Clippy with `-D warnings`, and native asset policy pass. The full workspace before adding this PR had 501 passes and 6 existing compatibility failures; only the affected GPU suite was rerun after adding it. Runtime evidence: - With #98 alone, the world-loading run logs `placed unordered texture view not mirrored dimension=3` once. - With this PR added, that warning is absent. The normal run still ends in Xid 13 / MMU fault after 101.1 s (exit 5). Per-command timestamp readback reaches an indirect dispatch of `0452fc2d2e2fc4c3`; the next marker remains zero. 893/893 dumped SPIR-V modules validate for Vulkan 1.3 with scalar block layout. - A second run of the **same binary**, adding shader and render-target capture, advances farther and ends after 233.1 s (exit 5, Xid 109). Its last reached marker is before direct dispatch `55679a0547649d0b`; the next marker remains zero. 1461/1461 dumped modules validate. The missing placed-UAV warning remains absent. The final captures are still story-card/blank output, and sampled intermediate targets do not establish recognizable world geometry. **This verifies the added texture path and removes the observed warning, but does not demonstrate a crash fix or normal world visuals.** Capture readbacks and warm caches change timing, so the longer second run is not a stability claim. The timeout/marker instrumentation is local, opt-in diagnostic code; timestamps locate an interval rather than proving the cause of corruption. Normal shaders, loop limit 256, no shader skips. Heap-clamp findings and baseline details: https://git.gtahub.st/github/fxceless--victory-fork/pulls/98. No game data, images, or raw crash logs attached.
Author
Owner

@⁠ryotdev on GitHub · 2026-11-25 01:11 UTC · original

I found an address-reuse case where the SRV loses its source. On d5c277e, I created a placed UAV and its paired SRV, used the same address for a temporary target with a different width, then released that target. Looking up the original UAV returned its cached resource, but alias_of returned None for the paired SRV.

The fix restores the cached resource to TARGETS_AT when its entry is vacant. The regression also repeats the lookup while the temporary target is alive and verifies that it keeps its own SRV alias. Fix and regression test

The regression failed on the PR head and passed with the fix on Windows. The full victory-gpu library suite passed 112 tests with one ignored, including the existing placed-UAV texel-readback test. The asset-policy check passed. AI-assisted. The effect on game lighting is unmeasured.

**@⁠ryotdev** on GitHub · 2026-11-25 01:11 UTC · [original](https://github.com/fxceless/victory-fork/pull/114#issuecomment-7149290148) I found an address-reuse case where the SRV loses its source. On d5c277e, I created a placed UAV and its paired SRV, used the same address for a temporary target with a different width, then released that target. Looking up the original UAV returned its cached resource, but `alias_of` returned `None` for the paired SRV. The fix restores the cached resource to `TARGETS_AT` when its entry is vacant. The regression also repeats the lookup while the temporary target is alive and verifies that it keeps its own SRV alias. [Fix and regression test](https://github.com/ryotdev/victory-gta6/commit/84f80e21a535ddccedb7cb9386bbac121426ce3e) The regression failed on the PR head and passed with the fix on Windows. The full `victory-gpu` library suite passed 112 tests with one ignored, including the existing placed-UAV texel-readback test. The asset-policy check passed. AI-assisted. The effect on game lighting is unmeasured.
Author
Owner

@⁠BradRoland on GitHub · 2026-11-25 22:13 UTC · original

I tested the 2D placed-UAV path against the texture readback now on main. The synthetic resource was a 256×256 R32_FLOAT texture with one mip and a sentinel in title memory. The test creates the placed UAV, mirrors its descriptor, records a GPU clear to 4.0 through that descriptor, submits the list, and checks each texel in its tiled CPU layout with VICTORY_TEXTURE_BACK=1.

Build Adapter Result
9c184b3 WARP The placed view had no host UAV. The title allocation retained its sentinel.
9c184b3 + d5c277e WARP All 65,536 texels read back as 4.0.
Same patched build RTX 4080, driver 621.14 All 65,536 texels read back as 4.0.

The opt-in test is available as a single commit on top of that merge. Run cargo test -p victory-gpu --locked --features diagnostics placed_water_feedback -- --ignored --nocapture. Set VICTORY_D3D12_WARP=1 for software or leave it unset for hardware. Test source and commit

This exercises the 2D view type seen in #26 and a format used by the water readback. The game report does not identify that particular texture's format. Gameplay impact remains unverified.

**@⁠BradRoland** on GitHub · 2026-11-25 22:13 UTC · [original](https://github.com/fxceless/victory-fork/pull/114#issuecomment-7176088794) I tested the 2D placed-UAV path against the texture readback now on `main`. The synthetic resource was a 256×256 R32_FLOAT texture with one mip and a sentinel in title memory. The test creates the placed UAV, mirrors its descriptor, records a GPU clear to 4.0 through that descriptor, submits the list, and checks each texel in its tiled CPU layout with `VICTORY_TEXTURE_BACK=1`. | Build | Adapter | Result | | --- | --- | --- | | `9c184b3` | WARP | The placed view had no host UAV. The title allocation retained its sentinel. | | `9c184b3` + `d5c277e` | WARP | All 65,536 texels read back as 4.0. | | Same patched build | RTX 4080, driver 621.14 | All 65,536 texels read back as 4.0. | The opt-in test is available as a single commit on top of that merge. Run `cargo test -p victory-gpu --locked --features diagnostics placed_water_feedback -- --ignored --nocapture`. Set `VICTORY_D3D12_WARP=1` for software or leave it unset for hardware. [Test source and commit](https://github.com/BradRoland/victory-fork/commit/862d73c9c8e434ef3cfdbc727c992eef32d0a01e) This exercises the 2D view type seen in #26 and a format used by the water readback. The game report does not identify that particular texture's format. Gameplay impact remains unverified.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.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/114/head:github-bot/gh-114'
git switch 'github-bot/gh-114'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-114'
git switch 'github-bot/gh-114'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-114'
git switch 'github-bot/gh-114'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-114'
git switch 'main'
git merge --squash 'github-bot/gh-114'
git switch 'main'
git merge --ff-only 'github-bot/gh-114'
git switch 'main'
git merge 'github-bot/gh-114'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.