WARP: a constant buffer read through the title's null SRV at heap slot 0 removes the device (CBV handle over an SRV descriptor) #1595

Open
opened 2026-11-26 04:37:39 +00:00 by github-bot · 2 comments
Owner

@⁠ThomasSAMP on GitHub · 2026-11-24 19:39 UTC · original

Split out of #653 (comment, point 2), as suggested there.

What happens

On WARP, with #568 and #334 applied (they remove #653's first removal), world loading ends with 0x887A0005 after a submission of one list of compute dispatches. GPU-based validation (VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1) reports one message just before:

GPU-BASED VALIDATION: Dispatch, Descriptor type doesn't match shader register type:
Descriptor Heap Index: [0], Descriptor Type in Heap: D3D12_DESCRIPTOR_RANGE_TYPE_SRV,
Register Type: D3D12_DESCRIPTOR_RANGE_TYPE_CBV, Shader Stage: COMPUTE,
Pipeline State: '[compute 0e45e59e93b736e4]'

Why

In the DXIL that ffe310e emits for that program:

  1. it loads a dword from a raw buffer (rawBufferLoad through a heap ByteAddressBuffer);
  2. it uses that dword as a descriptor heap index (createHandleFromHeap(i32 %idx)), annotated as a constant buffer ({13, 65536});
  3. it reads it with cbufferLoadLegacy, unconditionally. A compare of the index with 0 (icmp ne) is computed, but nothing branches on it before the load.

At run time the index is 0. Heap slot 0 holds the title's null SRV: the device-removed report shows [heap 0: Shader(0, Some([42, 2, 5768, ...])) -> null], a view of no resource.

  • On the console the program does the same, and it's harmless: a constant-buffer read through a null descriptor reads zeros.
  • On D3D12, a CBV handle over an SRV descriptor is undefined behaviour.
    • WARP removes the device.
    • The RX 9070 XT gets past it in the same stack: it runs 8 minutes, into the world, before the #1317 hang. AMD probably reads the descriptor as a buffer, like the console. Other drivers may not.

#568 doesn't cover this: it fills table slots the title left empty with a typed null, but slot 0 here was written by the title, as an SRV.

Possible directions (not tried)

  • Translator. Read a constant buffer whose descriptor comes from a computed heap index as a raw buffer load (ByteAddressBuffer) instead of a CBuffer handle. That would match the SRV kind the title's heap mostly holds. It still mismatches if a slot holds a typed or structured view.
  • Translator. Guard the read on the index being non-zero. That only fits if slot 0 is the title's null descriptor by convention, which this one case doesn't prove.
  • Runtime. For a slot holding a view of no resource, choose the null descriptor's type from how shaders read it. That only works if no other shader reads the same slot as another kind, and here slot 0 is also read as an SRV.

Setup

Windows 11 Pro (build 26300), AMD Radeon RX 9070 XT (driver 32.0.32029.2010) and WARP, diagnostics build of ffe310e + #568 (cd6d559) + #334 (c99e429), own retail 1.0.2.1, Series X mode. Seen once with the debug layer alone (removal after 5 min 55) and once with GBV (removal after about 7 min, with the message above).

AI-assisted (Claude Code, Claude Opus 5.5); no game data (a shader hash and DXIL op names only).

**@⁠ThomasSAMP** on GitHub · 2026-11-24 19:39 UTC · [original](https://github.com/Marvisak/VIctory/issues/1595) Split out of #653 ([comment](https://git.gtahub.st/github/Marvisak--VIctory/issues/653), point 2), as suggested there. ## What happens On WARP, with #568 and #334 applied (they remove #653's first removal), world loading ends with `0x887A0005` after a submission of one list of compute dispatches. GPU-based validation (`VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1`) reports one message just before: ``` GPU-BASED VALIDATION: Dispatch, Descriptor type doesn't match shader register type: Descriptor Heap Index: [0], Descriptor Type in Heap: D3D12_DESCRIPTOR_RANGE_TYPE_SRV, Register Type: D3D12_DESCRIPTOR_RANGE_TYPE_CBV, Shader Stage: COMPUTE, Pipeline State: '[compute 0e45e59e93b736e4]' ``` ## Why In the DXIL that `ffe310e` emits for that program: 1. it loads a dword from a raw buffer (`rawBufferLoad` through a heap `ByteAddressBuffer`); 2. it uses that dword as a descriptor heap index (`createHandleFromHeap(i32 %idx)`), annotated as a constant buffer (`{13, 65536}`); 3. it reads it with `cbufferLoadLegacy`, unconditionally. A compare of the index with 0 (`icmp ne`) is computed, but nothing branches on it before the load. At run time the index is 0. Heap slot 0 holds the title's null SRV: the device-removed report shows `[heap 0: Shader(0, Some([42, 2, 5768, ...])) -> null]`, a view of no resource. - **On the console** the program does the same, and it's harmless: a constant-buffer read through a null descriptor reads zeros. - **On D3D12**, a CBV handle over an SRV descriptor is undefined behaviour. - WARP removes the device. - The RX 9070 XT gets past it in the same stack: it runs 8 minutes, into the world, before the #1317 hang. AMD probably reads the descriptor as a buffer, like the console. Other drivers may not. #568 doesn't cover this: it fills table slots the title left empty with a typed null, but slot 0 here was written by the title, as an SRV. ## Possible directions (not tried) - **Translator.** Read a constant buffer whose descriptor comes from a computed heap index as a raw buffer load (`ByteAddressBuffer`) instead of a `CBuffer` handle. That would match the SRV kind the title's heap mostly holds. It still mismatches if a slot holds a typed or structured view. - **Translator.** Guard the read on the index being non-zero. That only fits if slot 0 is the title's null descriptor by convention, which this one case doesn't prove. - **Runtime.** For a slot holding a view of no resource, choose the null descriptor's type from how shaders read it. That only works if no other shader reads the same slot as another kind, and here slot 0 is also read as an SRV. ## Setup Windows 11 Pro (build 26300), AMD Radeon RX 9070 XT (driver 32.0.32029.2010) and WARP, diagnostics build of `ffe310e` + #568 (`cd6d559`) + #334 (`c99e429`), own retail 1.0.2.1, Series X mode. Seen once with the debug layer alone (removal after 5 min 55) and once with GBV (removal after about 7 min, with the message above). AI-assisted (Claude Code, Claude Opus 5.5); no game data (a shader hash and DXIL op names only).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:39 +00:00
Author
Owner

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

From #568's side: right, this is outside it, and #568 can't be stretched to cover it. Its typed nulls rely on two things a computed heap index doesn't have:

  • an annotation recorded at translation time, which a dynamically indexed load doesn't get (#568's shortcut: note);
  • a table to remake in fresh dynamic slots when one slot is read as two kinds. A createHandleFromHeap with a computed index reads the heap directly, so there is no table to swap.

Slot 0 here is read both as an SRV and as a CBV, so no single descriptor in that slot can be valid for both readers. That leaves your translator directions: the read itself has to stop going through a CBV handle (or not happen) when the index points at a non-CBV slot.

**@⁠BastienRodz** on GitHub · 2026-11-24 19:40 UTC · [original](https://github.com/Marvisak/VIctory/issues/1595#issuecomment-7142419309) From #568's side: right, this is outside it, and #568 can't be stretched to cover it. Its typed nulls rely on two things a computed heap index doesn't have: - an annotation recorded at translation time, which a dynamically indexed load doesn't get (#568's `shortcut:` note); - a table to remake in fresh dynamic slots when one slot is read as two kinds. A `createHandleFromHeap` with a computed index reads the heap directly, so there is no table to swap. Slot 0 here is read both as an SRV and as a CBV, so no single descriptor in that slot can be valid for both readers. That leaves your translator directions: the read itself has to stop going through a CBV handle (or not happen) when the index points at a non-CBV slot.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 12:47 UTC · original

Automated triage for the maintainers.

The path is still in main (940d32f): in crates/victory-shader/src/emit/lower.rs, Lower::smem, a scalar buffer load is read as a raw buffer only for heap-direct constants, table entries listed as CBVs, SRVs and root UAVs; any other descriptor (such as a table slot with no used-resource entry, as here) falls through to a constant-buffer handle (13, 0x1_0000) read with cbufferLoadLegacy, unguarded. When that slot holds the title's null SRV, D3D12 sees a CBV handle over an SRV descriptor, which WARP turns into a device removal.

Open PR #2068 addresses this (unlisted table constant loads lowered as guarded raw SRVs).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 12:47 UTC · [original](https://github.com/Marvisak/VIctory/issues/1595#issuecomment-7162864611) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-24T19:40:01Z at=2026-11-25T12:47:29Z --> Automated triage for the maintainers. The path is still in `main` (`940d32f`): in `crates/victory-shader/src/emit/lower.rs`, `Lower::smem`, a scalar buffer load is read as a raw buffer only for heap-direct constants, table entries listed as CBVs, SRVs and root UAVs; any other descriptor (such as a table slot with no used-resource entry, as here) falls through to a constant-buffer handle `(13, 0x1_0000)` read with `cbufferLoadLegacy`, unguarded. When that slot holds the title's null SRV, D3D12 sees a CBV handle over an SRV descriptor, which WARP turns into a device removal. Open PR #2068 addresses this (unlisted table constant loads lowered as guarded raw SRVs). --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#1595
No description provided.