descriptor: a slot the host unmakes, or can only null, shows the neutral texture #557

Manually merged
github merged 2 commits from github-bot/gh-557 into main 2026-12-05 17:30:02 +00:00 AGit
Owner

@⁠deebsy on GitHub · 2026-12-05 04:44 UTC · original
deebsy:neutral-stand-ins → main · +186 −38 · 3 files · 2 commits · merged 2026-12-05 17:28 UTC

Problem

Two places hand a slot a null view where its texture is a 2D texture or an array, and a null reads zeros. The title unpacks a texture's channels itself (BC5 normals, YCoCg colour), so a zero read is not a black texel: it is whatever that arithmetic makes of it. The reporter of #37 found it makes green, and the same thing happens here.

  1. HostHeap::unmake — a slot whose memory a newer view of other memory made stale:
match view_at(key as u32, (key >> 32) as u32) {
    Some(view) => null_for(&view, self.at(index)),
    None => null_view(self.at(index)),
}

unmake_stale calls it for every stale slot: 160,623 of them in one four-minute session here.

  1. null_for — any 2D texture view the host cannot make (its host copy is not there yet):
View::Shader(_, Some(desc)) => return null_like(desc, at),

Change

Both now show the neutral texture that the waiting paths already show for 2D textures and arrays (show_later, mirror, unmade_shader_texture). neutral_at() is split out of neutral_for() so the descriptor is built in one place. Only views that read as colour take it: *_UINT/*_SINT and depth/stencil views keep their null (an integer view reads the grey bytes as a garbage integer, and a comparison over RGBA8 is undefined; the card and WARP disagreed on it), with a depth texture also found by its resource's flags. The stand-in is a 256-slice array, and an array's view covers the slices the title named, so slices after the first read grey too. Every other kind keeps its null of the same kind: buffers, unordered access, 1D, 3D textures and cubes.

One new log line carries the two counters, so a run says how often each path fired.

Measured

RX 7900 XTX (24 GB), Series X profile, 2560x1440 output from a 1920x1080 render, ray tracing on, the boat yard and the bushy shoreline of #37:

before after
flashing lime-green shrubs every session before none in the 4 sessions after (the pan flash and the static trees below are separate)
slots unmade as another texture's that took the neutral texture 0 74,636 of 160,623
null 2D texture views shown as the neutral texture 0 313,412 in a second 4-minute session

Frame times are unchanged: the title's own 30 fps cap held throughout, and the log has no new warnings.

What this does not fix: a whole tree at medium distance can still be solid lime green, and a fast camera pan can flash it for a frame or two. That is texture streaming latency (#396) — the slot holds a real texture whose pages have not all arrived, so it is not a null and not this change. It still turns to correct and stays correct. A follow-up can clamp the levels a view exposes to the levels that are there; this patch does not touch that path.

Evidence that the remaining green is not the stand-in: the neutral texture was recoloured magenta, then white (local debug builds, not in this PR); the remaining trees stayed lime green both times.

Cost

None measurable. The neutral texture is one 1x1 RGBA8 texture of 256 slices (1 KiB), made once and alive for the process, so the new call sites add no allocation.

For the RDNA3 branch

neutral-stand-ins cherry-picks onto origin/rdna2-3 with no conflicts:

git worktree add /tmp/rdna3-check origin/rdna2-3
cd /tmp/rdna3-check
git cherry-pick -n ec05865

Both files auto-merge, and stand_in_room_lately's texture stand-in work is untouched — the two changes are about different slots (unmade/null ones vs. rewritten ones), so they should complement rather than fight. Testing there is welcome; if it helps, take it.

Testing

git fetch origin pull/557/head:neutral-stand-ins
git switch neutral-stand-ins
./build.sh
./run.sh play

The new line appears with the 5-second host statistics:

texture slots shown the neutral texture while their view is not made, since the start: N unmade as their memory was another texture's, M whose null view the host would have written

PKG=victory-gpu ./build.sh test --lib descriptor::host::tests -- --test-threads=2 passes 35 tests, including the new a_null_2d_texture_view_is_the_neutral_texture.

Assistance

This change was written with DeepSeek V4.1. The code, the evidence for it and this text were audited by GLM-5.3 (OpenCode): the quoted code against the commit's parent, the log line and the test against the commit, and the counters and the recolour runs against the session logs.

**@⁠deebsy** on GitHub · 2026-12-05 04:44 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557) `deebsy:neutral-stand-ins` → `main` · +186 −38 · 3 files · 2 commits · merged 2026-12-05 17:28 UTC ## Problem Two places hand a slot a null view where its texture is a 2D texture or an array, and a null reads zeros. The title unpacks a texture's channels itself (BC5 normals, YCoCg colour), so a zero read is not a black texel: it is whatever that arithmetic makes of it. The reporter of #37 found it makes green, and the same thing happens here. 1. `HostHeap::unmake` — a slot whose memory a newer view of other memory made stale: ```rust match view_at(key as u32, (key >> 32) as u32) { Some(view) => null_for(&view, self.at(index)), None => null_view(self.at(index)), } ``` `unmake_stale` calls it for every stale slot: 160,623 of them in one four-minute session here. 2. `null_for` — any 2D texture view the host cannot make (its host copy is not there yet): ```rust View::Shader(_, Some(desc)) => return null_like(desc, at), ``` ## Change Both now show the neutral texture that the waiting paths already show for 2D textures and arrays (`show_later`, `mirror`, `unmade_shader_texture`). `neutral_at()` is split out of `neutral_for()` so the descriptor is built in one place. Only views that read as colour take it: `*_UINT`/`*_SINT` and depth/stencil views keep their null (an integer view reads the grey bytes as a garbage integer, and a comparison over RGBA8 is undefined; the card and WARP disagreed on it), with a depth texture also found by its resource's flags. The stand-in is a 256-slice array, and an array's view covers the slices the title named, so slices after the first read grey too. Every other kind keeps its null of the same kind: buffers, unordered access, 1D, 3D textures and cubes. One new log line carries the two counters, so a run says how often each path fired. ## Measured RX 7900 XTX (24 GB), Series X profile, 2560x1440 output from a 1920x1080 render, ray tracing on, the boat yard and the bushy shoreline of #37: | | before | after | |---|---|---| | flashing lime-green shrubs | every session before | none in the 4 sessions after (the pan flash and the static trees below are separate) | | slots unmade as another texture's that took the neutral texture | 0 | 74,636 of 160,623 | | null 2D texture views shown as the neutral texture | 0 | 313,412 in a second 4-minute session | Frame times are unchanged: the title's own 30 fps cap held throughout, and the log has no new warnings. What this does **not** fix: a whole tree at medium distance can still be solid lime green, and a fast camera pan can flash it for a frame or two. That is texture streaming latency (#396) — the slot holds a real texture whose pages have not all arrived, so it is not a null and not this change. It still turns to correct and stays correct. A follow-up can clamp the levels a view exposes to the levels that are there; this patch does not touch that path. Evidence that the remaining green is not the stand-in: the neutral texture was recoloured magenta, then white (local debug builds, not in this PR); the remaining trees stayed lime green both times. ## Cost None measurable. The neutral texture is one 1x1 RGBA8 texture of 256 slices (1 KiB), made once and alive for the process, so the new call sites add no allocation. ## For the RDNA3 branch `neutral-stand-ins` cherry-picks onto `origin/rdna2-3` with no conflicts: ```sh git worktree add /tmp/rdna3-check origin/rdna2-3 cd /tmp/rdna3-check git cherry-pick -n ec05865 ``` Both files auto-merge, and `stand_in_room_lately`'s texture stand-in work is untouched — the two changes are about different slots (unmade/null ones vs. rewritten ones), so they should complement rather than fight. Testing there is welcome; if it helps, take it. ## Testing ```sh git fetch origin pull/557/head:neutral-stand-ins git switch neutral-stand-ins ./build.sh ./run.sh play ``` The new line appears with the 5-second host statistics: ```text texture slots shown the neutral texture while their view is not made, since the start: N unmade as their memory was another texture's, M whose null view the host would have written ``` `PKG=victory-gpu ./build.sh test --lib descriptor::host::tests -- --test-threads=2` passes 35 tests, including the new `a_null_2d_texture_view_is_the_neutral_texture`. ## Assistance This change was written with DeepSeek V4.1. The code, the evidence for it and this text were audited by GLM-5.3 (OpenCode): the quoted code against the commit's parent, the log line and the test against the commit, and the counters and the recolour runs against the session logs.
A slot whose memory a newer view of other memory made stale (`unmake`), and a
slot whose 2D texture view the host cannot make, were given a null view, which
reads zeros. The title unpacks a texture's channels itself (normal maps,
YCoCg), so a zero read is not a black texel but whatever that arithmetic makes
of it. The reporters of issue 37 found it makes green: trees and shrubs flashed
neon green while they streamed in, and trees a few tens of metres out stayed
solid lime green until they were close.

Both now show the neutral texture the waiting paths already show for 2D
textures and arrays (`show_later`, `mirror`). Every other kind keeps its null of
the same kind: buffers, unordered access, 3D textures and cubes.

Measured on an RX 7900 XTX (24 GB), Series X profile, 2560x1440 output from a
1920x1080 render, ray tracing on, the boat yard and the bushy shoreline of
issue 37:
- the flashing lime-green shrubs, seen every session before this change, are
  gone;
- 74,636 of the 160,623 slots unmade as another texture's in a 4-minute session
  showed the neutral texture (the rest were buffers and other kinds);
- 313,412 null 2D texture views were shown as the neutral texture in the same
  session: that is how often the null view was being read;
- frame times unchanged: the title's own 30 fps cap was held throughout, and
  the log has no new warnings.

Still green on a fast camera pan: a texture uploaded before its pages arrive
shows its zeros for a frame or two. That is the streaming latency of #396, not
this change; a later patch clamps a view's levels to the levels that are there.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 04:51:27 +00:00
github-bot force-pushed github-bot/gh-557 from 26c0b3c13b to 1363fc1c50 2026-12-05 05:02:02 +00:00 Compare
Author
Owner

@⁠deebsy on GitHub · 2026-12-05 05:17 UTC · original

After reading #543 and the #216 commits it carries, a note on where this PR sits.

Both build on the neutral stand-in this PR extends. In the runs behind #396, #543 counts 394,468 of 915,000 slots showing the stand-in while their upload ran, and its VICTORY_SMALL_BACKLOG then shows a blurred texture instead — one made from a first copy that holds only a texture's first page's levels, while the pass is behind. That is complementary rather than overlapping: #543 shortens how long a slot's first copy waits during a backlog; this PR fixes what slots read that have no view to wait for — the unmade (160,623 in a four-minute session here; 74,636 of them 2D or arrays, now the neutral texture) and the nulled 2D views (313,412), which read zeros, which the title's own channel unpacking turns green.

What this PR does not fix — the whole tree green until it is approached, in #37 — is the third piece: a partly arrived copy's view still exposes the levels whose pages are not there, and they read as zeros. Clamping such a view to the levels that are verifiably there is being prepared separately.

**@⁠deebsy** on GitHub · 2026-12-05 05:17 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7432519681) After reading #543 and the #216 commits it carries, a note on where this PR sits. Both build on the neutral stand-in this PR extends. In the runs behind #396, #543 counts 394,468 of 915,000 slots showing the stand-in while their upload ran, and its `VICTORY_SMALL_BACKLOG` then shows a blurred texture instead — one made from a first copy that holds only a texture's first page's levels, while the pass is behind. That is complementary rather than overlapping: #543 shortens how long a slot's *first* copy waits during a backlog; this PR fixes what slots read that have no view to wait for — the unmade (160,623 in a four-minute session here; 74,636 of them 2D or arrays, now the neutral texture) and the nulled 2D views (313,412), which read zeros, which the title's own channel unpacking turns green. What this PR does not fix — the whole tree green until it is approached, in #37 — is the third piece: a partly arrived copy's view still exposes the levels whose pages are not there, and they read as zeros. Clamping such a view to the levels that are verifiably there is being prepared separately.
Author
Owner

@⁠deebsy on GitHub · 2026-12-05 05:17 UTC · original

Merge-order note: #543 (carrying #216's small-first commits) also changes crates/victory-gpu/src/descriptor/host.rs and the statistics block in host.rs — the two files this PR touches. I have not line-audited #543's diff against this branch, so treat this as a heads-up rather than a conflict report: this PR's shape is a function split (neutral_at out of neutral_for), two fallback call sites and two counters, which should keep the rebase small. Whichever merges second rebases; either order works for this branch.

**@⁠deebsy** on GitHub · 2026-12-05 05:17 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7432519698) Merge-order note: #543 (carrying #216's small-first commits) also changes `crates/victory-gpu/src/descriptor/host.rs` and the statistics block in `host.rs` — the two files this PR touches. I have not line-audited #543's diff against this branch, so treat this as a heads-up rather than a conflict report: this PR's shape is a function split (`neutral_at` out of `neutral_for`), two fallback call sites and two counters, which should keep the rebase small. Whichever merges second rebases; either order works for this branch.
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-05 05:47 UTC · original

Checked 1363fc1 on native Windows (one NVIDIA desktop card plus WARP, didn't run the game). Merge base is current main (b581f7e).

The change is unconditional, there's no switch. Every 2D texture or 2D array slot that HostHeap::unmake or null_for used to null now gets the 1x1 grey texture, whatever the title's view format is. The quoted "before" code matches main, the three waiting paths that already used neutral_for are as described (descriptor/host.rs:2576, 3522, 4947), and descriptor::host::tests has 35 tests as the body says.

For the test suite I ran cargo test -p victory-gpu --lib --test-threads=4, skipping views_die_with_their_resource. The PR gives 354 passed and 4 failed, main gives 352 passed and 5 failed. The four are the known ones on both (the two indirect host_list tests and the two pipeline library loads) and main's fifth is the flaky watch test. The new test passes. A diagnostics build with VICTORY_D3D12_DEBUG=1 gives 401 passed and 5 failed on the PR, the same four plus the flaky watch test. On WARP it's 400 and 6, the extra one being views_are_made_beside_the_heap_and_copied_in, which I didn't rerun on this main but which has failed on main under WARP in earlier runs too. I ran the new test with the rest of descriptor:: six times in a row on 4 threads and it never failed, so I saw no sign of its global counter racing with other tests. views_die_with_their_resource on its own still crashes with an access violation on both PR and main, and this PR doesn't touch that path. clippy on victory-gpu --all-targets reports nothing new, and cargo check -p victory is clean.

I also wanted to see what a shader actually reads, so I wrote a throwaway compute test (not pushed). It writes one slot with null_for (the PR path) and one with null_like (what main wrote), dispatches a shader that reads the slot, and copies the result back. I ran it on the card and on WARP with the debug layer plus GPU-based validation, and read the info queue myself after each dispatch. As a control I bound a 3D null to a Texture2D shader, and validation flagged that on both devices, so the layer was listening.

  • Float Load and SampleLevel from an RGBA8/BC7 2D view read 0.502 in all four channels on the PR and 0 on main, on both devices. That's the intended fix. Note alpha is 0.502 now where a null gave 0, so alpha-tested geometry that a null clipped away may now draw grey depending on its cutoff. I didn't test that in a draw.
  • Texture2D<uint> over an R32_UINT title view reads 0x3f008081 on the PR (the float bits of 0.502), and 0 on main. Same on both devices. The debug layer and GPU-based validation said nothing.
  • SampleCmpLevelZero over an R32_FLOAT title view returned 0.502 on the card and 0 on WARP. Main gave 0 on both. No validation message either.
  • A Texture2DArray Load of slice 0 reads grey, but slice 2 still reads 0, because the neutral view has ArraySize 1 and an out of range Load returns zeros. I only tried Load here, not Sample.

The cause is that neutral_at (descriptor/host.rs:445) only looks at the dimension and never at desc[0]. On main a null reads 0 whatever the format, which is harmless. A real RGBA8_UNORM view behind a uint or comparison declaration is undefined in D3D12, and the two devices already disagree on it. The waiting paths had the same blind spot before this PR. What's new is the reach. unmake (descriptor/host.rs:2760) runs for slots whose placed memory a newer view overlapped, and nothing in note_buffer (2916) filters that by format. null_for (5284, 5291) runs for any 2D view mirror couldn't make or is holding back (3555). I didn't check which formats actually go down these paths in a real session, so this may never bite in practice, but a garbage uint where a 0 used to come back is the case I'd worry about if a title uses it as an index. I'd gate neutral_at on the format and keep null_like for the *_UINT and *_SINT formats and the depth/stencil SRV formats (R32_FLOAT_X8X24_TYPELESS, X32_TYPELESS_G8X24_UINT, R24_UNORM_X8_TYPELESS, X24_TYPELESS_G8_UINT, plus R32_FLOAT and R16_UNORM when the resource is known to be a depth one). That covers the waiting paths too, since they go through the same function.

On locking, from reading only (no stress test), unmake keeps the same lock and the same quick_is, put, clear_twin, keep sequence as before, now with the neutral texture passed to keep the way show_later already does. The first neutral() call can still create the texture and wait on a fence while a slot lock is held, but main already does that from show_later and mirror, so it isn't new.

A few smaller things. unmake is also called from texture_slot_gone (descriptor/host.rs:2506, the 3 second away path), not only from unmake_stale, so UNMADE_NEUTRAL (5010) and the new log line in host.rs:7965 ("unmade as their memory was another texture's") count those too, and the 74,636 in the body mixes both. The warning in unmade_shader_texture (descriptor/host.rs:4956) still says "(null, reads as zeros)", but its None return ends at null_for through mirror, which now writes grey for 2D views. And the new test only checks the counter, never that the slot reads something other than zero, so a readback like the one above would pin the behaviour down.

I didn't test the game itself, the RDNA3 branch cherry-pick, an AMD or Intel card, or draws, everything above was compute. I also didn't drive the real unmake, unmake_stale or texture_slot_gone paths end to end. My probe only went through null_for and null_like, and unmake reaches the same neutral_at through neutral_for.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-05 05:47 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7432884068) Checked 1363fc1 on native Windows (one NVIDIA desktop card plus WARP, didn't run the game). Merge base is current main (b581f7e). The change is unconditional, there's no switch. Every 2D texture or 2D array slot that `HostHeap::unmake` or `null_for` used to null now gets the 1x1 grey texture, whatever the title's view format is. The quoted "before" code matches main, the three waiting paths that already used `neutral_for` are as described (descriptor/host.rs:2576, 3522, 4947), and `descriptor::host::tests` has 35 tests as the body says. For the test suite I ran `cargo test -p victory-gpu --lib --test-threads=4`, skipping views_die_with_their_resource. The PR gives 354 passed and 4 failed, main gives 352 passed and 5 failed. The four are the known ones on both (the two indirect host_list tests and the two pipeline library loads) and main's fifth is the flaky watch test. The new test passes. A diagnostics build with VICTORY_D3D12_DEBUG=1 gives 401 passed and 5 failed on the PR, the same four plus the flaky watch test. On WARP it's 400 and 6, the extra one being views_are_made_beside_the_heap_and_copied_in, which I didn't rerun on this main but which has failed on main under WARP in earlier runs too. I ran the new test with the rest of `descriptor::` six times in a row on 4 threads and it never failed, so I saw no sign of its global counter racing with other tests. views_die_with_their_resource on its own still crashes with an access violation on both PR and main, and this PR doesn't touch that path. clippy on victory-gpu --all-targets reports nothing new, and `cargo check -p victory` is clean. I also wanted to see what a shader actually reads, so I wrote a throwaway compute test (not pushed). It writes one slot with `null_for` (the PR path) and one with `null_like` (what main wrote), dispatches a shader that reads the slot, and copies the result back. I ran it on the card and on WARP with the debug layer plus GPU-based validation, and read the info queue myself after each dispatch. As a control I bound a 3D null to a Texture2D shader, and validation flagged that on both devices, so the layer was listening. - Float Load and SampleLevel from an RGBA8/BC7 2D view read 0.502 in all four channels on the PR and 0 on main, on both devices. That's the intended fix. Note alpha is 0.502 now where a null gave 0, so alpha-tested geometry that a null clipped away may now draw grey depending on its cutoff. I didn't test that in a draw. - `Texture2D<uint>` over an R32_UINT title view reads 0x3f008081 on the PR (the float bits of 0.502), and 0 on main. Same on both devices. The debug layer and GPU-based validation said nothing. - `SampleCmpLevelZero` over an R32_FLOAT title view returned 0.502 on the card and 0 on WARP. Main gave 0 on both. No validation message either. - A Texture2DArray Load of slice 0 reads grey, but slice 2 still reads 0, because the neutral view has ArraySize 1 and an out of range Load returns zeros. I only tried Load here, not Sample. The cause is that `neutral_at` (descriptor/host.rs:445) only looks at the dimension and never at `desc[0]`. On main a null reads 0 whatever the format, which is harmless. A real RGBA8_UNORM view behind a uint or comparison declaration is undefined in D3D12, and the two devices already disagree on it. The waiting paths had the same blind spot before this PR. What's new is the reach. `unmake` (descriptor/host.rs:2760) runs for slots whose placed memory a newer view overlapped, and nothing in `note_buffer` (2916) filters that by format. `null_for` (5284, 5291) runs for any 2D view `mirror` couldn't make or is holding back (3555). I didn't check which formats actually go down these paths in a real session, so this may never bite in practice, but a garbage uint where a 0 used to come back is the case I'd worry about if a title uses it as an index. I'd gate `neutral_at` on the format and keep `null_like` for the *_UINT and *_SINT formats and the depth/stencil SRV formats (R32_FLOAT_X8X24_TYPELESS, X32_TYPELESS_G8X24_UINT, R24_UNORM_X8_TYPELESS, X24_TYPELESS_G8_UINT, plus R32_FLOAT and R16_UNORM when the resource is known to be a depth one). That covers the waiting paths too, since they go through the same function. On locking, from reading only (no stress test), `unmake` keeps the same lock and the same quick_is, put, clear_twin, keep sequence as before, now with the neutral texture passed to `keep` the way `show_later` already does. The first `neutral()` call can still create the texture and wait on a fence while a slot lock is held, but main already does that from `show_later` and `mirror`, so it isn't new. A few smaller things. `unmake` is also called from `texture_slot_gone` (descriptor/host.rs:2506, the 3 second away path), not only from `unmake_stale`, so `UNMADE_NEUTRAL` (5010) and the new log line in host.rs:7965 ("unmade as their memory was another texture's") count those too, and the 74,636 in the body mixes both. The warning in `unmade_shader_texture` (descriptor/host.rs:4956) still says "(null, reads as zeros)", but its `None` return ends at `null_for` through `mirror`, which now writes grey for 2D views. And the new test only checks the counter, never that the slot reads something other than zero, so a readback like the one above would pin the behaviour down. I didn't test the game itself, the RDNA3 branch cherry-pick, an AMD or Intel card, or draws, everything above was compute. I also didn't drive the real `unmake`, `unmake_stale` or `texture_slot_gone` paths end to end. My probe only went through `null_for` and `null_like`, and `unmake` reaches the same `neutral_at` through `neutral_for`. AI-assisted: yes
The neutral stand-in went to every 2D texture view and array, whatever its
format. An integer view read the grey RGBA8 bytes as an integer (0x3f008081
for 0.502, where a null gave 0), which a title may use as an index, and a
comparison or depth view is undefined over RGBA8 (the card and WARP disagreed:
0.502 against 0). Both keep their all-zero null now, and a depth texture is
also found by its resource's flags, so an R32_FLOAT SRV of one takes no grey.

The neutral texture is a 256-slice array as well, and an array's view covers
the slices the title named (clamped): a one-slice stand-in left every slice
after the first reading zeros, which the title's colour transforms turn green
(issue 37).

The two descriptions the review found stale are corrected: the "reads as
zeros" warning now names the neutral texture for a 2D colour view, and the
unmade counter says the gone path (texture_slot_gone) counts too.

Review: Kal0s-design on #557.
Author
Owner

@⁠deebsy on GitHub · 2026-12-05 06:07 UTC · original

Took the format point. Pushed ec05865:

  • neutral_at now takes the view's format and a depth flag. neutral_format keeps the all-zero null for *_UINT/*_SINT (including the stencil planes 22/47) and for depth/stencil formats; resource::is_depth also catches an R32_FLOAT SRV of a depth texture. This covers the waiting paths too, since they all go through neutral_at, so the card/WARP comparison disagreement no longer has a grey RGBA8 behind it.
  • Array slices: the neutral texture is now a 256x1x1 RGBA8 array, and a TEXTURE2DARRAY view binds the number of slices the title named (clamped to 256). Slice 2 of your probe reads grey now, not 0. A load past 256 is still zero.
  • The test asserts both directions: format 42 (R32_UINT), format 40 (D32_FLOAT) and a depth-flagged placed resource in a colour-format view do not increment NULL_NEUTRAL; 2D and array colour views do.
  • Fixed the two stale descriptions you found: the unmade_shader_texture warning ("reads as zeros") and the UNMADE_NEUTRAL counter label (the texture_slot_gone 3-second path calls unmake too).

Checks: cargo test -p victory-gpu --lib descriptor::host::tests — 35 passed under Wine. cargo clippy -p victory-gpu --all-targets --no-deps -- -D warnings — no findings in the touched lines; the workspace still has its pre-existing clippy-1.98 lints (26 lib / 28 lib-test) elsewhere.

Still open: your readback assertion. I left the test counter-based plus the negative gate cases; a Load/SampleLevel check would pin the 0.502 value if you want to send it, or I can add it. I did not test a draw, the game, or an AMD/Intel card this time.

**@⁠deebsy** on GitHub · 2026-12-05 06:07 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7433123382) Took the format point. Pushed `ec05865`: - `neutral_at` now takes the view's format and a depth flag. `neutral_format` keeps the all-zero null for `*_UINT`/`*_SINT` (including the stencil planes 22/47) and for depth/stencil formats; `resource::is_depth` also catches an `R32_FLOAT` SRV of a depth texture. This covers the waiting paths too, since they all go through `neutral_at`, so the card/WARP comparison disagreement no longer has a grey RGBA8 behind it. - Array slices: the neutral texture is now a 256x1x1 RGBA8 array, and a `TEXTURE2DARRAY` view binds the number of slices the title named (clamped to 256). Slice 2 of your probe reads grey now, not 0. A load past 256 is still zero. - The test asserts both directions: format 42 (`R32_UINT`), format 40 (`D32_FLOAT`) and a depth-flagged placed resource in a colour-format view do not increment `NULL_NEUTRAL`; 2D and array colour views do. - Fixed the two stale descriptions you found: the `unmade_shader_texture` warning ("reads as zeros") and the `UNMADE_NEUTRAL` counter label (the `texture_slot_gone` 3-second path calls `unmake` too). Checks: `cargo test -p victory-gpu --lib descriptor::host::tests` — 35 passed under Wine. `cargo clippy -p victory-gpu --all-targets --no-deps -- -D warnings` — no findings in the touched lines; the workspace still has its pre-existing clippy-1.98 lints (26 lib / 28 lib-test) elsewhere. Still open: your readback assertion. I left the test counter-based plus the negative gate cases; a Load/SampleLevel check would pin the 0.502 value if you want to send it, or I can add it. I did not test a draw, the game, or an AMD/Intel card this time.
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-05 06:23 UTC · original

Re-checked ec05865 on native Windows (one NVIDIA desktop card plus WARP). Everything I raised on 1363fc1 is addressed.

neutral_format (descriptor/host.rs:457) keeps the null for every DXGI *_UINT and *_SINT format. I went through the list and it's complete, including the single channel R8/R16/R32 ones, R10G10B10A2_UINT and the two stencil planes 22 and 47. The depth side covers 19, 20, 21, 40, 44, 45, 46 and 55, plus the console's 118 to 120 through pc_format. R32_FLOAT and R16_UNORM views of a depth texture are caught by the resource flag, through is_depth (resource.rs:353) for resource views and resource[12] & 2 for placed ones. TYPELESS formats can't be SRV formats, so their absence doesn't matter. The neutral texture now has 256 slices (descriptor/host.rs:357, filled at 427), and the array view takes the title's ArraySize clamped to 1..256 (508). neutral_at builds its own desc with MostDetailedMip 0, MipLevels 1 and FirstArraySlice 0, so a title view asking for 10 mips or a non-zero first slice still gets a valid desc. The warning in unmade_shader_texture (5004), the UNMADE_NEUTRAL doc comment and the meter line in host.rs:7965 now match what they count.

I rebuilt the throwaway compute probe (not pushed) and ran it with the debug layer and GPU-based validation, reading the info queue after each dispatch. All writes went through null_for. As before, a 3D null bound to a Texture2D shader was flagged on both devices, so validation was active. Results were the same on the card and on WARP, with no validation messages in any other case.

  • RGBA8 and BC7 2D float views read 0.502, as do placed 2D views without the depth flag.
  • R32_UINT, R8_UINT, R10G10B10A2_UINT, the stencil planes 47 and 22 (and console 120) all read 0, and so does an R32_UINT array.
  • SampleCmpLevelZero reads 0 for formats 46 and 21, and for placed R32_FLOAT and R16_UNORM views with the depth flag set.
  • Array Load reads grey at slice 2 of a 4-slice view, at slice 3 of a view with FirstArraySlice 2, at slice 255 of an ArraySize 4095 view with MipLevels 10, at slice 63 of a placed 64-slice view, and with ArraySize 0. SampleLevel at slice 2 is grey too. Slice 300 of the 4095 view reads 0, which matches the doc comment.

One case is left over. An R32_FLOAT view of a texture that isn't flagged as depth, read with SampleCmp, still gets 0.502 on the card and 0 on WARP, because the code has no way to tell it from a colour view. That would only matter if a title copies depth into a colour texture and compares against it, so I think it's fine to leave. The is_depth path for resource views I only checked by reading the code, since my probe used placed views for the depth flag. The new test asserts both directions through the counter but doesn't read anything back.

cargo test -p victory-gpu --lib on 4 threads, skipping views_die_with_their_resource, gives 353 passed and 5 failed. The failures are the known two indirect host_list tests, the two pipeline library loads and the flaky watch test. Both neutral tests pass. clippy on victory-gpu --all-targets reports the same 42 warnings as on 1363fc1, none of them on the changed lines.

As before, I didn't test the game, draws, or AMD and Intel cards.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-05 06:23 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7433310361) Re-checked ec05865 on native Windows (one NVIDIA desktop card plus WARP). Everything I raised on 1363fc1 is addressed. `neutral_format` (descriptor/host.rs:457) keeps the null for every DXGI *_UINT and *_SINT format. I went through the list and it's complete, including the single channel R8/R16/R32 ones, R10G10B10A2_UINT and the two stencil planes 22 and 47. The depth side covers 19, 20, 21, 40, 44, 45, 46 and 55, plus the console's 118 to 120 through `pc_format`. R32_FLOAT and R16_UNORM views of a depth texture are caught by the resource flag, through `is_depth` (resource.rs:353) for resource views and `resource[12] & 2` for placed ones. TYPELESS formats can't be SRV formats, so their absence doesn't matter. The neutral texture now has 256 slices (descriptor/host.rs:357, filled at 427), and the array view takes the title's ArraySize clamped to 1..256 (508). `neutral_at` builds its own desc with MostDetailedMip 0, MipLevels 1 and FirstArraySlice 0, so a title view asking for 10 mips or a non-zero first slice still gets a valid desc. The warning in `unmade_shader_texture` (5004), the `UNMADE_NEUTRAL` doc comment and the meter line in host.rs:7965 now match what they count. I rebuilt the throwaway compute probe (not pushed) and ran it with the debug layer and GPU-based validation, reading the info queue after each dispatch. All writes went through `null_for`. As before, a 3D null bound to a Texture2D shader was flagged on both devices, so validation was active. Results were the same on the card and on WARP, with no validation messages in any other case. - RGBA8 and BC7 2D float views read 0.502, as do placed 2D views without the depth flag. - R32_UINT, R8_UINT, R10G10B10A2_UINT, the stencil planes 47 and 22 (and console 120) all read 0, and so does an R32_UINT array. - SampleCmpLevelZero reads 0 for formats 46 and 21, and for placed R32_FLOAT and R16_UNORM views with the depth flag set. - Array Load reads grey at slice 2 of a 4-slice view, at slice 3 of a view with FirstArraySlice 2, at slice 255 of an ArraySize 4095 view with MipLevels 10, at slice 63 of a placed 64-slice view, and with ArraySize 0. SampleLevel at slice 2 is grey too. Slice 300 of the 4095 view reads 0, which matches the doc comment. One case is left over. An R32_FLOAT view of a texture that isn't flagged as depth, read with SampleCmp, still gets 0.502 on the card and 0 on WARP, because the code has no way to tell it from a colour view. That would only matter if a title copies depth into a colour texture and compares against it, so I think it's fine to leave. The `is_depth` path for resource views I only checked by reading the code, since my probe used placed views for the depth flag. The new test asserts both directions through the counter but doesn't read anything back. `cargo test -p victory-gpu --lib` on 4 threads, skipping views_die_with_their_resource, gives 353 passed and 5 failed. The failures are the known two indirect host_list tests, the two pipeline library loads and the flaky watch test. Both neutral tests pass. clippy on victory-gpu --all-targets reports the same 42 warnings as on 1363fc1, none of them on the changed lines. As before, I didn't test the game, draws, or AMD and Intel cards. AI-assisted: yes
Author
Owner

@⁠Widget9337 on GitHub · 2026-12-05 07:06 UTC · original

Tried this on an RX 9070 XT 16 GB (Ryzen 9 7950X3D, 64 GB RAM, CachyOS, this repo's Mesa and vkd3d-proton), Series X, 1080p with FSR 4 Balanced, ray tracing on. It merged cleanly onto main b581f7e (plus #428 and #445), release build. I'm keeping it: no frame rate change, and the gray stand-in looks fine in play.

With the stand-in colored magenta (a local switch, the same as on #463: the first texel of the neutral texture's upload set to ff 00 ff ff, which your copy loop puts on every slice), both paths fire a lot here:

downtown route (#554), about 4 min on foot, about 5 min
unmade (memory another texture's, or gone) 224,397 107,559
null view the host would have written 726,796 358,026

No errors in either log.

What turned magenta: glass more than anything, car windows and a sunroof, and the windows of most boats at the marina; also a banana plant, a fire hydrant, and a patch of road at a crossing. These weren't one frame blips. They stayed magenta for seconds, until I left the area and came back, and then they were correct (the crossing and the hydrant were back to normal on the return). So some of these slots stay unmade or null much longer than a frame or two here. With the switch off, a tree went gray for a bit before its real texture came in, which looks much better than whatever the zeros made of it before.

The one frame flashes from #69 and #463 didn't change. Surfaces that go black or bright for a single frame stayed black or bright, never magenta. With this and the earlier magenta test of the waiting slots on #463, none of the stand-in paths seem to be behind those.

**@⁠Widget9337** on GitHub · 2026-12-05 07:06 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7433876588) Tried this on an RX 9070 XT 16 GB (Ryzen 9 7950X3D, 64 GB RAM, CachyOS, this repo's Mesa and vkd3d-proton), Series X, 1080p with FSR 4 Balanced, ray tracing on. It merged cleanly onto `main` `b581f7e` (plus #428 and #445), release build. I'm keeping it: no frame rate change, and the gray stand-in looks fine in play. With the stand-in colored magenta (a local switch, the same as on #463: the first texel of the neutral texture's upload set to `ff 00 ff ff`, which your copy loop puts on every slice), both paths fire a lot here: | | downtown route (#554), about 4 min | on foot, about 5 min | |---|---|---| | unmade (memory another texture's, or gone) | 224,397 | 107,559 | | null view the host would have written | 726,796 | 358,026 | No errors in either log. What turned magenta: glass more than anything, car windows and a sunroof, and the windows of most boats at the marina; also a banana plant, a fire hydrant, and a patch of road at a crossing. These weren't one frame blips. They stayed magenta for seconds, until I left the area and came back, and then they were correct (the crossing and the hydrant were back to normal on the return). So some of these slots stay unmade or null much longer than a frame or two here. With the switch off, a tree went gray for a bit before its real texture came in, which looks much better than whatever the zeros made of it before. The one frame flashes from #69 and #463 didn't change. Surfaces that go black or bright for a single frame stayed black or bright, never magenta. With this and the earlier magenta test of the waiting slots on #463, none of the stand-in paths seem to be behind those.
Author
Owner

@⁠t-jonesy on GitHub · 2026-12-05 14:19 UTC · original

Supporting data for the format gate in ec05865, from real sessions. Kal0s's review left open which formats reach these paths in a real session.

Our setup. We ported ec05865's neutral_format / depth-flag gate into a fork, on every path that writes the neutral texture. That includes the waiting-path stand-ins, which go through neutral_for on main and through neutral_at with #557. The runs were on an RX 9070 XT, game 1.0.2.1, 4K output with FSR 4 Performance, ray tracing on, on the downtown route of #554. In these runs only the stand-in half of the gate was exercised; the unmade/null half was off.

What the gate kept null in a stand-in:

when integer views depth formats depth-flagged resources
about 5 s after the world appears 260-265 27-28 2,934
10 s later 913 35 106
afterwards, while driving – 0-2 per 5 s –
  • Load-time counts repeat run after run. The first row was 261 / 28 / 2,934 in 22 of 25 runs, and within ±4 in the other three.
  • Per run of about 5 min: about 1,170 integer views, 75 depth-format views and 3,040 views of depth-flagged resources (R32_FLOAT/R16_UNORM views of depth textures), almost all at load.
  • What that means without the gate. All of those would have got the grey RGBA8 neutral. That is the case Kal0s probed: an integer read of 0x3f008081, and a SampleCmpLevelZero of about 0.502 on the card, where a null gives 0.
  • The depth flag reads the right word. The placed-resource test (resource[12] & 2) reads the flags word correctly: one logged depth + UAV description had flags 0x80300006.

A possible visible effect (not confirmed). We have a ray-traced shadow flicker on one ramp with a period of exactly 3 frames. That fits a 3-deep ring of shadow inputs in which one slot sometimes waits a frame. If that waiting slot is a depth view given the grey stand-in, its comparisons return about 0.5, which would read as half shadow. We have not yet run that spot with the gate on and off, so this is only a lead. It would explain why neutral stand-ins in shadow inputs were seen to flicker highway shadows on the rdna2-3 branch.

So the gate is not a theoretical guard: on this title, a few thousand integer and depth views reach the stand-in paths at every load.

**@⁠t-jonesy** on GitHub · 2026-12-05 14:19 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/557#issuecomment-7439476276) Supporting data for the format gate in ec05865, from real sessions. Kal0s's review left open which formats reach these paths in a real session. **Our setup.** We ported ec05865's `neutral_format` / depth-flag gate into a fork, on every path that writes the neutral texture. That includes the waiting-path stand-ins, which go through `neutral_for` on main and through `neutral_at` with #557. The runs were on an RX 9070 XT, game 1.0.2.1, 4K output with FSR 4 Performance, ray tracing on, on the `downtown` route of #554. In these runs only the stand-in half of the gate was exercised; the unmade/null half was off. **What the gate kept null in a stand-in:** | when | integer views | depth formats | depth-flagged resources | |---|---|---|---| | about 5 s after the world appears | 260-265 | 27-28 | 2,934 | | 10 s later | 913 | 35 | 106 | | afterwards, while driving | – | 0-2 per 5 s | – | - **Load-time counts repeat run after run.** The first row was 261 / 28 / 2,934 in 22 of 25 runs, and within ±4 in the other three. - **Per run of about 5 min:** about 1,170 integer views, 75 depth-format views and 3,040 views of depth-flagged resources (R32_FLOAT/R16_UNORM views of depth textures), almost all at load. - **What that means without the gate.** All of those would have got the grey RGBA8 neutral. That is the case Kal0s probed: an integer read of 0x3f008081, and a `SampleCmpLevelZero` of about 0.502 on the card, where a null gives 0. - **The depth flag reads the right word.** The placed-resource test (`resource[12] & 2`) reads the flags word correctly: one logged depth + UAV description had flags `0x80300006`. **A possible visible effect (not confirmed).** We have a ray-traced shadow flicker on one ramp with a period of exactly 3 frames. That fits a 3-deep ring of shadow inputs in which one slot sometimes waits a frame. If that waiting slot is a depth view given the grey stand-in, its comparisons return about 0.5, which would read as half shadow. We have not yet run that spot with the gate on and off, so this is only a lead. It would explain why neutral stand-ins in shadow inputs were seen to flicker highway shadows on the rdna2-3 branch. So the gate is not a theoretical guard: on this title, a few thousand integer and depth views reach the stand-in paths at every load.
github manually merged commit 71a650fca8 into main 2026-12-05 17:30:02 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.