GPU: give table slots without a view a null descriptor of the kind the shader reads #568

Closed
github-bot wants to merge 6 commits from gh-pr/568/head into gh-pr/568/base
Owner

@⁠BastienRodz on GitHub · 2026-11-24 05:02 UTC · original
BastienRodz:gpu/typed-null-descriptors → main · +1602 −78 · 8 files · 6 commits · closed without merging

For #508. Whether it ends that page fault still needs someone with the RDNA3 setup to check (see the end).

What

A host descriptor slot for which the title has no view we know is a null Texture2D SRV. Every host heap slot starts as one (HostHeap::fill_null), and fresh tables use one for empty entries (make_null). The translated shaders index the heap directly (SM 6.6), and each handle's annotation says what they expect. So a shader that writes such a slot as a UAV, or reads it as a buffer, uses a descriptor of the wrong type. That is undefined behavior. The dispatch in #508 has Uav s1+8: uav None and Uav s1+16: uav None in its table, and RDNA3 page-faults.

Now, where the title has no view, the host makes a null descriptor of the kind the shader annotates: SRV or UAV; typed, raw or structured buffer; or a texture of the right dimension. Writes are dropped and reads return zero.

How

  • victory-shader (emit/lower.rs):
    • handle() records, for each descriptor loaded from a table at a constant offset, the root parameter slot, the dword within the table and the resource properties it annotates the handle with. Both arms of a control-flow join are recorded.
    • If one slot is annotated as both SRV and UAV, the UAV annotation wins, deterministically.
    • Dynamically indexed loads are not recorded (shortcut:). Their empty slots keep the old null.
    • The list is exposed as HostShader::table_views.
  • Shader cache (shader_cache.rs): the new field is encoded. The magic goes to VSH2 and the converter version to 2, so old entries are rejected and translated again.
  • victory-gpu:
    • descriptor::host::null_desc_for_props maps an annotation to a null SRV, UAV or CBV description. Formats are R32_{FLOAT,UINT,SINT} by component type, raw buffers are R32_TYPELESS + RAW, structured buffers use the stride from the annotation, and textures get their dimension. Kinds without a valid null (MSAA UAVs, samplers) give None, and those slots keep the old null.
    • State::tables makes these nulls in three places:
      • empty entries of fresh tables (and when a view cannot be made);
      • mirrored title slots: HostHeap::mirror_for_draw remembers a typed null in the slot state, so a later real descriptor still replaces it;
      • annotated slots that no used-resource entry names (later elements of a range), but only when the title has no view there.
    • Fresh-table keys now include the annotations, and their size covers annotated slots.
  • A title view the host cannot make (an explicit Texture1D SRV with no resource, say) also takes the typed null a later draw annotates. Before, the null of the title's own dimension stayed, because the slot already counted as made (4b4d504, traced by @⁠alladeen321123 on WARP).
  • Mirrored slots are rewritten in place, so a draw recorded earlier would read whatever kind a later draw writes. A draw that would change a mirrored typed null's kind is refused under the slot's lock, and its table is made afresh in dynamic slots instead. An unannotated draw, or a title copy or write of an empty record, leaves an existing typed null alone (cd6d559, b2a6bd2, raised by @⁠SamuelReeder).
  • The null_view note recording that untyped null buffer views did not stop the world's low-address page faults (run w10) is kept, and now says that annotated slots get typed nulls.

Tested

Native Windows: the upstream CI's checks (clippy -D warnings with and without --all-features, then cargo test --workspace --locked) pass on GitHub's windows-latest at this head: https://github.com/BastienRodz/VIctory/actions/runs/45461216241

Linux x86_64, cross-built with cargo xwin for x86_64-pc-windows-msvc, run under Wine 11. GPU tests ran on vkd3d-proton 3.1 over Mesa lavapipe (VKD3D_FEATURE_LEVEL=12_0). No game data used: every test input is synthetic.

  • Plain Wine (no host device):
    • cargo xwin test -p victory-gpu: 52 passed, 0 failed, 1 ignored.
    • cargo xwin test -p victory-shader: 107 passed, 15 failed; main ffe310e gives 105 passed and the same 15 failed. They are emit::valu_tests::* and two emit::waterfall_tests::*, which need an SM 6.6 device. Rebased onto ffe310e. With the waterfall loops there, a per-lane load (resource::Waterfall) reads each lane's own entry, so it is not recorded as a table view (its offset is only the first lane's). The two table loads of an s_cselect choice are recorded, as a phi's are.
  • vkd3d-proton (host device): victory-gpu 51 passed and 1 failed, the environment failure a_rejected_blob_gives_an_empty_library that main has there too.
  • New tests:
    • table_views_record_srv_uav_structured_and_skip_dynamic: hand-assembled compute program; raw SRV, raw UAV and structured UAV recorded with their dwords, and a load with a dynamic soffset (from v_readfirstlane) not recorded.
    • table_views_prefer_uav_and_record_phi_arms: UAV wins in both orders; both arms of a branch are recorded.
    • null_desc_maps_buffer_and_texture_annotations: every buffer kind, every texture SRV and UAV dimension, the component-type formats, the CBV, and the unsupported kinds.
    • host_accepts_typed_null_descriptors_and_mirror_transitions (host-gated; ran on vkd3d-proton): the device takes every typed null. A mirrored slot goes from empty to typed null, then to another typed null, then to a real view once the title writes one. A slot past the heap is ignored. Device not removed.
    • Diagnostics (5bab0e2): each table line of the device-removed report ends with the shaders' annotation for that entry, or [not annotated].
  • shader_cache round-trip includes table_views, and VSH1 entries are rejected.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features (as the CI runs it): clean.
  • rustfmt: no new diffs in the changed code (the touched files keep the diffs they have on main). cargo xtask policy: 151 files ok.

Tested by others (thanks)

  • AwkGrep256, with the title, Linux, RX 9070 XT (RADV), Wine 11.22 + vkd3d-proton 3.2.0, main ffe310e + #190 #454 #493 #579 + this PR (comment): no regression on AMD. With VICTORY_SHADER_LOOP_LIMIT=1000, ~3.5 min in the world, then a GPUVM fault at 0x0 that also happens without this PR (after ~14 min), so it is not from it. Without a loop limit, a slow compute dispatch hangs earlier, also unrelated.
  • Wasler, with the title, via Dufftwt (summary, source): without this PR (on d2a4bae, WARP), the device was removed in compute 269b802f878c24e1 with UAV slots without a view (the #508 signature). With it (main ffe310e + this PR, RTX 5060 Ti, debug layer and DRED on), that crash doesn't happen and the run continues ~2 min 47 s into the world load, stopping at a vertex buffer left in UNORDERED_ACCESS (#334). Not a strict A/B (adapter and base differ).
  • DeerSilver, Windows 11, NVIDIA RTX 5060 Laptop (Blackwell), native D3D12, at 22e6676 on main ffe310e (comment): first NVIDIA run. cargo test --workspace --locked 346 passed, 0 failed (main: 342, so +4, the new tests); the GPU-executed valu_tests and waterfall_tests pass (the diff_tests skip there: they need the console SDK's dxc.exe). The driver accepts every typed null SRV, UAV and CBV. Workspace clippy with -D warnings: clean.
  • d1ll3x3, with the title, RX 7800 XT (RDNA3), Windows 11, diag + VICTORY_D3D12_DRED=1, main@8e79c80 + this PR + #67 + #609 or #431 (comment): 4 runs into the first mission's intro (2 min 39 s to 11 min 39 s). None of the device removals pointed at a null or typed-null slot: all were page faults inside freed textures or a buffer, covered by #609 and #431. No regressions seen. One conflict with #609, in describe_slot (diagnostics only).
  • zhien114514, with the title, Radeon 780M (RDNA3 iGPU, the #508 class), Windows 11, diag, VICTORY_SHADER_LOOP_LIMIT=1000, at ad7b7ea (comment): main removed the device ~63 s into the world. With this PR: no device removal, no ERROR lines, the world renders (0.3–0.9 fps), stopped by hand at 210 s. One run each, with no debug layer on that machine, so no DRED.
  • SAitken91, with the title, RX 6950 XT (RDNA2), Windows 11, diag + VICTORY_D3D12_DRED=1 (comment): one run reached ~78 s in the world (against ~3–4 s without), but a second run with this PR faulted after ~2 s, so timing is not conclusive yet (correction). The report's [heap N: null] entries could not show whether the typed nulls were placed. 5bab0e2 adds the annotation to each table line of the diagnostics report ([annotated <kind> <more>] / [not annotated]) so the next run can show it.
  • Mesrine67, Windows 11, AMD RX 6750 XT, native D3D12, at 0845e8d (comment): both table_views_* tests, null_desc_maps_buffer_and_texture_annotations, and host_accepts_typed_null_descriptors_and_mirror_transitions all pass. The last ran on a real device (checked that it did not return early), and the device was not removed. Full suites: victory-gpu --lib 45 passed, 0 failed, 1 ignored; victory-shader --lib 71 passed, 0 failed, including the seven valu_tests that need an SM 6.6 device.

Not run

  • The title, and any hardware GPU. The run-w10 note says untyped null buffer views alone did not stop the world's low-address faults. This change is narrower (the kind the shader annotates, SRV or UAV), and it removes a type mismatch the hardware does not have to survive, but whether #508's fault goes away is not proven. A diag run on the RDNA3 iGPU from #508 with VICTORY_D3D12_DRED=1 would settle it: does the fault in 2dc602192abf6288 stop, or does it move?
  • Dynamically indexed descriptors, and slots no shader annotates, keep the old null 2D view.

AI-assisted: implemented with Gemini 4 Neon, then reviewed, corrected and tested with Claude Code. Corrections: annotated slots that have a view are no longer made outside readable; the dynamic-offset test was fixed; the run-w10 note is kept. Every command above was really run.

🤖 Generated with Claude Code

**@⁠BastienRodz** on GitHub · 2026-11-24 05:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/568) `BastienRodz:gpu/typed-null-descriptors` → `main` · +1602 −78 · 8 files · 6 commits · closed without merging For #508. Whether it ends that page fault still needs someone with the RDNA3 setup to check (see the end). ## What A host descriptor slot for which the title has no view we know is a null **Texture2D SRV**. Every host heap slot starts as one (`HostHeap::fill_null`), and fresh tables use one for empty entries (`make_null`). The translated shaders index the heap directly (SM 6.6), and each handle's annotation says what they expect. So a shader that writes such a slot as a UAV, or reads it as a buffer, uses a descriptor of the wrong type. That is undefined behavior. The dispatch in #508 has `Uav s1+8: uav None` and `Uav s1+16: uav None` in its table, and RDNA3 page-faults. Now, where the title has no view, the host makes a null descriptor **of the kind the shader annotates**: SRV or UAV; typed, raw or structured buffer; or a texture of the right dimension. Writes are dropped and reads return zero. ## How - **victory-shader** (`emit/lower.rs`): - `handle()` records, for each descriptor loaded from a table at a constant offset, the root parameter slot, the dword within the table and the resource properties it annotates the handle with. Both arms of a control-flow join are recorded. - If one slot is annotated as both SRV and UAV, the UAV annotation wins, deterministically. - Dynamically indexed loads are not recorded (`shortcut:`). Their empty slots keep the old null. - The list is exposed as `HostShader::table_views`. - **Shader cache** (`shader_cache.rs`): the new field is encoded. The magic goes to `VSH2` and the converter version to 2, so old entries are rejected and translated again. - **victory-gpu**: - `descriptor::host::null_desc_for_props` maps an annotation to a null SRV, UAV or CBV description. Formats are `R32_{FLOAT,UINT,SINT}` by component type, raw buffers are `R32_TYPELESS` + `RAW`, structured buffers use the stride from the annotation, and textures get their dimension. Kinds without a valid null (MSAA UAVs, samplers) give `None`, and those slots keep the old null. - `State::tables` makes these nulls in three places: - empty entries of fresh tables (and when a view cannot be made); - mirrored title slots: `HostHeap::mirror_for_draw` remembers a typed null in the slot state, so a later real descriptor still replaces it; - annotated slots that no used-resource entry names (later elements of a range), but only when the title has no view there. - Fresh-table keys now include the annotations, and their size covers annotated slots. - A title view the host cannot make (an explicit Texture1D SRV with no resource, say) also takes the typed null a later draw annotates. Before, the null of the title's own dimension stayed, because the slot already counted as made (`4b4d504`, traced by @⁠alladeen321123 on WARP). - Mirrored slots are rewritten in place, so a draw recorded earlier would read whatever kind a later draw writes. A draw that would change a mirrored typed null's kind is refused under the slot's lock, and its table is made afresh in dynamic slots instead. An unannotated draw, or a title copy or write of an empty record, leaves an existing typed null alone (`cd6d559`, `b2a6bd2`, raised by @⁠SamuelReeder). - The `null_view` note recording that untyped null *buffer* views did not stop the world's low-address page faults (run w10) is kept, and now says that annotated slots get typed nulls. ## Tested **Native Windows:** the upstream CI's checks (clippy `-D warnings` with and without `--all-features`, then `cargo test --workspace --locked`) pass on GitHub's `windows-latest` at this head: https://github.com/BastienRodz/VIctory/actions/runs/45461216241 Linux x86_64, cross-built with `cargo xwin` for `x86_64-pc-windows-msvc`, run under Wine 11. GPU tests ran on vkd3d-proton 3.1 over Mesa lavapipe (`VKD3D_FEATURE_LEVEL=12_0`). No game data used: every test input is synthetic. - **Plain Wine (no host device):** - `cargo xwin test -p victory-gpu`: 52 passed, 0 failed, 1 ignored. - `cargo xwin test -p victory-shader`: 107 passed, 15 failed; `main` `ffe310e` gives 105 passed and the same 15 failed. They are `emit::valu_tests::*` and two `emit::waterfall_tests::*`, which need an SM 6.6 device. Rebased onto `ffe310e`. With the waterfall loops there, a per-lane load (`resource::Waterfall`) reads each lane's own entry, so it is not recorded as a table view (its offset is only the first lane's). The two table loads of an `s_cselect` choice are recorded, as a phi's are. - **vkd3d-proton (host device):** `victory-gpu` 51 passed and 1 failed, the environment failure `a_rejected_blob_gives_an_empty_library` that `main` has there too. - New tests: - **`table_views_record_srv_uav_structured_and_skip_dynamic`:** hand-assembled compute program; raw SRV, raw UAV and structured UAV recorded with their dwords, and a load with a dynamic `soffset` (from `v_readfirstlane`) not recorded. - **`table_views_prefer_uav_and_record_phi_arms`:** UAV wins in both orders; both arms of a branch are recorded. - **`null_desc_maps_buffer_and_texture_annotations`:** every buffer kind, every texture SRV and UAV dimension, the component-type formats, the CBV, and the unsupported kinds. - **`host_accepts_typed_null_descriptors_and_mirror_transitions`** (host-gated; ran on vkd3d-proton): the device takes every typed null. A mirrored slot goes from empty to typed null, then to another typed null, then to a real view once the title writes one. A slot past the heap is ignored. Device not removed. - Diagnostics (`5bab0e2`): each table line of the device-removed report ends with the shaders' annotation for that entry, or `[not annotated]`. - `shader_cache` round-trip includes `table_views`, and `VSH1` entries are rejected. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features` (as the CI runs it): clean. - rustfmt: no new diffs in the changed code (the touched files keep the diffs they have on `main`). `cargo xtask policy`: 151 files ok. ## Tested by others (thanks) - **AwkGrep256, with the title, Linux, RX 9070 XT (RADV), Wine 11.22 + vkd3d-proton 3.2.0, `main` `ffe310e` + #190 #454 #493 #579 + this PR** ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)): no regression on AMD. With `VICTORY_SHADER_LOOP_LIMIT=1000`, ~3.5 min in the world, then a GPUVM fault at `0x0` that also happens without this PR (after ~14 min), so it is not from it. Without a loop limit, a slow compute dispatch hangs earlier, also unrelated. - **Wasler, with the title, via Dufftwt** ([summary](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568), [source](https://git.gtahub.st/github/Marvisak--VIctory/issues/732)): without this PR (on `d2a4bae`, WARP), the device was removed in compute `269b802f878c24e1` with UAV slots without a view (the #508 signature). With it (`main` `ffe310e` + this PR, RTX 5060 Ti, debug layer and DRED on), that crash doesn't happen and the run continues ~2 min 47 s into the world load, stopping at a vertex buffer left in `UNORDERED_ACCESS` (#334). Not a strict A/B (adapter and base differ). - **DeerSilver, Windows 11, NVIDIA RTX 5060 Laptop (Blackwell), native D3D12, at `22e6676` on `main` `ffe310e`** ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)): first NVIDIA run. `cargo test --workspace --locked` 346 passed, 0 failed (`main`: 342, so +4, the new tests); the GPU-executed `valu_tests` and `waterfall_tests` pass (the `diff_tests` skip there: they need the console SDK's `dxc.exe`). The driver accepts every typed null SRV, UAV and CBV. Workspace clippy with `-D warnings`: clean. - **d1ll3x3, with the title, RX 7800 XT (RDNA3), Windows 11, `diag` + `VICTORY_D3D12_DRED=1`, `main@8e79c80` + this PR + #67 + #609 or #431** ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)): 4 runs into the first mission's intro (2 min 39 s to 11 min 39 s). **None of the device removals pointed at a null or typed-null slot**: all were page faults inside freed textures or a buffer, covered by #609 and #431. No regressions seen. One conflict with #609, in `describe_slot` (diagnostics only). - **zhien114514, with the title, Radeon 780M (RDNA3 iGPU, the #508 class), Windows 11, `diag`, `VICTORY_SHADER_LOOP_LIMIT=1000`, at `ad7b7ea`** ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)): `main` removed the device ~63 s into the world. With this PR: **no device removal, no ERROR lines, the world renders (0.3–0.9 fps), stopped by hand at 210 s.** One run each, with no debug layer on that machine, so no DRED. - **SAitken91, with the title, RX 6950 XT (RDNA2), Windows 11, `diag` + `VICTORY_D3D12_DRED=1`** ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)): one run reached ~78 s in the world (against ~3–4 s without), but a second run with this PR faulted after ~2 s, so timing is not conclusive yet ([correction](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)). The report's `[heap N: null]` entries could not show whether the typed nulls were placed. `5bab0e2` adds the annotation to each table line of the diagnostics report (`[annotated <kind> <more>]` / `[not annotated]`) so the next run can show it. - **Mesrine67, Windows 11, AMD RX 6750 XT, native D3D12, at `0845e8d`** ([comment](https://git.gtahub.st/github/Marvisak--VIctory/pulls/568)): both `table_views_*` tests, `null_desc_maps_buffer_and_texture_annotations`, and `host_accepts_typed_null_descriptors_and_mirror_transitions` all pass. The last ran on a real device (checked that it did not return early), and the device was not removed. Full suites: `victory-gpu --lib` 45 passed, 0 failed, 1 ignored; `victory-shader --lib` 71 passed, 0 failed, including the seven `valu_tests` that need an SM 6.6 device. ## Not run - The title, and any hardware GPU. The run-w10 note says untyped null buffer views alone did not stop the world's low-address faults. This change is narrower (the kind the shader annotates, SRV or UAV), and it removes a type mismatch the hardware does not have to survive, but whether #508's fault goes away is not proven. A `diag` run on the RDNA3 iGPU from #508 with `VICTORY_D3D12_DRED=1` would settle it: does the fault in `2dc602192abf6288` stop, or does it move? - Dynamically indexed descriptors, and slots no shader annotates, keep the old null 2D view. AI-assisted: implemented with Gemini 4 Neon, then reviewed, corrected and tested with Claude Code. Corrections: annotated slots that have a view are no longer made outside `readable`; the dynamic-offset test was fixed; the run-w10 note is kept. Every command above was really run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A descriptor slot the title never wrote a view we know into is a null
Texture2D SRV on the host: every host heap slot starts as one, and
fresh tables get one for an empty entry. The translated shaders index
the heap directly (SM 6.6), with the kind they expect in each handle's
annotation, so a shader that writes such a slot as a UAV, or reads it
as a buffer, uses a descriptor of the wrong type. That is undefined;
two UAV entries without a view.

The translator now records, for each descriptor it loads from a table
at a constant offset, the resource properties it annotates the handle
with (HostShader::table_views; UAV annotations win when one slot is
read both ways; dynamically indexed loads are not recorded). Where the
title has no view, the host makes a null descriptor of that kind: SRV
or UAV, typed, raw or structured buffer, or the texture dimension, so
writes are dropped and reads return zero. This covers fresh tables,
mirrored title slots (a later real descriptor still replaces the null)
and annotated slots past the used-resource entries. Slots no shader
annotates keep the null 2D view. The shader cache format is bumped
(VSH2, converter version 2) for the new field.

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The device-removed report's table lines describe the title's view at each
entry; the u<n> part describes only the first host slot of a table, and
not the copy a table made afresh is read from. So a report could not tell
whether an empty entry got a typed null (#568) or the plain null 2D view.
Each table line now ends with the shaders' annotation for that entry
([annotated <kind> <more>]) or [not annotated]: with no view, the first
means a null of that kind, the second the plain null.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rebased onto main ffe310e: a waterfall loop's load reads each lane's own
entry, so its first-lane offset is not recorded as a table view; both
table loads of an s_cselect choice are recorded, as a phi's are; the
test helper passes the structure to resource::track, and the waterfall
test's HostShader gets its table_views.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When HostHeap::mirror_slot mirrors a slot whose title record is a view
that the host cannot make (such as an explicit Texture1D SRV with a null
resource), a first mirror outside a draw (for_draw = false) or in an
unannotated draw (null_props = None) writes a null of the view's own
dimension (null_for) and records SlotState::View(key). A later draw
annotating a different kind (e.g. Texture2D) then sees the same
SlotState::View(key) and leaves the Texture1D null in place, causing a
descriptor type mismatch.

Track unmakeable view-backed slots separately as
SlotState::ViewNull(key, Option<(u32, u32)>), recording whether the slot
holds the view's own-dimension null (None) or a shader-annotated typed
null (Some(props)). On a later draw with a different annotation, write
the typed null (null_desc_for_props) and update the state; views the
host can make stay SlotState::View(key) and short-circuit without extra
writes. Update describe_slot (diagnostics) to show the null state on
ViewNull slots.

Traced by alladeen321123 on WARP (validation error 940).

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mirrored title descriptor slots in a shader-visible host heap are
rewritten in place by HostHeap::mirror_slot. When draw 1 annotates an
empty slot (or an unmakeable title view) with typed null kind A and a
later draw annotates the same slot with kind B, rewriting the slot in
place causes draw 1 (recorded earlier, not yet executed) to read kind B.

Add HostHeap::typed_null_conflict (backed by slot_typed_null_conflict)
to report when a mirrored slot already holds a TypedNull or ViewNull
typed null of a different kind than a draw's annotation while the title
record is still empty or still the same unmakeable view. In
State::tables, mark any root table slot with a conflicting annotated
entry (from used resources or stage table_views) as fresh so it receives
dynamic slots for that draw instead of rewriting the mirrored slot.

Slots in the default Null state, slots holding the same typed null, and
slots holding a real host view keep mirroring in place.

Raised by SamuelReeder in review.

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two cases still rewrote a mirrored typed null in place:

1. `typed_null_conflict` and the later `mirror_for_draw` took the
   `made` lock separately. Because command lists are recorded on
   several threads, two draws wanting different kinds for the same
   `Null` slot could both see no conflict and the second would rewrite
   the first's `TypedNull` in place.
2. An unannotated draw (`null_props = None`) or a non-draw mirror
   (`mirror(.., false)`) on an empty slot holding `TypedNull(_)` reset
   it to `Null` and wrote a default 2D null over it.

Make the refusal atomic under `made`: `mirror_slot_state` now returns
`SlotWrite::Refused` without changing state or writing when a draw
annotation would replace an existing `TypedNull(p)` (on an empty
record) or `ViewNull(key, Some(p))` (on the same key) with a different
kind. `HostHeap::mirror_for_draw` returns `Mirror::{Done, Refused}`,
keeping `HostHeap::mirror` unchanged for its callers.

In `State::tables`, remove the separate `typed_null_conflict` pre-check
(and `typed_null_conflict` / `slot_typed_null_conflict`), collect any
root table slots whose `table_entry` or `table_view_entry` mirror is
refused, and add them to `fresh` before building fresh dynamic tables.

In the empty-record branch of `mirror_slot_state`, leave `TypedNull(_)`
untouched with no write when no typed null descriptor is requested (as
`ViewNull` already does).

Raised by SamuelReeder in review.

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:08:39 +00:00
github-bot closed this pull request 2026-11-26 04:08:39 +00:00
Author
Owner

@⁠Mesrine67 on GitHub · 2026-11-24 05:18 UTC · original · edited 2026-11-24 05:27 UTC

Local validation on Windows 11 with an AMD Radeon RX 6750 XT (driver 32.0.21045.29003), against PR head 0845e8d580cbda52502c6b8ca522d5ab9d15ee26:

Focused tests:

  • cargo test --locked -p victory-shader table_views_ -- --nocapture --test-threads=1: 2 passed.
  • cargo test --locked -p victory-gpu null_desc_maps_buffer_and_texture_annotations -- --nocapture --test-threads=1: 1 passed.
  • cargo test --locked -p victory-gpu host_accepts_typed_null_descriptors_and_mirror_transitions -- --nocapture --test-threads=1: 1 passed on a created D3D12 device; the device-removed check passed in 0.15s. WARP and diagnostics environment flags were unset. A temporary local-only print confirmed the test did not return early for a missing device; I restored that instrumentation and the worktree is clean.

Full regression suites on the same head:

  • cargo test --locked -p victory-gpu --lib -- --test-threads=1: 45 passed, 1 ignored (benchmark), 0 failed.
  • cargo test --locked -p victory-shader --lib -- --test-threads=1: 71 passed, 0 failed.

Integration check:

  • cargo build --release --locked -p victory: passed.
  • Ran the resulting VIctory CLI with the title EXE as input but without --execute. It mapped the image, bound the title imports, reported 0 missing imports, and stopped at "not executing"; no title process started.
  • This is only a loader/preparation check. No title entry point/gameplay/rendering was executed.

The synthetic tests verify typed-null descriptor creation and mirror transitions on an RX 6750 XT. They do not establish that #508's page fault is fixed or that the title fault reported in #533 disappears. Full logs: E:\GTA_6\LOGS\VIctory_pr568_rx6750_tests_2026-11-24.log and E:\GTA_6\LOGS\VIctory_pr568_release_preflight_2026-11-24.log.

**@⁠Mesrine67** on GitHub · 2026-11-24 05:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7122821325) · edited 2026-11-24 05:27 UTC Local validation on Windows 11 with an AMD Radeon RX 6750 XT (driver 32.0.21045.29003), against PR head 0845e8d580cbda52502c6b8ca522d5ab9d15ee26: Focused tests: - cargo test --locked -p victory-shader table_views_ -- --nocapture --test-threads=1: 2 passed. - cargo test --locked -p victory-gpu null_desc_maps_buffer_and_texture_annotations -- --nocapture --test-threads=1: 1 passed. - cargo test --locked -p victory-gpu host_accepts_typed_null_descriptors_and_mirror_transitions -- --nocapture --test-threads=1: 1 passed on a created D3D12 device; the device-removed check passed in 0.15s. WARP and diagnostics environment flags were unset. A temporary local-only print confirmed the test did not return early for a missing device; I restored that instrumentation and the worktree is clean. Full regression suites on the same head: - cargo test --locked -p victory-gpu --lib -- --test-threads=1: 45 passed, 1 ignored (benchmark), 0 failed. - cargo test --locked -p victory-shader --lib -- --test-threads=1: 71 passed, 0 failed. Integration check: - cargo build --release --locked -p victory: passed. - Ran the resulting VIctory CLI with the title EXE as input but without --execute. It mapped the image, bound the title imports, reported 0 missing imports, and stopped at "not executing"; no title process started. - This is only a loader/preparation check. No title entry point/gameplay/rendering was executed. The synthetic tests verify typed-null descriptor creation and mirror transitions on an RX 6750 XT. They do not establish that #508's page fault is fixed or that the title fault reported in #533 disappears. Full logs: E:\GTA_6\LOGS\VIctory_pr568_rx6750_tests_2026-11-24.log and E:\GTA_6\LOGS\VIctory_pr568_release_preflight_2026-11-24.log.
Author
Owner

@⁠KoLolX3 on GitHub · 2026-11-24 05:34 UTC · original

Check on Linux, not Windows: pass. Head 0845e8d58 merged onto main d2a4bae1f (clean merge).

  • Native tests of the seven crates that build on Linux (core, formats, game, loader, pe, pipeline, shader): PR 94 passed, 7 failed, main 92 passed, 7 failed.
  • Windows cross type-check of the whole workspace (cargo xwin check --workspace --target x86_64-pc-windows-msvc, covers victory-gpu, victory-hle and the app): PR ok, main ok.
  • Tests this PR adds: 4, of which 2 ran in the native run (the pass count rose by 2); the other 2 are in code this run does not execute (cfg(windows) modules, the victory-gpu and victory-hle crates, or ignored tests), and were not run.
  • rustfmt: unformatted hunks, PR 167, main 168.
  • Failing on main here as well (not this PR): 7 tests in victory-loader and victory-pe that parse their own test binary as a PE image, which is an ELF file on Linux.
  • Not run: victory-gpu / victory-hle tests and the game itself.

On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.

**@⁠KoLolX3** on GitHub · 2026-11-24 05:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7123072422) Check on Linux, not Windows: **pass**. Head `0845e8d58` merged onto `main` `d2a4bae1f` (clean merge). - Native tests of the seven crates that build on Linux (`core`, `formats`, `game`, `loader`, `pe`, `pipeline`, `shader`): PR `94 passed, 7 failed`, `main` `92 passed, 7 failed`. - Windows cross type-check of the whole workspace (`cargo xwin check --workspace --target x86_64-pc-windows-msvc`, covers `victory-gpu`, `victory-hle` and the app): PR ok, `main` ok. - Tests this PR adds: 4, of which 2 ran in the native run (the pass count rose by 2); the other 2 are in code this run does not execute (`cfg(windows)` modules, the `victory-gpu` and `victory-hle` crates, or ignored tests), and were **not run**. - rustfmt: unformatted hunks, PR 167, `main` 168. - Failing on `main` here as well (not this PR): 7 tests in `victory-loader` and `victory-pe` that parse their own test binary as a PE image, which is an ELF file on Linux. - Not run: `victory-gpu` / `victory-hle` tests and the game itself. On: AMD Ryzen 7 5700, 62 GB RAM, Artix Linux 7.3.4-artix1-2, rustc 1.98.1 (the repo's pinned toolchain), cargo-xwin 0.24.1. No game data. Automated check only: the code itself was not reviewed.
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 06:38 UTC · original

Tested on an RX 6950 XT (RDNA2), Windows 11, diag build with VICTORY_D3D12_DRED=1, Series X profile, entering the first mission. Base: d2a4bae plus my open shader PRs (#539 #554 #563 #565 #569 #571 #592); one run each.

time in world before device removal lists submitted uav None in report
without #568 ~3 s / ~4 s (two runs) 115 / 152 11 / 8
with #568 ~78 s 470 3

All runs end in a page fault in the same low range (0x4808000, 0x481f000, 0x480e000), "no title memory copy below it", with every breadcrumb complete. With #568 the last command is an indirect mesh draw (indirect kind 10, mesh 8c0c0024c3c557dc + pixel cb4f0bf6d720abbc) that reads a root SRV descriptor (Srv s3+0: Descriptor). The 3 remaining uav None entries may be the State::table_entry path mentioned on #508. Happy to run another build on this card.

**@⁠SAitken91** on GitHub · 2026-11-24 06:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7124148033) Tested on an **RX 6950 XT (RDNA2)**, Windows 11, `diag` build with `VICTORY_D3D12_DRED=1`, Series X profile, entering the first mission. Base: `d2a4bae` plus my open shader PRs (#539 #554 #563 #565 #569 #571 #592); one run each. | | time in world before device removal | lists submitted | `uav None` in report | |---|---|---|---| | without #568 | ~3 s / ~4 s (two runs) | 115 / 152 | 11 / 8 | | with #568 | ~78 s | 470 | 3 | All runs end in a page fault in the same low range (`0x4808000`, `0x481f000`, `0x480e000`), "no title memory copy below it", with every breadcrumb complete. With #568 the last command is an indirect mesh draw (`indirect kind 10`, mesh `8c0c0024c3c557dc` + pixel `cb4f0bf6d720abbc`) that reads a root SRV descriptor (`Srv s3+0: Descriptor`). The 3 remaining `uav None` entries may be the `State::table_entry` path mentioned on #508. Happy to run another build on this card.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 06:41 UTC · original

Thank you, that's the first in-game result for this PR: from 3–4 s to ~78 s in the world on RDNA2.

On the 3 remaining uav None: in the diagnostics report that text comes from describe() in draw.rs. It means the title did write an unordered view there, but its resource is not a host texture (typically a buffer UAV, which describe does not detail). It is not an empty slot. Empty slots show elsewhere in the same report, in the u<n>=... [heap N: ...] part (describe_slot):

  • without this PR an empty slot reads null (the null 2D SRV), as in #508's u5=0x15ff7a0 [heap 720829: null];
  • with it, an annotated empty slot reads null (0x..., 0x...): the typed null and the annotation it was made for.

So those three entries probably aren't untyped nulls left behind. State::table_entry (the mirrored-table path mentioned on #508) is covered here as well, through mirror_for_draw. The slots this PR leaves as the plain null are dynamically indexed descriptors and slots no shader annotates. If your next report still has [heap N: null] (without a parenthesis) on a table the faulting pipeline reads, that would point at one of those.

The new last command, an indirect mesh draw (8c0c0024c3c557dc + cb4f0bf6d720abbc) reading a root SRV (Srv s3+0: Descriptor) with the fault in the same low range and "no title memory copy below it", looks like a different problem: a root descriptor whose address has no host copy. It may be worth its own issue, with the root3=... host ... part of the report: host None there would say the root SRV points outside every title buffer we know.

AI-assisted (Claude Code).

**@⁠BastienRodz** on GitHub · 2026-11-24 06:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7124199254) Thank you, that's the first in-game result for this PR: from 3–4 s to ~78 s in the world on RDNA2. On the 3 remaining `uav None`: in the diagnostics report that text comes from `describe()` in `draw.rs`. It means the title *did* write an unordered view there, but its resource is not a host texture (typically a buffer UAV, which `describe` does not detail). It is not an empty slot. Empty slots show elsewhere in the same report, in the `u<n>=... [heap N: ...]` part (`describe_slot`): - without this PR an empty slot reads `null` (the null 2D SRV), as in #508's `u5=0x15ff7a0 [heap 720829: null]`; - with it, an annotated empty slot reads `null (0x..., 0x...)`: the typed null and the annotation it was made for. So those three entries probably aren't untyped nulls left behind. `State::table_entry` (the mirrored-table path mentioned on #508) is covered here as well, through `mirror_for_draw`. The slots this PR leaves as the plain null are dynamically indexed descriptors and slots no shader annotates. If your next report still has `[heap N: null]` (without a parenthesis) on a table the faulting pipeline reads, that would point at one of those. The new last command, an indirect mesh draw (`8c0c0024c3c557dc` + `cb4f0bf6d720abbc`) reading a root SRV (`Srv s3+0: Descriptor`) with the fault in the same low range and "no title memory copy below it", looks like a different problem: a root descriptor whose address has no host copy. It may be worth its own issue, with the `root3=... host ...` part of the report: `host None` there would say the root SRV points outside every title buffer we know. AI-assisted (Claude Code).
Author
Owner

@⁠SAitken91 on GitHub · 2026-11-24 07:40 UTC · original

Thanks for the explanation. A correction and the data you asked about:

  • Correction: a second run of the same build (#568 applied, scripted input) faulted ~2 s into the world (0x43e4000, last command a 1x1x1 compute dispatch 9afd549c4f530901). So the ~78 s from the first run looks like variance, not a reliable improvement — I'll collect several runs per build before reading anything into timing.
  • Null slots: in both #568 runs the reports contain only plain [heap N: null] entries (308 and 55) and no typed null (0x…, 0x…) ones, including slots the faulting pipelines read (u8/u9 of 8c0c0024c3c557dc, u5 of 9afd549c4f530901). If annotated empty slots should print with the parenthesis, either all of these are dynamically indexed / unannotated, or the new path isn't reached in this build (#568 merged onto d2a4bae + my shader PRs; the only conflict was the test module in lower.rs).
  • Root SRV: in the 78 s run's report the mesh draw's root descriptor maps to a host copy (root3=0xb0bdaf000 host Some((0x5ac42f000, 0x251000))), so it does not look like an address outside every known buffer.
**@⁠SAitken91** on GitHub · 2026-11-24 07:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7125240890) Thanks for the explanation. A correction and the data you asked about: - **Correction:** a second run of the same build (#568 applied, scripted input) faulted ~2 s into the world (`0x43e4000`, last command a 1x1x1 compute dispatch `9afd549c4f530901`). So the ~78 s from the first run looks like variance, not a reliable improvement — I'll collect several runs per build before reading anything into timing. - **Null slots:** in both #568 runs the reports contain only plain `[heap N: null]` entries (308 and 55) and **no** typed `null (0x…, 0x…)` ones, including slots the faulting pipelines read (`u8`/`u9` of `8c0c0024c3c557dc`, `u5` of `9afd549c4f530901`). If annotated empty slots should print with the parenthesis, either all of these are dynamically indexed / unannotated, or the new path isn't reached in this build (#568 merged onto `d2a4bae` + my shader PRs; the only conflict was the test module in `lower.rs`). - **Root SRV:** in the 78 s run's report the mesh draw's root descriptor maps to a host copy (`root3=0xb0bdaf000 host Some((0x5ac42f000, 0x251000))`), so it does not look like an address outside every known buffer.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 07:43 UTC · original

Thanks for the second run and the correction. Agreed: one run each can't tell anything apart, so the ~78 s says nothing on its own.

On the missing null (…): I'm afraid my pointer was wrong. [heap N: …] describes only the first slot of each table (u<n> divided by 32). It does not describe the entries the shader reads at other offsets (s1+8, s1+16, …), nor the copy a table made afresh is read from. Any table holding a constant buffer is made afresh, and #568 writes its typed nulls into that copy. So plain null there doesn't show whether the new path ran.

To make it visible, 5bab0e2 adds to the diagnostics report's table lines: each line now ends with the annotation the shaders give that entry, [annotated <kind> <more>], or [not annotated]. For an entry with no view:

  • no view [annotated 0x100b 0x0]: a null raw-buffer UAV was placed (0x100b is raw buffer 0xb with the UAV bit 0x1000);
  • no view [not annotated]: it got the plain null 2D view (dynamically indexed, or not read at a constant offset).

uav None (a view whose resource is not a host texture) keeps its view either way.

If you run it again (several runs, as you say), the table lines of the faulting dispatch or draw would show which case the empty entries are. Thanks also for checking root3: it has a host copy, so that idea is out.

AI-assisted (Claude Code).

**@⁠BastienRodz** on GitHub · 2026-11-24 07:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7125294096) Thanks for the second run and the correction. Agreed: one run each can't tell anything apart, so the ~78 s says nothing on its own. On the missing `null (…)`: I'm afraid my pointer was wrong. `[heap N: …]` describes only the **first** slot of each table (`u<n>` divided by 32). It does not describe the entries the shader reads at other offsets (`s1+8`, `s1+16`, …), nor the copy a table made afresh is read from. Any table holding a constant buffer is made afresh, and #568 writes its typed nulls into that copy. So plain `null` there doesn't show whether the new path ran. To make it visible, `5bab0e2` adds to the diagnostics report's table lines: each line now ends with the annotation the shaders give that entry, `[annotated <kind> <more>]`, or `[not annotated]`. For an entry with no view: - `no view [annotated 0x100b 0x0]`: a null raw-buffer UAV was placed (`0x100b` is raw buffer `0xb` with the UAV bit `0x1000`); - `no view [not annotated]`: it got the plain null 2D view (dynamically indexed, or not read at a constant offset). `uav None` (a view whose resource is not a host texture) keeps its view either way. If you run it again (several runs, as you say), the table lines of the faulting dispatch or draw would show which case the empty entries are. Thanks also for checking `root3`: it has a host copy, so that idea is out. AI-assisted (Claude Code).
Author
Owner

@⁠zhien114514 on GitHub · 2026-11-24 08:44 UTC · original

Thanks — tested on the RDNA3 iGPU setup you asked for. The page fault is gone; the device is no longer removed. Details below.

Setup

CPU / GPU Ryzen 7 H 255 with Radeon 780M (RDNA3 iGPU, 4,096 MB UMA carve-out)
RAM / commit 27.8 GB; page file raised to 16 GB (max 40 GB) → commit limit 31.1 → 43.8 GB
OS / driver Windows 11 Insider build 26340; AMD 32.0.13046.2004
Build your branch gpu/typed-null-descriptors @ ad7b7ea4, cargo build --profile diag -p victory --features diagnostics
Env VICTORY_SHADER_LOOP_LIMIT=1000, --console series-x

Baseline (main, same machine, same settings)

Dies at ~63 s into the world load:

ERROR victory_gpu::host: host GPU device removed after a submission of 1 lists;
      no breadcrumbs (0x887A0004); device removed: … (0x887A0005)

Immediately before: 7.1 fps, 140.6 ms/frame, 492 draws/frame. No E_OUTOFMEMORY at all once the page file was raised.

With #568

main #568
device removed 1 (at 63 s) 0
ERROR lines 2 0
0x8007000E 0 0
survived 63 s 210 s (I stopped it, it had not failed)
world rendering no yes, 0.3–0.9 fps

Memory stayed at 12–17 GB private the whole time, so this is not the commit wall either.

What it looks like now

0.6 fps, 1699.8 ms/frame (790.3 preparing: copies 429.6 ms 79.0 MB,
      textures 34.2 ms 113.8 MB; 401.x on the GPU; …), N draws/frame

The frame time is dominated by the copy bridge and by shaders being translated on the fly — 341 pipelines were still "dropped without a host pipeline" during the run. GPU-side work is only ~300–450 ms.

Caveats

  • No D3D12 debug layer on this machine (0x887A002D), so no DRED and no breadcrumbs: I can show that the removal is gone, not that a specific named fault disappeared. Installing "Graphics Tools" failed here (Windows Update unreachable, DISM 12029 even through a proxy), so if you want a DRED run I'll do it once I can add the layer.
  • There are still shaders that do not translate at all on this title build, e.g.:
    WARN victory_gpu::pipeline: shader does not translate; its pipelines' draws are dropped
         stage="compute" hash=fc5e66f8f873d3bb error=converter shader.dxil v2: GFX…
    
    Unrelated to #508, but it is the next thing that eats draws on this machine.

Also confirmed (for #471)

Raising the page file from 1 GB/8 GB to 16 GB/40 GB removed the 0x8007000E cascade entirely (was 214 failures at ~9.6 GB private, now 0). #471's read of the problem holds.

Happy to run a DRED build on this adapter when the debug layer is available, and to re-run after your next revision.

**@⁠zhien114514** on GitHub · 2026-11-24 08:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7126508258) Thanks — tested on the RDNA3 iGPU setup you asked for. **The page fault is gone; the device is no longer removed.** Details below. ### Setup | | | |---|---| | CPU / GPU | Ryzen 7 H 255 with **Radeon 780M** (RDNA3 iGPU, 4,096 MB UMA carve-out) | | RAM / commit | 27.8 GB; page file raised to 16 GB (max 40 GB) → commit limit 31.1 → 43.8 GB | | OS / driver | Windows 11 Insider build 26340; AMD 32.0.13046.2004 | | Build | your branch `gpu/typed-null-descriptors` @ `ad7b7ea4`, `cargo build --profile diag -p victory --features diagnostics` | | Env | `VICTORY_SHADER_LOOP_LIMIT=1000`, `--console series-x` | ### Baseline (main, same machine, same settings) Dies at **~63 s** into the world load: ``` ERROR victory_gpu::host: host GPU device removed after a submission of 1 lists; no breadcrumbs (0x887A0004); device removed: … (0x887A0005) ``` Immediately before: `7.1 fps, 140.6 ms/frame, 492 draws/frame`. No `E_OUTOFMEMORY` at all once the page file was raised. ### With #568 | | main | #568 | |---|---|---| | `device removed` | 1 (at 63 s) | **0** | | `ERROR` lines | 2 | **0** | | `0x8007000E` | 0 | 0 | | survived | 63 s | **210 s (I stopped it, it had not failed)** | | world rendering | no | **yes, 0.3–0.9 fps** | Memory stayed at 12–17 GB private the whole time, so this is not the commit wall either. ### What it looks like now ``` 0.6 fps, 1699.8 ms/frame (790.3 preparing: copies 429.6 ms 79.0 MB, textures 34.2 ms 113.8 MB; 401.x on the GPU; …), N draws/frame ``` The frame time is dominated by the copy bridge and by shaders being translated on the fly — 341 pipelines were still "dropped without a host pipeline" during the run. GPU-side work is only ~300–450 ms. ### Caveats - **No D3D12 debug layer on this machine** (`0x887A002D`), so no DRED and no breadcrumbs: I can show that the removal is *gone*, not that a specific named fault disappeared. Installing "Graphics Tools" failed here (Windows Update unreachable, DISM 12029 even through a proxy), so if you want a DRED run I'll do it once I can add the layer. - There are still shaders that do not translate at all on this title build, e.g.: ``` WARN victory_gpu::pipeline: shader does not translate; its pipelines' draws are dropped stage="compute" hash=fc5e66f8f873d3bb error=converter shader.dxil v2: GFX… ``` Unrelated to #508, but it is the next thing that eats draws on this machine. ### Also confirmed (for #471) Raising the page file from 1 GB/8 GB to 16 GB/40 GB removed the `0x8007000E` cascade entirely (was 214 failures at ~9.6 GB private, now 0). #471's read of the problem holds. Happy to run a DRED build on this adapter when the debug layer is available, and to re-run after your next revision.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 08:46 UTC · original

Thank you, that's the setup this was for, and a clear before/after: on main the device is removed at ~63 s, with this PR it isn't removed at all over 210 s, and the world renders. I've added it to the description.

Two notes:

  • Variance: SAitken91's runs on RDNA2 showed how much timing can vary between runs of one build. If you get the chance, two or three more runs of each build would make this solid. A DRED run once the debug layer installs would also be welcome, to see whether a named fault remains anywhere.
  • The shader does not translate warning: converter shader.dxil v2 only names the shader cache's converter version (this PR bumps it to 2). The error after it is the translator refusing the program, which is unrelated to #508, as you say.

AI-assisted (Claude Code).

**@⁠BastienRodz** on GitHub · 2026-11-24 08:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7126545728) Thank you, that's the setup this was for, and a clear before/after: on `main` the device is removed at ~63 s, with this PR it isn't removed at all over 210 s, and the world renders. I've added it to the description. Two notes: - **Variance:** SAitken91's runs on RDNA2 showed how much timing can vary between runs of one build. If you get the chance, two or three more runs of each build would make this solid. A DRED run once the debug layer installs would also be welcome, to see whether a named fault remains anywhere. - **The `shader does not translate` warning:** `converter shader.dxil v2` only names the shader cache's converter version (this PR bumps it to 2). The error after it is the translator refusing the program, which is unrelated to #508, as you say. AI-assisted (Claude Code).
Author
Owner

@⁠d1ll3x3 on GitHub · 2026-11-24 09:49 UTC · original

checked: #568 on RDNA3 (you asked for one) | base: main@8e79c80 + #568 + #67, with either #609 or #431 | on: Windows 11, RX 7800 XT (RDNA3, 16 GB), 32 GB RAM, diag build, VICTORY_D3D12_DRED=1, Xbox Series 1.0.2.1

result: 4 runs into the first mission's intro cutscene (2 min 39 s to 11 min 39 s). None of the device removals pointed at a null or typed-null slot: every one was a page fault "inside freed" a texture (and once a title buffer), details on #609 and #431. #568 applies cleanly on #431; on #609 it has one conflict in describe_slot (diagnostics only). No regressions seen.

AI-assisted (Claude Code).

**@⁠d1ll3x3** on GitHub · 2026-11-24 09:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7127933939) checked: #568 on RDNA3 (you asked for one) | base: `main@8e79c80` + #568 + #67, with either #609 or #431 | on: Windows 11, RX 7800 XT (RDNA3, 16 GB), 32 GB RAM, diag build, `VICTORY_D3D12_DRED=1`, Xbox Series 1.0.2.1 result: 4 runs into the first mission's intro cutscene (2 min 39 s to 11 min 39 s). None of the device removals pointed at a null or typed-null slot: every one was a page fault "inside freed" a texture (and once a title buffer), details on #609 and #431. #568 applies cleanly on #431; on #609 it has one conflict in `describe_slot` (diagnostics only). No regressions seen. AI-assisted (Claude Code).
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 09:51 UTC · original

Thank you for the four runs. That's the result this PR needed on RDNA3: no device removal points at a null slot any more, and what's left is the freed-resource faults #609 and #431 deal with. Added to the description. On the describe_slot conflict with #609: whichever of the two lands second should keep both (#609's description, plus the null (kind, more) case for typed nulls). If #609 merges first, I'll rebase this on it.

AI-assisted (Claude Code).

**@⁠BastienRodz** on GitHub · 2026-11-24 09:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7127979413) Thank you for the four runs. That's the result this PR needed on RDNA3: no device removal points at a null slot any more, and what's left is the freed-resource faults #609 and #431 deal with. Added to the description. On the `describe_slot` conflict with #609: whichever of the two lands second should keep both (#609's description, plus the `null (kind, more)` case for typed nulls). If #609 merges first, I'll rebase this on it. AI-assisted (Claude Code).
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 10:25 UTC · original · edited 2026-11-24 10:30 UTC

Tested head 22e6676ca merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. This is the first run on NVIDIA and the first of the current head. No game files: the test suite only.

  • cargo test --workspace --locked: 346 passed, 0 failed, 6 ignored, against 342 passed / 6 ignored on main at the same commit. The difference is the PR's four new tests:
    • victory-gpu: null_desc_maps_buffer_and_texture_annotations and host_accepts_typed_null_descriptors_and_mirror_transitions.
    • victory-shader: table_views_record_srv_uav_structured_and_skip_dynamic and table_views_prefer_uav_and_record_phi_arms.
  • The GPU-executed shader suites valu_tests and waterfall_tests pass on this card with the PR. The four diff_tests skip here, since they need the console SDK's dxc.exe (VICTORY_CONSOLE_DXC).
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

host_accepts_typed_null_descriptors_and_mirror_transitions returns early (and reports ok) when no host GPU is found. Here it ran on the RTX 5060, which is DXGI adapter 0 on this laptop, so NVIDIA's driver accepted every typed null SRV, UAV and CBV the test creates. I couldn't add the D3D12 debug layer (Graphics Tools isn't installed here), so this shows the descriptors are accepted, not that the debug layer is silent on them.

I don't have the title, so I can't say anything about the in-world page fault on NVIDIA.

AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 10:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7128770167) · edited 2026-11-24 10:30 UTC Tested head `22e6676ca` merged onto `main` `ffe310e` (clean merge) on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. This is the first run on NVIDIA and the first of the current head. No game files: the test suite only. - `cargo test --workspace --locked`: **346 passed, 0 failed, 6 ignored**, against 342 passed / 6 ignored on `main` at the same commit. The difference is the PR's four new tests: - `victory-gpu`: `null_desc_maps_buffer_and_texture_annotations` and `host_accepts_typed_null_descriptors_and_mirror_transitions`. - `victory-shader`: `table_views_record_srv_uav_structured_and_skip_dynamic` and `table_views_prefer_uav_and_record_phi_arms`. - The GPU-executed shader suites `valu_tests` and `waterfall_tests` pass on this card with the PR. The four `diff_tests` skip here, since they need the console SDK's `dxc.exe` (`VICTORY_CONSOLE_DXC`). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. `host_accepts_typed_null_descriptors_and_mirror_transitions` returns early (and reports `ok`) when no host GPU is found. Here it ran on the RTX 5060, which is DXGI adapter 0 on this laptop, so NVIDIA's driver accepted every typed null SRV, UAV and CBV the test creates. I couldn't add the D3D12 debug layer (Graphics Tools isn't installed here), so this shows the descriptors are accepted, not that the debug layer is silent on them. I don't have the title, so I can't say anything about the in-world page fault on NVIDIA. AI-assisted (Claude Code).
Author
Owner

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

In-game result for this PR, from Wasler on #732 (their comment):

  • Earlier run, without this PR: build based on d2a4bae, on WARP. The device was removed in a compute dispatch whose table had UAV slots without a view (uav None, [heap 340872: null], compute 269b802f878c24e1), the same signature as #508.
  • New run, with this PR: current main (ffe310e) plus this PR, on an NVIDIA RTX 5060 Ti (Windows 11, diagnostics build, debug layer and DRED on). That crash doesn't happen, and the run continues about 2 min 47 s into the world load.
  • Where it stops now: a vertex buffer left in UNORDERED_ACCESS, which #334 addresses.

The two runs differ in adapter and base as well as in this PR, so this isn't a strict A/B. It's a positive in-game data point to add to #508's.

**@⁠Dufftwt** on GitHub · 2026-11-24 11:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7129973921) In-game result for this PR, from Wasler on #732 ([their comment](https://git.gtahub.st/github/Marvisak--VIctory/issues/732)): - **Earlier run, without this PR:** build based on `d2a4bae`, on WARP. The device was removed in a compute dispatch whose table had UAV slots without a view (`uav None`, `[heap 340872: null]`, compute `269b802f878c24e1`), the same signature as #508. - **New run, with this PR:** current `main` (`ffe310e`) plus this PR, on an NVIDIA RTX 5060 Ti (Windows 11, diagnostics build, debug layer and DRED on). That crash doesn't happen, and the run continues about 2 min 47 s into the world load. - **Where it stops now:** a vertex buffer left in `UNORDERED_ACCESS`, which #334 addresses. The two runs differ in adapter and base as well as in this PR, so this isn't a strict A/B. It's a positive in-game data point to add to #508's.
Author
Owner

@⁠AwkGrep256 on GitHub · 2026-11-24 12:05 UTC · original

Tested on AMD/Linux (RX 9070 XT, Mesa 26.3.1 RADV, Wine 11.22, vkd3d-proton 3.2.0), main ffe310e + #190 #454 #493 #579 + #568, Series X, VICTORY_NO_WATCHDOG=1.

Without a loop limit it hangs about 30 s into the world (ring gfx timeout, device removed). Compute 9ef9a9d818b27236 was created about 18 s before that, so it looks like the same 8.5 s dispatch Wasler hit. With VICTORY_SHADER_LOOP_LIMIT=1000 it gets past that and runs about 3.5 min in the world, then hits a GPUVM fault at address 0x0.

I had the same 0x0 fault without #568 (after about 14 min on main + the four PRs), so it isn't caused by #568, it just isn't fixed by it. Nothing else changed for the worse on AMD as far as I can see.

**@⁠AwkGrep256** on GitHub · 2026-11-24 12:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7130951588) Tested on AMD/Linux (RX 9070 XT, Mesa 26.3.1 RADV, Wine 11.22, vkd3d-proton 3.2.0), main `ffe310e` + #190 #454 #493 #579 + #568, Series X, `VICTORY_NO_WATCHDOG=1`. Without a loop limit it hangs about 30 s into the world (ring gfx timeout, device removed). Compute `9ef9a9d818b27236` was created about 18 s before that, so it looks like the same 8.5 s dispatch Wasler hit. With `VICTORY_SHADER_LOOP_LIMIT=1000` it gets past that and runs about 3.5 min in the world, then hits a GPUVM fault at address `0x0`. I had the same `0x0` fault without #568 (after about 14 min on main + the four PRs), so it isn't caused by #568, it just isn't fixed by it. Nothing else changed for the worse on AMD as far as I can see.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 12:15 UTC · original

Thanks for testing it on RADV. Two leads on what's left, both outside this PR:

  • The GPUVM fault at 0x0: when a shader reads a root CBV/SRV that the title didn't set, or whose address is in no title buffer's host copy, State::bind skips that root parameter (continue) and still runs the draw. An unbound root descriptor is undefined, in practice 0 or stale, so the shader reads at address 0. Does your log have a shader reads a root view the title did not set before the fault? I'm preparing a separate fix that binds a zero-filled buffer there instead, so such reads return zero. I'll post the branch here when it's tested, if you want to try it on your stack.
  • The ~8.5 s compute dispatch (9ef9a9d818b27236): a dispatch that runs until the timeout is usually a translated loop that never sees another workgroup's write, as in a spin-wait or a look-back scan. That's #725 (glc loads not marked globally coherent) and #724. Hiiva has both on https://github.com/Hiiva/VIctory/tree/hiiva/heap-uav-coherence, and stacking it might show whether that dispatch finishes.

AI-assisted (Claude Code).

**@⁠BastienRodz** on GitHub · 2026-11-24 12:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7131184086) Thanks for testing it on RADV. Two leads on what's left, both outside this PR: - **The GPUVM fault at `0x0`:** when a shader reads a root CBV/SRV that the title didn't set, or whose address is in no title buffer's host copy, `State::bind` skips that root parameter (`continue`) and still runs the draw. An unbound root descriptor is undefined, in practice 0 or stale, so the shader reads at address 0. Does your log have `a shader reads a root view the title did not set` before the fault? I'm preparing a separate fix that binds a zero-filled buffer there instead, so such reads return zero. I'll post the branch here when it's tested, if you want to try it on your stack. - **The ~8.5 s compute dispatch** (`9ef9a9d818b27236`): a dispatch that runs until the timeout is usually a translated loop that never sees another workgroup's write, as in a spin-wait or a look-back scan. That's #725 (`glc` loads not marked globally coherent) and #724. Hiiva has both on https://github.com/Hiiva/VIctory/tree/hiiva/heap-uav-coherence, and stacking it might show whether that dispatch finishes. AI-assisted (Claude Code).
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 12:26 UTC · original

@⁠AwkGrep256, the root-view fix I mentioned is ready to try: https://github.com/BastienRodz/VIctory/commits/gpu/unbound-root-view-reads-zeros (1920980, one commit on main ffe310e, draw.rs + host.rs).

When a shader reads a root CBV/SRV that the title didn't set, set to 0, or set to an address in no title buffer, State::bind now binds a 1 MiB zero buffer (made once, never written) instead of leaving the root parameter unbound. The draw still runs. It logs a shader reads a root view the title did not set or a root view outside title buffers reads zeros once each, so your log will also show whether this path is hit.

To stack it on your tree:

git fetch https://github.com/BastienRodz/VIctory gpu/unbound-root-view-reads-zeros
git cherry-pick ffe310e..FETCH_HEAD

Upstream CI's checks on windows-latest: pass (https://github.com/BastienRodz/VIctory/actions/runs/45393149843); its two tests (zero_buffer_is_aligned_sized_and_zeroed, unbound_or_unmapped_root_view_binds_zeros) also pass on vkd3d-proton. If the 0x0 fault goes away (or moves), that tells whether this was it. Since it isn't this PR's subject, I'll file it as its own change.

AI-assisted (Claude Code, Gemini).

**@⁠BastienRodz** on GitHub · 2026-11-24 12:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7131449706) @⁠AwkGrep256, the root-view fix I mentioned is ready to try: https://github.com/BastienRodz/VIctory/commits/gpu/unbound-root-view-reads-zeros (`1920980`, one commit on `main` `ffe310e`, `draw.rs` + `host.rs`). When a shader reads a root CBV/SRV that the title didn't set, set to 0, or set to an address in no title buffer, `State::bind` now binds a 1 MiB zero buffer (made once, never written) instead of leaving the root parameter unbound. The draw still runs. It logs `a shader reads a root view the title did not set` or `a root view outside title buffers reads zeros` once each, so your log will also show whether this path is hit. To stack it on your tree: ``` git fetch https://github.com/BastienRodz/VIctory gpu/unbound-root-view-reads-zeros git cherry-pick ffe310e..FETCH_HEAD ``` Upstream CI's checks on `windows-latest`: pass (https://github.com/BastienRodz/VIctory/actions/runs/45393149843); its two tests (`zero_buffer_is_aligned_sized_and_zeroed`, `unbound_or_unmapped_root_view_binds_zeros`) also pass on vkd3d-proton. If the `0x0` fault goes away (or moves), that tells whether this was it. Since it isn't this PR's subject, I'll file it as its own change. AI-assisted (Claude Code, Gemini).
Author
Owner

@⁠AwkGrep256 on GitHub · 2026-11-24 12:36 UTC · original

Thanks. I already tried the same idea locally: zeros when root_view finds no host copy, and the did not set warning is on main anyway. Neither ever fired before the 0x0 fault, and a warn in Heap::host() didn't fire either. So I don't think it's a root view, but I can run your branch once to confirm with your logging.

**@⁠AwkGrep256** on GitHub · 2026-11-24 12:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7131667382) Thanks. I already tried the same idea locally: zeros when `root_view` finds no host copy, and the `did not set` warning is on `main` anyway. Neither ever fired before the `0x0` fault, and a warn in `Heap::host()` didn't fire either. So I don't think it's a root view, but I can run your branch once to confirm with your logging.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 12:36 UTC · original

Thanks, that settles it: if neither path ever fired before the fault, it isn't a root view, and there's no need to run my branch for it. Sorry for the detour.

If vkd3d-proton's breadcrumbs (VKD3D_CONFIG=breadcrumbs) name the command that faults at 0x0, that would narrow it down: a draw, a dispatch, a copy, or the indirect execution, and which pipeline.

AI-assisted (Claude Code).

**@⁠BastienRodz** on GitHub · 2026-11-24 12:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7131677637) Thanks, that settles it: if neither path ever fired before the fault, it isn't a root view, and there's no need to run my branch for it. Sorry for the detour. If vkd3d-proton's breadcrumbs (`VKD3D_CONFIG=breadcrumbs`) name the command that faults at `0x0`, that would narrow it down: a draw, a dispatch, a copy, or the indirect execution, and which pipeline. AI-assisted (Claude Code).
Author
Owner

@⁠alladeen321123 on GitHub · 2026-11-24 17:17 UTC · original

On 22e6676, I traced a remaining GPU validation error on WARP to a mirrored title descriptor. At heap index 0 the title supplied an explicit Texture1D SRV for a null resource. HostHeap::mirror_slot ran with for_draw=false and null_props=None, and make returned None. The heap object matched the one named later by validation error 940: pixel shader 280967ad158cee0b read index 0 expecting Texture2D. This identifies where the 1D descriptor came from. Why the shader selected index 0, and whether this draw contributes to device removal, are still open.

**@⁠alladeen321123** on GitHub · 2026-11-24 17:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7138966105) On 22e6676, I traced a remaining GPU validation error on WARP to a mirrored title descriptor. At heap index 0 the title supplied an explicit Texture1D SRV for a null resource. HostHeap::mirror_slot ran with for_draw=false and null_props=None, and make returned None. The heap object matched the one named later by validation error 940: pixel shader 280967ad158cee0b read index 0 expecting Texture2D. This identifies where the 1D descriptor came from. Why the shader selected index 0, and whether this draw contributes to device removal, are still open.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 17:34 UTC · original

@⁠SamuelReeder Nothing rules it out. A mirrored slot is rewritten in place, so an earlier draw that hasn't run yet reads the later kind. A shared empty slot (index 0, say) read as a Texture2D by one shader and as a buffer by another is a realistic case. 4b4d504 (alladeen321123's report above: a title view the host can't make now takes the typed null a later draw annotates) has the same weakness. I'll take your fix: when a table's empty or unmakeable slot already holds a typed null of another kind, that table gets fresh dynamic slots for the draw instead of a rewrite. The first kind stays in place for the draws that wanted it.

**@⁠BastienRodz** on GitHub · 2026-11-24 17:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7139399464) @⁠SamuelReeder Nothing rules it out. A mirrored slot is rewritten in place, so an earlier draw that hasn't run yet reads the later kind. A shared empty slot (index 0, say) read as a Texture2D by one shader and as a buffer by another is a realistic case. `4b4d504` (alladeen321123's report above: a title view the host can't make now takes the typed null a later draw annotates) has the same weakness. I'll take your fix: when a table's empty or unmakeable slot already holds a typed null of another kind, that table gets fresh dynamic slots for the draw instead of a rewrite. The first kind stays in place for the draws that wanted it.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 17:45 UTC · original

Both are on the branch now. 4b4d504: a title view the host can't make takes the typed null a later draw annotates (@⁠alladeen321123's Texture1D at index 0). cd6d559: a table whose empty or unmakeable slot already holds another kind's typed null is made afresh in dynamic slots instead of being rewritten (@⁠SamuelReeder's point). The upstream CI's commands pass on windows-latest at cd6d559, victory-gpu 54 passed, 0 failed: https://github.com/BastienRodz/VIctory/actions/runs/45451643358

**@⁠BastienRodz** on GitHub · 2026-11-24 17:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7139668732) Both are on the branch now. `4b4d504`: a title view the host can't make takes the typed null a later draw annotates (@⁠alladeen321123's Texture1D at index 0). `cd6d559`: a table whose empty or unmakeable slot already holds another kind's typed null is made afresh in dynamic slots instead of being rewritten (@⁠SamuelReeder's point). The upstream CI's commands pass on `windows-latest` at `cd6d559`, `victory-gpu` 54 passed, 0 failed: https://github.com/BastienRodz/VIctory/actions/runs/45451643358
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 18:24 UTC · original

@⁠SamuelReeder Both are right. I'll make mirror_for_draw refuse under its own lock when it would turn one typed null into another, with the caller sending that table to fresh slots on refusal. That replaces the separate pre-check, so the race is gone. An unannotated draw, and a title copy or write mirroring an empty record, will leave an existing TypedNull alone.

**@⁠BastienRodz** on GitHub · 2026-11-24 18:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7140611076) @⁠SamuelReeder Both are right. I'll make `mirror_for_draw` refuse under its own lock when it would turn one typed null into another, with the caller sending that table to fresh slots on refusal. That replaces the separate pre-check, so the race is gone. An unannotated draw, and a title copy or write mirroring an empty record, will leave an existing `TypedNull` alone.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 18:38 UTC · original

@⁠SamuelReeder Done in b2a6bd2. mirror_for_draw now returns Mirror::Refused under the made lock when it would change a typed null's kind (empty slot or the same unmakeable view). State::tables adds that table to the fresh ones, and the separate pre-check is gone. An empty slot holding TypedNull is left alone by unannotated draws and by mirror(.., false). On windows-latest with the upstream CI's commands, victory-gpu 54 passed, 0 failed: https://github.com/BastienRodz/VIctory/actions/runs/45461216241

**@⁠BastienRodz** on GitHub · 2026-11-24 18:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7140926018) @⁠SamuelReeder Done in `b2a6bd2`. `mirror_for_draw` now returns `Mirror::Refused` under the `made` lock when it would change a typed null's kind (empty slot or the same unmakeable view). `State::tables` adds that table to the fresh ones, and the separate pre-check is gone. An empty slot holding `TypedNull` is left alone by unannotated draws and by `mirror(.., false)`. On `windows-latest` with the upstream CI's commands, `victory-gpu` 54 passed, 0 failed: https://github.com/BastienRodz/VIctory/actions/runs/45461216241
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 21:42 UTC · original

Closing: main has taken another route for the same faults. d71c388 guards buffer reads through slots holding texture views, and 683ad7a reads table constants in place, so tables no longer go through dynamic slots. That is the mechanism this PR's typed nulls and conflict handling relied on. Rebasing would mean rewriting most of it onto a design the maintainer has already replaced. Thanks to alladeen321123, SamuelReeder and the testers for the traces and reviews. If a typed-null case still shows up on current main (a UAV or a dimension mismatch the guard doesn't cover), I'll file it on its own.

**@⁠BastienRodz** on GitHub · 2026-11-24 21:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/568#issuecomment-7145292591) Closing: `main` has taken another route for the same faults. `d71c388` guards buffer reads through slots holding texture views, and `683ad7a` reads table constants in place, so tables no longer go through dynamic slots. That is the mechanism this PR's typed nulls and conflict handling relied on. Rebasing would mean rewriting most of it onto a design the maintainer has already replaced. Thanks to alladeen321123, SamuelReeder and the testers for the traces and reviews. If a typed-null case still shows up on current `main` (a UAV or a dimension mismatch the guard doesn't cover), I'll file it on its own.

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