GPU: placed texture UAVs (View::Placed(true, ...)) are unconditionally dropped to null views #921

Closed
opened 2026-11-26 04:14:09 +00:00 by github-bot · 8 comments
Owner

@⁠hyperland956-lgtm on GitHub · 2026-11-24 14:11 UTC · original

Summary

Unordered access views created on textures the title placed in its own memory (View::Placed(true, resource, desc)) are unconditionally dropped to null UAVs in crates/victory-gpu/src/descriptor/host.rs, even though the host-texture lookup path (crate::resource::texture_at) already exists for placed texture SRVs. Any compute or pixel shader writing to a placed texture UAV has its writes silently discarded.

Root cause

In crates/victory-gpu/src/descriptor/host.rs:

  1. make() (lines 714–724) delegates View::Placed to placed_texture(view) first, and if that returns None and resource[0] != BUFFER, logs "placed unordered texture view not mirrored" once and returns None (which null_for() turns into a null UAV):
   View::Placed(unordered, resource, desc) => {
       if let Some(view) = placed_texture(view) {
           return make(&view, at);
       }
       const BUFFER: u32 = 1;
       if resource[0] != BUFFER {
           once!(dimension = resource[0], "placed unordered texture view not mirrored");
           return None;
       }

  1. placed_texture() (lines 738–749) hardcodes false for unordered, rejecting every placed texture UAV:
pub(crate) fn placed_texture(view: &View) -> Option<View> {
    const BUFFER: u32 = 1;
    let View::Placed(false, resource, desc) = view else {
        return None;
    };
    ...
    Some(View::Shader(texture as usize, desc[..10].try_into().ok()))
}

Suggested fix

  1. Allow placed_texture(view) to match View::Placed(unordered, resource, desc) for non-buffer resources:
  • Return View::Unordered(texture as usize, 0, desc[..10].try_into().ok()) when *unordered is true, and View::Shader(texture as usize, desc[..10].try_into().ok()) when false.
  1. In crate::resource::texture_at(address, desc) (crates/victory-gpu/src/resource.rs:1153), ensure that if a placed texture is viewed as a UAV (or if a subsequent UAV view arrives for an already-cached (address, *desc) entry whose ResourceDesc.flags lacked D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, or had ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS), the host texture supports UAV creation (or routes through the depth+UAV twin path in #469) and is marked texture::host_written so CPU-side uploads do not overwrite GPU UAV writes.

Synthetic reproduction (no game data)

  1. Allocate a 64 KiB-aligned backing buffer in title memory and construct a placed 2D R32_UINT texture ResourceDesc with D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS (flags = 0x4).
  2. Record a View::Placed(true, resource_words, uav_desc_words) descriptor in a descriptor heap and bind it to a compute shader that writes a non-zero sentinel to (0, 0).
  3. Observed: make() hits "placed unordered texture view not mirrored", emits a null UAV, and the texture remains zero.
  4. Expected: placed_texture() resolves the placed host texture and creates a real UAV so the compute write lands in the host texture.
**@⁠hyperland956-lgtm** on GitHub · 2026-11-24 14:11 UTC · [original](https://github.com/Marvisak/VIctory/issues/921) ## Summary Unordered access views created on textures the title placed in its own memory (`View::Placed(true, resource, desc)`) are unconditionally dropped to null UAVs in `crates/victory-gpu/src/descriptor/host.rs`, even though the host-texture lookup path (`crate::resource::texture_at`) already exists for placed texture SRVs. Any compute or pixel shader writing to a placed texture UAV has its writes silently discarded. ## Root cause In `crates/victory-gpu/src/descriptor/host.rs`: 1. `make()` (lines 714–724) delegates `View::Placed` to `placed_texture(view)` first, and if that returns `None` and `resource[0] != BUFFER`, logs `"placed unordered texture view not mirrored"` once and returns `None` (which `null_for()` turns into a null UAV): ```rust View::Placed(unordered, resource, desc) => { if let Some(view) = placed_texture(view) { return make(&view, at); } const BUFFER: u32 = 1; if resource[0] != BUFFER { once!(dimension = resource[0], "placed unordered texture view not mirrored"); return None; } ``` 2. `placed_texture()` (lines 738–749) hardcodes `false` for `unordered`, rejecting every placed texture UAV: ```rust pub(crate) fn placed_texture(view: &View) -> Option<View> { const BUFFER: u32 = 1; let View::Placed(false, resource, desc) = view else { return None; }; ... Some(View::Shader(texture as usize, desc[..10].try_into().ok())) } ``` ## Suggested fix 1. Allow `placed_texture(view)` to match `View::Placed(unordered, resource, desc)` for non-buffer resources: * Return `View::Unordered(texture as usize, 0, desc[..10].try_into().ok())` when `*unordered` is `true`, and `View::Shader(texture as usize, desc[..10].try_into().ok())` when `false`. 2. In `crate::resource::texture_at(address, desc)` (`crates/victory-gpu/src/resource.rs:1153`), ensure that if a placed texture is viewed as a UAV (or if a subsequent UAV view arrives for an already-cached `(address, *desc)` entry whose `ResourceDesc.flags` lacked `D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS`, or had `ALLOW_DEPTH_STENCIL | ALLOW_UNORDERED_ACCESS`), the host texture supports UAV creation (or routes through the depth+UAV twin path in #469) and is marked `texture::host_written` so CPU-side uploads do not overwrite GPU UAV writes. ## Synthetic reproduction (no game data) 1. Allocate a 64 KiB-aligned backing buffer in title memory and construct a placed 2D `R32_UINT` texture `ResourceDesc` with `D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS` (`flags = 0x4`). 2. Record a `View::Placed(true, resource_words, uav_desc_words)` descriptor in a descriptor heap and bind it to a compute shader that writes a non-zero sentinel to `(0, 0)`. 3. **Observed:** `make()` hits `"placed unordered texture view not mirrored"`, emits a null UAV, and the texture remains zero. 4. **Expected:** `placed_texture()` resolves the placed host texture and creates a real UAV so the compute write lands in the host texture.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:09 +00:00
Author
Owner

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

Sibling cross-check (ivall/xcl), read at the source: our path never routes a placed texture to a null view — dev_create_uav_x forwards the real desc to the host for every resource that legitimately has UAVs, including console/placed textures (those get both: the PC view and the console descriptor word; the title's at-address variant arrives on its own device-table entry, slot 0x47/71 dev_create_uav_at_x). Our only null-view downgrade is exactly the case your failure code describes — a resource without ALLOW_UNORDERED_ACCESS, where forwarding the real desc would remove the host device with the same 0x887A0001 — guarded, warned once per four hits, and commented with the removal code. So on our side the policy line runs under the resource flag, not under placed-ness; if the title UAVs a placed texture (and given placed creations are the title's bread and butter — device slot 0x428 — assume it does), the null-drop makes those writes silently vanish somewhere in your frame, which reads downstream as missing visualizations rather than as this issue. Same-hash title, same conclusion either way: flag is the invariant, placement is not.

**@⁠pickles976** on GitHub · 2026-11-24 14:14 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7134054228) Sibling cross-check (ivall/xcl), read at the source: our path never routes a placed texture to a null view — `dev_create_uav_x` forwards the **real** desc to the host for every resource that legitimately has UAVs, *including* console/placed textures (those get both: the PC view and the console descriptor word; the title's at-address variant arrives on its own device-table entry, slot `0x47`/71 `dev_create_uav_at_x`). Our **only** null-view downgrade is exactly the case your failure code describes — a resource without `ALLOW_UNORDERED_ACCESS`, where forwarding the real desc would remove the host device with the same `0x887A0001` — guarded, warned once per four hits, and commented with the removal code. So on our side the policy line runs under the *resource flag*, not under *placed-ness*; if the title UAVs a placed texture (and given placed creations are the title's bread and butter — device slot `0x428` — assume it does), the null-drop makes those writes silently vanish somewhere in your frame, which reads downstream as missing visualizations rather than as this issue. Same-hash title, same conclusion either way: flag is the invariant, placement is not.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-24 14:18 UTC · original

I reproduced the placed R32_UINT UAV case on Windows 10 with D3D12 WARP. On ffe310e, make returned no host texture for a placed resource carrying ALLOW_UNORDERED_ACCESS.

The already-written conversion in closed PR #552 does fix this case. With the same fixture on c261d8d, the view mirrored a real texture. A native UAV clear followed by readback returned the sentinel in all 16 texels, and GetDeviceRemovedReason succeeded. Tested commit

PR #205 addressed the typed null fallback. The conversion from the placed view to a resource-backed view is in the unmerged #552 diff. Conversion in #552

Synthetic 4×4 texture with the UAV flag. AI-assisted.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-24 14:18 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7134164815) I reproduced the placed `R32_UINT` UAV case on Windows 10 with D3D12 WARP. On `ffe310e`, `make` returned no host texture for a placed resource carrying `ALLOW_UNORDERED_ACCESS`. The already-written conversion in closed PR #552 does fix this case. With the same fixture on `c261d8d`, the view mirrored a real texture. A native UAV clear followed by readback returned the sentinel in all 16 texels, and `GetDeviceRemovedReason` succeeded. [Tested commit](https://github.com/Marvisak/VIctory/commit/c261d8d2d7891b815457a4dbfabd0d23de0338d7) PR #205 addressed the typed null fallback. The conversion from the placed view to a resource-backed view is in the unmerged #552 diff. [Conversion in #552](https://github.com/Marvisak/VIctory/commit/1cd9e5b594b1e26642481c564820b98033d09cde) Synthetic 4×4 texture with the UAV flag. AI-assisted.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-24 14:36 UTC · original

Standalone fix and WARP regression directly on upstream ffe310eb2098e52169f4c44db5ffdabf43a72622. It ports the placed-view conversion from #552 with the original author credited. Fix and test commit

The same regression uses guest placed UAV creation, VIctory’s dispatch and submission paths, and D3D12 texture readback. The synthetic shader writes one texel and leaves the neighboring texel untouched.

  • Before, on ffe310e: the dispatch recorded, but readback returned [0, 0, 0, 0] at the target texel.
  • After, on 8727921: readback returned [1, 0.5, -0.25, 2] at the target and zeros at the neighboring texel.

Native Windows WARP with Agility 1.620.2. GPU diagnostics: 54 passed, 1 existing benchmark ignored. Strict Clippy and asset policy passed. AI-assisted.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-24 14:36 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7134661870) Standalone fix and WARP regression directly on upstream `ffe310eb2098e52169f4c44db5ffdabf43a72622`. It ports the placed-view conversion from #552 with the original author credited. [Fix and test commit](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/872792176ed726e1d474ef5064ecf75ba81adf16) The same regression uses guest placed UAV creation, VIctory’s dispatch and submission paths, and D3D12 texture readback. The synthetic shader writes one texel and leaves the neighboring texel untouched. - Before, on `ffe310e`: the dispatch recorded, but readback returned `[0, 0, 0, 0]` at the target texel. - After, on `8727921`: readback returned `[1, 0.5, -0.25, 2]` at the target and zeros at the neighboring texel. Native Windows WARP with Agility 1.620.2. GPU diagnostics: 54 passed, 1 existing benchmark ignored. Strict Clippy and asset policy passed. AI-assisted.
Author
Owner

@⁠MichaelSmithAI on GitHub · 2026-11-24 14:31 UTC · original · edited 2026-11-24 14:38 UTC

Two additional stable-address checks passed on an RTX 4090 under Wine/vkd3d-proton 3.2. On our local integration (afa8994), a shader read back [64, 0, 255, 255] at all four texels after a 2×2 clear in both cases:

  • A placed UAV and a placed SRV identified the same texture by address and resource description.
  • An explicitly created, address-backed texture was cleared through its UAV, then read through a placed SRV with the same address and description.

On the comparison base (e235c44), the first UAV did not materialize and the second SRV resolved to a separate host texture. Both controls stopped at descriptor setup before submission. The first case complements the native WARP result for #552. The second also relies on the integration’s lookup of the existing texture object.

Those initial fixtures used guest descriptor creation with explicit host binding and dispatch. A follow-up on the same head now exercises both cases through the guest command-list vtable. It sets the descriptor heap and compute root tables, dispatches a DXC-built writer through the UAV, then dispatches a reader through the matching SRV into a separate output texture. The binder handles the transition between dispatches. Both tests checked the mirrored slots and read back [64, 0, 255, 255] at all four output texels. The test uses the host queue helper for submission and explicitly transitions the output for readback.

These checks cover matching descriptions and stable object lifetimes. Address reuse and the identity of the title’s 4K writer remain open. The separate native WARP regression covers guest submission for the standalone placed-UAV fix.

**@⁠MichaelSmithAI** on GitHub · 2026-11-24 14:31 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7134525119) · edited 2026-11-24 14:38 UTC Two additional stable-address checks passed on an RTX 4090 under Wine/vkd3d-proton 3.2. On our local integration (afa8994), a shader read back [64, 0, 255, 255] at all four texels after a 2×2 clear in both cases: - A placed UAV and a placed SRV identified the same texture by address and resource description. - An explicitly created, address-backed texture was cleared through its UAV, then read through a placed SRV with the same address and description. On the comparison base (e235c44), the first UAV did not materialize and the second SRV resolved to a separate host texture. Both controls stopped at descriptor setup before submission. The first case complements the [native WARP result for #552](https://git.gtahub.st/github/Marvisak--VIctory/issues/921). The second also relies on the integration’s lookup of the existing texture object. Those initial fixtures used guest descriptor creation with explicit host binding and dispatch. A follow-up on the same head now exercises both cases through the guest command-list vtable. It sets the descriptor heap and compute root tables, dispatches a DXC-built writer through the UAV, then dispatches a reader through the matching SRV into a separate output texture. The binder handles the transition between dispatches. Both tests checked the mirrored slots and read back [64, 0, 255, 255] at all four output texels. The test uses the host queue helper for submission and explicitly transitions the output for readback. These checks cover matching descriptions and stable object lifetimes. Address reuse and the identity of the title’s 4K writer remain open. The [separate native WARP regression](https://git.gtahub.st/github/Marvisak--VIctory/issues/921) covers guest submission for the standalone placed-UAV fix.
Author
Owner

@⁠NuraadGit on GitHub · 2026-11-24 16:24 UTC · original

An in-title count for this, as a near-negative result: placed unordered texture view not mirrored was logged in only 1 of my 107 runs on an RTX 2080. That run was on an early d2a4bae-based build, about a minute after launch, and the view was dimension=3 (2D). The warning was never logged on the stacks I run now (JMAN730's fork + open PRs), including 12-minute world runs, and never on the longest run (21 minutes).

In one traced world frame (6,218 ops that ran, with their bound views), 13 placed UAV views are bound, and all 13 are dimension 1 (buffers).

Limits: the trace lists bindings only for ops that ran, not for the 1,507 dropped ones, and many compute programs are still refused on this card, so a program that needs this may simply not run yet. On "the identity of the title's 4K writer": here the draw that writes the presented 3840x2160 image is pixel 4f4ec7b16673362f, through an ordinary render target (see #841).

AI-assisted (Claude Code): the trace and log analysis were automated. The hardware, title copy and runs are the user's.

**@⁠NuraadGit** on GitHub · 2026-11-24 16:24 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7137604822) An in-title count for this, as a near-negative result: **`placed unordered texture view not mirrored` was logged in only 1 of my 107 runs** on an RTX 2080. That run was on an early `d2a4bae`-based build, about a minute after launch, and the view was `dimension=3` (2D). The warning was never logged on the stacks I run now (JMAN730's fork + open PRs), including 12-minute world runs, and never on the longest run (21 minutes). In one traced world frame (6,218 ops that ran, with their bound views), 13 placed UAV views are bound, and all 13 are dimension 1 (buffers). Limits: the trace lists bindings only for ops that ran, not for the 1,507 dropped ones, and many compute programs are still refused on this card, so a program that needs this may simply not run yet. On "the identity of the title's 4K writer": here the draw that writes the presented 3840x2160 image is pixel `4f4ec7b16673362f`, through an ordinary render target (see #841). *AI-assisted (Claude Code): the trace and log analysis were automated. The hardware, title copy and runs are the user's.*
Author
Owner

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

I retested the placed-UAV dispatch after the upstream texture-sharing changes, on 70564ae08c82d43df5fad97b08d34628b07b1d9d. The same WARP dispatch still read back four zeroes at the target texel. With the placed-view conversion reapplied, the texel was [1.0, 0.5, -0.25, 2.0] and its neighbor stayed zero.

Rebased fix and regression, one commit on 70564ae with the original #552 credit preserved. The full GPU diagnostics suite passed 82 tests with one ignored. Strict GPU Clippy and asset policy passed.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-24 21:57 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7145622210) I retested the placed-UAV dispatch after the upstream texture-sharing changes, on `70564ae08c82d43df5fad97b08d34628b07b1d9d`. The same WARP dispatch still read back four zeroes at the target texel. With the placed-view conversion reapplied, the texel was `[1.0, 0.5, -0.25, 2.0]` and its neighbor stayed zero. [Rebased fix and regression](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/febfab51b0bfc14896efd0366777db59b4576b62), one commit on `70564ae` with the original #552 credit preserved. The full GPU diagnostics suite passed 82 tests with one ignored. Strict GPU Clippy and asset policy passed.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 01:09 UTC · original · edited 2026-11-25 20:18 UTC

The synthetic placed-UAV dispatch still hits this on the updated main 42363ab6cd. WARP read back [0, 0, 0, 0] before the fix. With the same test on 3a6b7e0, the target texel was [1, 0.5, -0.25, 2] and the adjacent texel stayed zero.

This is one commit directly on 42363ab, carrying the #552 author credit. Full WARP GPU suite: 145 passed, 2 ignored. Strict GPU Clippy and asset policy passed.

Update for current main 13f91ca and #1273 at b5ea728. The exact rebased test de8b16b still holds its Git authorship. In six paired WARP runs, current main read [0, 0, 0, 0] from the target. The PR read [1, 0.5, -0.25, 2], and the adjacent texel stayed zero. The serial GPU suite passed 202 tests with one ignored in both debug settings. PR CI

If the test is folded into another commit, please add the following trailer to retain its attribution.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 01:09 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7149267555) · edited 2026-11-25 20:18 UTC The synthetic placed-UAV dispatch still hits this on the updated main 42363ab6cd5265f0fb3b500ad265f2b84c6b5dbf. WARP read back [0, 0, 0, 0] before the fix. With the same test on [3a6b7e0](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/3a6b7e05cd6c9a1fd340361a54e2789dc1c38953), the target texel was [1, 0.5, -0.25, 2] and the adjacent texel stayed zero. This is one commit directly on 42363ab, carrying the #552 author credit. Full WARP GPU suite: 145 passed, 2 ignored. Strict GPU Clippy and asset policy passed. Update for current main 13f91ca and #1273 at b5ea728. The exact rebased test [de8b16b](https://github.com/Marvisak/VIctory/commit/de8b16b8eebc29a0f68c829561a157099f6a736c) still holds its Git authorship. In six paired WARP runs, current main read [0, 0, 0, 0] from the target. The PR read [1, 0.5, -0.25, 2], and the adjacent texel stayed zero. The serial GPU suite passed 202 tests with one ignored in both debug settings. [PR CI](https://github.com/Marvisak/VIctory/actions/runs/45651263572/job/139336079081) If the test is folded into another commit, please add the following trailer to retain its attribution. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Author
Owner

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

Automated triage for the maintainers.

Confirmed on current main: in crates/victory-gpu/src/descriptor/host.rs, placed_texture only matches View::Placed(false, ..), so a placed texture's unordered view never reaches crate::resource::texture_at, and make() logs "placed unordered texture view not mirrored" and returns None (a null UAV). Open PR #1273 ("GPU: mirror placed unordered texture views") addresses this; the closed #552 had the conversion tested in this thread.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 06:51 UTC · [original](https://github.com/Marvisak/VIctory/issues/921#issuecomment-7155230089) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T01:09:42Z at=2026-11-25T06:51:24Z --> Automated triage for the maintainers. Confirmed on current `main`: in `crates/victory-gpu/src/descriptor/host.rs`, `placed_texture` only matches `View::Placed(false, ..)`, so a placed texture's unordered view never reaches `crate::resource::texture_at`, and `make()` logs "placed unordered texture view not mirrored" and returns `None` (a null UAV). Open PR #1273 ("GPU: mirror placed unordered texture views") addresses this; the closed #552 had the conversion tested in this thread. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#921
No description provided.