GPU: translate enhanced texture barriers in ID3D12GraphicsCommandList7::Barrier #642

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

@⁠nathanbzrr on GitHub · 2026-11-24 06:06 UTC · original
nathanbzrr:gpu/enhanced-texture-barriers → main · +1286 −19 · 1 files · 1 commits · open

Summary

On Windows/D3D12.X titles using ID3D12GraphicsCommandList7::Barrier (command list vtable slot 146 / 0x490), barrier_groups on main ignores the groups pointer and emits only a single global UAV_BARRIER. While legacy ResourceBarrier translates texture transitions through HostList::transition, Enhanced Barriers currently drop all texture layout transitions, leaving host render targets, depth/Hi-Z buffers, and copy targets un-transitioned or compressed when read via SM 6.6 ResourceDescriptorHeap direct indexing, causing D3D12 debug layer errors and breaking cross-list state tracking in HostList::prelude.

Changes (crates/victory-gpu/src/list.rs)

  • Add #[repr(C)] BarrierGroup (16 bytes) and TextureBarrier (64 bytes) matching D3D12 D3D12_BARRIER_GROUP and D3D12_TEXTURE_BARRIER, guarded by compile-time size_of! and offset_of! assertions on Windows.
  • Add enhanced_layout_state(layout: u32) -> Option<u32> mapping D3D12_BARRIER_LAYOUT values (common/present/queue-specific, generic read, render target, unordered access, depth-stencil write/read, shader resource, copy source/dest, resolve source/dest, shading rate source) to legacy D3D12_RESOURCE_STATES, returning None for UNDEFINED (u32::MAX) and unsupported layouts.
  • Implement barrier_groups to:
    • Translate D3D12_BARRIER_TYPE_TEXTURE (kind == 1) barriers via list.transition + crate::host::legal_state into legacy D3D12_RESOURCE_BARRIER transitions.
    • Skip split-begin barriers (SyncAfter == D3D12_BARRIER_SYNC_SPLIT) and execute transitions on split-end.
    • Flush accumulated transitions before emitting a second transition targeting the same host texture in a single Barrier() call to avoid RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS.
    • Emit global UAV ordering for global/buffer groups (kind == 0 | 2) and UAV-access texture barriers.

Verification

Isolated verification on branch gpu/enhanced-texture-barriers (bf4ad1d):

  • rustfmt --edition 2024 --config skip_children=true --check crates/victory-gpu/src/list.rs (passed)
  • cargo test -p victory-gpu -- --test-threads=1 (45 passed, 0 failed, 1 ignored; includes enhanced_layout_mapping_and_abi and enhanced_texture_barrier_transitions_and_propagates_across_lists)
  • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1 (47 passed, 0 failed, 1 ignored; zero D3D12 debug layer errors)
  • cargo clippy -p victory-gpu --all-targets (0 warnings in list.rs; 1 pre-existing warning at host.rs:267)
  • cargo xtask policy (151 files ok)

No game files. AI-assisted; reviewed and verified with the tests above.

**@⁠nathanbzrr** on GitHub · 2026-11-24 06:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/642) `nathanbzrr:gpu/enhanced-texture-barriers` → `main` · +1286 −19 · 1 files · 1 commits · open ## Summary On Windows/D3D12.X titles using `ID3D12GraphicsCommandList7::Barrier` (command list vtable slot 146 / `0x490`), `barrier_groups` on `main` ignores the `groups` pointer and emits only a single global `UAV_BARRIER`. While legacy `ResourceBarrier` translates texture transitions through `HostList::transition`, Enhanced Barriers currently drop all texture layout transitions, leaving host render targets, depth/Hi-Z buffers, and copy targets un-transitioned or compressed when read via SM 6.6 `ResourceDescriptorHeap` direct indexing, causing D3D12 debug layer errors and breaking cross-list state tracking in `HostList::prelude`. ### Changes (`crates/victory-gpu/src/list.rs`) - Add `#[repr(C)]` `BarrierGroup` (16 bytes) and `TextureBarrier` (64 bytes) matching D3D12 `D3D12_BARRIER_GROUP` and `D3D12_TEXTURE_BARRIER`, guarded by compile-time `size_of!` and `offset_of!` assertions on Windows. - Add `enhanced_layout_state(layout: u32) -> Option<u32>` mapping `D3D12_BARRIER_LAYOUT` values (common/present/queue-specific, generic read, render target, unordered access, depth-stencil write/read, shader resource, copy source/dest, resolve source/dest, shading rate source) to legacy `D3D12_RESOURCE_STATES`, returning `None` for `UNDEFINED` (`u32::MAX`) and unsupported layouts. - Implement `barrier_groups` to: - Translate `D3D12_BARRIER_TYPE_TEXTURE` (`kind == 1`) barriers via `list.transition` + `crate::host::legal_state` into legacy `D3D12_RESOURCE_BARRIER` transitions. - Skip split-begin barriers (`SyncAfter == D3D12_BARRIER_SYNC_SPLIT`) and execute transitions on split-end. - Flush accumulated transitions before emitting a second transition targeting the same host texture in a single `Barrier()` call to avoid `RESOURCE_BARRIER_DUPLICATE_SUBRESOURCE_TRANSITIONS`. - Emit global UAV ordering for global/buffer groups (`kind == 0 | 2`) and UAV-access texture barriers. ## Verification Isolated verification on branch `gpu/enhanced-texture-barriers` (`bf4ad1d`): - `rustfmt --edition 2024 --config skip_children=true --check crates/victory-gpu/src/list.rs` (passed) - `cargo test -p victory-gpu -- --test-threads=1` (45 passed, 0 failed, 1 ignored; includes `enhanced_layout_mapping_and_abi` and `enhanced_texture_barrier_transitions_and_propagates_across_lists`) - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1` (47 passed, 0 failed, 1 ignored; zero D3D12 debug layer errors) - `cargo clippy -p victory-gpu --all-targets` (0 warnings in `list.rs`; 1 pre-existing warning at `host.rs:267`) - `cargo xtask policy` (151 files ok) No game files. AI-assisted; reviewed and verified with the tests above.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:11:12 +00:00
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 06:32 UTC · original

I added a synthetic two-mip texture to check the range passed to the normal enhanced-barrier path. At bf4ad1d, an enhanced transition targeting flat subresource 1 puts mip 0 in COPY_SOURCE as well. On both RTX 5090 and WARP, the debug layer rejected a subsequent mip 0 render-target clear during recording. The failing list was stopped before submission.

I tried the change on a stack of this head and #594 (3070871), using its existing per-subresource tracker. On both adapters, the flat index and a one-mip explicit range each let mip 1 read back its yellow value and mip 0 read back its independently cleared green value. The D3D12 debug layer reported zero errors, and the diagnostics suite passed 48 tests with one benchmark ignored per adapter. These readbacks cover a 2D single-plane texture.

Incremental source change on the two-head stack

**@⁠fuzeofficlal** on GitHub · 2026-11-24 06:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7124031313) I added a synthetic two-mip texture to check the range passed to the normal enhanced-barrier path. At `bf4ad1d`, an enhanced transition targeting flat subresource 1 puts mip 0 in `COPY_SOURCE` as well. On both RTX 5090 and WARP, the debug layer rejected a subsequent mip 0 render-target clear during recording. The failing list was stopped before submission. I tried the change on a stack of this head and #594 (`3070871`), using its existing per-subresource tracker. On both adapters, the flat index and a one-mip explicit range each let mip 1 read back its yellow value and mip 0 read back its independently cleared green value. The D3D12 debug layer reported zero errors, and the diagnostics suite passed 48 tests with one benchmark ignored per adapter. These readbacks cover a 2D single-plane texture. [Incremental source change on the two-head stack](https://github.com/fuzeofficlal/VIctory/compare/12228c07d5e8319e96da0cfbc85ab14ce1167ec4...fc4a871b3191542f60f43b1c08f26682f9e362bd)
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-24 06:34 UTC · original

Thanks @⁠LAKSHYA-cmd-tech for catching the 0.5 * 255.0 = 127.5 float-to-UNORM rounding variance!

Updated the clear values in enhanced_texture_barrier_transitions_and_propagates_across_lists (commit 6b98706) to exact n / 255.0 UNORM values so the channel conversions land on exact integers across all GPU drivers.

Re-verified on branch gpu/enhanced-texture-barriers:

  • cargo test -p victory-gpu -- --test-threads=1 (45 passed, 0 failed, 1 ignored)
  • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1 (47 passed, 0 failed, 1 ignored)
  • cargo clippy -p victory-gpu --all-targets (0 warnings in list.rs)
  • cargo xtask policy (151 files ok)
**@⁠nathanbzrr** on GitHub · 2026-11-24 06:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7124071778) Thanks @⁠LAKSHYA-cmd-tech for catching the `0.5 * 255.0 = 127.5` float-to-UNORM rounding variance! Updated the clear values in `enhanced_texture_barrier_transitions_and_propagates_across_lists` (commit `6b98706`) to exact `n / 255.0` UNORM values so the channel conversions land on exact integers across all GPU drivers. Re-verified on branch `gpu/enhanced-texture-barriers`: - `cargo test -p victory-gpu -- --test-threads=1` (45 passed, 0 failed, 1 ignored) - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1` (47 passed, 0 failed, 1 ignored) - `cargo clippy -p victory-gpu --all-targets` (0 warnings in `list.rs`) - `cargo xtask policy` (151 files ok)
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-24 06:49 UTC · original

Thanks @⁠fuzeofficlal for testing the two-mip subresource case and verifying the #594 + #642 stack on RTX 5090 and WARP!

Confirmed: #642 intentionally targets main's whole-resource HostList::transition (matching legacy host_barrier at crates/victory-gpu/src/list.rs:305) so it stays decoupled from and doesn't collide with #594's per-subresource tracker. Once #594 lands, wiring b.subresources (flat subresource index and explicit mip/slice/plane ranges) onto #594's per-subresource tracker is the natural follow-up.

Also note that commit 6b98706 (already pushed to gpu/enhanced-texture-barriers) updated the clear colors in enhanced_texture_barrier_transitions_and_propagates_across_lists to exact n / 255.0 UNORM values to avoid 0.5 * 255.0 = 127.5 driver rounding variance.

**@⁠nathanbzrr** on GitHub · 2026-11-24 06:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7124321733) Thanks @⁠fuzeofficlal for testing the two-mip subresource case and verifying the `#594` + `#642` stack on RTX 5090 and WARP! Confirmed: `#642` intentionally targets `main`'s whole-resource `HostList::transition` (matching legacy `host_barrier` at `crates/victory-gpu/src/list.rs:305`) so it stays decoupled from and doesn't collide with `#594`'s per-subresource tracker. Once `#594` lands, wiring `b.subresources` (flat subresource index and explicit mip/slice/plane ranges) onto `#594`'s per-subresource tracker is the natural follow-up. Also note that commit `6b98706` (already pushed to `gpu/enhanced-texture-barriers`) updated the clear colors in `enhanced_texture_barrier_transitions_and_propagates_across_lists` to exact `n / 255.0` UNORM values to avoid `0.5 * 255.0 = 127.5` driver rounding variance.
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 10:36 UTC · original

Tested the current head 6b987062d (with the exact n / 255.0 clear values) merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: pass. No game files: the test suite only.

  • The PR's two tests pass:
    • enhanced_layout_mapping_and_abi
    • enhanced_texture_barrier_transitions_and_propagates_across_lists
  • enhanced_texture_barrier_transitions_and_propagates_across_lists returns early without a host GPU. Here it ran on the RTX 5060 (DXGI adapter 0 on this laptop), so the cross-list transitions and the exact cleared channels hold on NVIDIA at this head.
  • cargo test --workspace --locked: 344 passed, 0 failed, 6 ignored, against 342 / 6 on main at the same commit.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

I didn't repeat @⁠fuzeofficlal's two-mip subresource check: the D3D12 debug layer isn't installed here. This run covers the whole-resource path the PR targets.

AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 10:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7129004504) Tested the current head `6b987062d` (with the exact `n / 255.0` clear values) merged onto `main` `ffe310e` (clean merge) on **NVIDIA GeForce RTX 5060 Laptop GPU** (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1: **pass.** No game files: the test suite only. - The PR's two tests pass: - `enhanced_layout_mapping_and_abi` - `enhanced_texture_barrier_transitions_and_propagates_across_lists` - `enhanced_texture_barrier_transitions_and_propagates_across_lists` returns early without a host GPU. Here it ran on the RTX 5060 (DXGI adapter 0 on this laptop), so the cross-list transitions and the exact cleared channels hold on NVIDIA at this head. - `cargo test --workspace --locked`: **344 passed, 0 failed, 6 ignored**, against 342 / 6 on `main` at the same commit. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. I didn't repeat @⁠fuzeofficlal's two-mip subresource check: the D3D12 debug layer isn't installed here. This run covers the whole-resource path the PR targets. AI-assisted (Claude Code).
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-24 22:10 UTC · original

Rebased onto origin/main (70564ae, new heads c4ee0e6 / bdef690):

  • Preserved origin/main's allocate_upload Upload backing (0f63757), with_state, clear_unordered_uint (0b35b7f), and HostList::transition / twin::route integration (13bbd6f).
  • Kept barrier_groups, enhanced texture barrier structs/ABI checks, exact UNORM clear values (bdef690), and cross-list transition tests intact.
  • Also note: bundle #1439 currently reports CONFLICTING after origin/main moved to 70564ae, so keeping this PR cleanly rebased ensures #1439 can pick up the 70564ae-compatible head cleanly.

Verified on bdef690 (Windows MSVC):

  • rustfmt --edition 2024 --check crates/victory-gpu/src/list.rs: all #642 hunks clean (only pre-existing origin/main diffs in with_state/allocate_upload).
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.
  • cargo test --workspace --locked: 478 passed, 0 failed, 7 ignored (victory-gpu: 80 passed, 0 failed, 1 ignored; xtask: 4 passed).
**@⁠nathanbzrr** on GitHub · 2026-11-24 22:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7145905925) Rebased onto `origin/main` (`70564ae`, new heads `c4ee0e6` / `bdef690`): - Preserved `origin/main`'s `allocate_upload` `Upload` backing (`0f63757`), `with_state`, `clear_unordered_uint` (`0b35b7f`), and `HostList::transition` / `twin::route` integration (`13bbd6f`). - Kept `barrier_groups`, enhanced texture barrier structs/ABI checks, exact UNORM clear values (`bdef690`), and cross-list transition tests intact. - Also note: bundle `#1439` currently reports `CONFLICTING` after `origin/main` moved to `70564ae`, so keeping this PR cleanly rebased ensures `#1439` can pick up the `70564ae`-compatible head cleanly. Verified on `bdef690` (Windows MSVC): - `rustfmt --edition 2024 --check crates/victory-gpu/src/list.rs`: all `#642` hunks clean (only pre-existing `origin/main` diffs in `with_state`/`allocate_upload`). - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean. - `cargo test --workspace --locked`: `478 passed, 0 failed, 7 ignored` (`victory-gpu`: `80 passed, 0 failed, 1 ignored`; `xtask`: `4 passed`).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:32 UTC · original · edited 2026-11-25 22:27 UTC

Automated triage for the maintainers.

Merge candidate, with one behaviour change to confirm. Reviewed at 4783e28, which merges cleanly into main.

barrier_groups in crates/victory-gpu/src/list.rs (ID3D12GraphicsCommandList7::Barrier, already wired at slot 146 on main) now reads the groups instead of ignoring them:

  • Texture barriers. layout_after is mapped to a legacy state (enhanced_layout_state; UNDEFINED and the video layouts give none) and goes through list.transition and host::legal_state. That keeps the cross-list tracker in HostList::prelude right for textures shaders read straight from the heap, which draw::State::bind does not move itself. The new test shows that case on main (render target, then a heap SRV read without ensure_state).
  • Split barriers. The begin half is skipped.
  • Partial ranges. A barrier on part of a texture is not applied to the whole-resource tracker (is_whole_resource_barrier).
  • Repeated textures. A second transition of the same texture in one call flushes first, avoiding duplicate-subresource errors.

The BarrierGroup/TextureBarrier layouts are checked against the windows crate's D3D12 types at compile time; the layout values follow Microsoft's public enhanced-barrier documentation. main's diagnostics breadcrumb (note_op) is kept.

The change to confirm: main emitted one global UAV barrier for every Barrier call. Now a call made only of texture barriers, with no UAV access before or after, emits only the transitions and no global UAV barrier. By the D3D12 rules that is enough, but it changes ordering on title paths that main covered with the blanket barrier.

On your reply: the rebase keeps main's breadcrumb and adapts to the owned ID3D12Resource returns, and the earlier four points (premise, partial ranges, layout evidence, formatting churn) are addressed. CI: check passing on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7148605295) · edited 2026-11-25 22:27 UTC <!-- victory-triage v1 head=4783e28da97c216e4a4adae5992cbb480d3df469 verdict=merge-candidate at=2026-11-25T22:34:00Z --> Automated triage for the maintainers. **Merge candidate, with one behaviour change to confirm.** Reviewed at `4783e28`, which merges cleanly into `main`. `barrier_groups` in `crates/victory-gpu/src/list.rs` (`ID3D12GraphicsCommandList7::Barrier`, already wired at slot 146 on `main`) now reads the groups instead of ignoring them: - **Texture barriers.** `layout_after` is mapped to a legacy state (`enhanced_layout_state`; `UNDEFINED` and the video layouts give none) and goes through `list.transition` and `host::legal_state`. That keeps the cross-list tracker in `HostList::prelude` right for textures shaders read straight from the heap, which `draw::State::bind` does not move itself. The new test shows that case on `main` (render target, then a heap SRV read without `ensure_state`). - **Split barriers.** The begin half is skipped. - **Partial ranges.** A barrier on part of a texture is not applied to the whole-resource tracker (`is_whole_resource_barrier`). - **Repeated textures.** A second transition of the same texture in one call flushes first, avoiding duplicate-subresource errors. The `BarrierGroup`/`TextureBarrier` layouts are checked against the `windows` crate's D3D12 types at compile time; the layout values follow Microsoft's public enhanced-barrier documentation. main's diagnostics breadcrumb (`note_op`) is kept. The change to confirm: `main` emitted one global UAV barrier for every `Barrier` call. Now a call made only of texture barriers, with no UAV access before or after, emits only the transitions and no global UAV barrier. By the D3D12 rules that is enough, but it changes ordering on title paths that `main` covered with the blanket barrier. On your reply: the rebase keeps `main`'s breadcrumb and adapts to the owned `ID3D12Resource` returns, and the earlier four points (premise, partial ranges, layout evidence, formatting churn) are addressed. CI: `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 00:58 UTC · original

Rebased onto origin/main (42363ab, new heads 87c98ed / 4d4da75):

  • Resolved the test-block conflict in crates/victory-gpu/src/list.rs, keeping origin/main's resolve_queries_rejects_overflowing_offset (628b95d) and initial pipeline binding changes (e52777a / 8d3a025) alongside #642's enhanced texture barrier translation and tests.

Verified locally (Windows MSVC):

  • On 4118f33 (cc71a22):
    • cargo clippy --workspace --all-targets --locked -- -D warnings: clean
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean
    • cargo test --workspace --locked: 705 passed, 0 failed, 10 ignored
    • cargo xtask policy: 182 files ok
  • On 42363ab (4d4da75):
    • cargo test -p victory-gpu --locked -- --test-threads=1: 143 passed, 0 failed, 2 ignored
    • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1: 146 passed, 0 failed, 2 ignored
**@⁠nathanbzrr** on GitHub · 2026-11-25 00:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7149082276) Rebased onto `origin/main` (`42363ab`, new heads `87c98ed` / `4d4da75`): - Resolved the test-block conflict in `crates/victory-gpu/src/list.rs`, keeping `origin/main`'s `resolve_queries_rejects_overflowing_offset` (`628b95d`) and initial pipeline binding changes (`e52777a` / `8d3a025`) alongside `#642`'s enhanced texture barrier translation and tests. Verified locally (Windows MSVC): - On `4118f33` (`cc71a22`): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: clean - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: clean - `cargo test --workspace --locked`: 705 passed, 0 failed, 10 ignored - `cargo xtask policy`: 182 files ok - On `42363ab` (`4d4da75`): - `cargo test -p victory-gpu --locked -- --test-threads=1`: 143 passed, 0 failed, 2 ignored - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1`: 146 passed, 0 failed, 2 ignored
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 03:26 UTC · original

Updated onto origin/main (940d32f, squashed head 6264e86) addressing the four triage items:

  1. Premise (heap-indexed SRVs): draw::State::bind does not call list::ensure_state on textures referenced solely through a descriptor heap unless title_written(texture) is true (false for GPU-written render targets), so those reads rely on the title's barrier to move RENDER_TARGET -> SHADER_RESOURCE. On main (crates/victory-gpu/src/list.rs:1374), barrier_groups ignores layout_after and leaves the resource tracked in RENDER_TARGET. Added list::tests::enhanced_texture_barrier_transitions_render_target_for_heap_srv_read (RTV clear -> barrier_groups RENDER_TARGET -> SHADER_RESOURCE -> compute shader reading the SRV directly from a shader-visible view heap without ensure_state, asserting hlist.transition(tex, 0x40 | 0x80).is_none(), readback [64, 128, 192, 255], and 0 D3D12 debug-layer errors).
  2. Partial subresources: added compile-time layout assertions for D3D12_BARRIER_SUBRESOURCE_RANGE and is_whole_resource_barrier, gating list.transition on whole-resource barriers so partial ranges are skipped without disturbing sibling mips/slices/planes (while still honoring UAV ordering flags). Added list::tests::enhanced_texture_barrier_skips_partial_subresource_ranges covering @⁠fuzeofficlal's two-mip case (mip-0 clear -> mip-1 flat index 1 and explicit mip-1 range barriers to COPY_SOURCE -> subsequent mip-0 clear, asserting RENDER_TARGET is preserved and 0 D3D12 debug-layer errors occur).
  3. ABI evidence: slot 146 (barrier_groups) is already wired on main in NEWER_METHODS (crates/victory-gpu/src/list.rs:1514), and all BarrierGroup, TextureBarrier, D3D12_BARRIER_SUBRESOURCE_RANGE, and D3D12_BARRIER_LAYOUT layouts/values match the Windows D3D12 headers at compile time and in enhanced_layout_mapping_and_abi. This environment has no local title binary/disassembly (per asset policy), so verifying slot-146 call sites directly from the title's own executable remains open for someone with a local binary.
  4. Unrelated formatting churn: reverted all 4 formatting-only hunks (clear_dsv, allocate_upload, execute_indirect, and allocate_upload_is_aligned_and_below_40_bits). The diff now touches only crates/victory-gpu/src/list.rs in two hunks (barrier_groups and mod tests).

Verified on 6264e86 (Windows MSVC):

  • cargo run -p xtask -- policy --staged: asset policy: 1 files ok
  • cargo clippy --workspace --all-targets -- -D warnings & --all-features: clean
  • cargo test -p victory-gpu --locked list: 13 passed, 0 failed
  • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked list -- --test-threads=1: 13 passed, 0 failed (0 D3D12 debug-layer errors)
  • cargo test --workspace --locked: 0 failures across all workspace crates
**@⁠nathanbzrr** on GitHub · 2026-11-25 03:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7151919176) Updated onto `origin/main` (`940d32f`, squashed head `6264e86`) addressing the four triage items: 1. **Premise (heap-indexed SRVs)**: `draw::State::bind` does not call `list::ensure_state` on textures referenced solely through a descriptor heap unless `title_written(texture)` is true (false for GPU-written render targets), so those reads rely on the title's barrier to move `RENDER_TARGET -> SHADER_RESOURCE`. On `main` (`crates/victory-gpu/src/list.rs:1374`), `barrier_groups` ignores `layout_after` and leaves the resource tracked in `RENDER_TARGET`. Added `list::tests::enhanced_texture_barrier_transitions_render_target_for_heap_srv_read` (RTV clear -> `barrier_groups` `RENDER_TARGET -> SHADER_RESOURCE` -> compute shader reading the SRV directly from a shader-visible view heap without `ensure_state`, asserting `hlist.transition(tex, 0x40 | 0x80).is_none()`, readback `[64, 128, 192, 255]`, and 0 D3D12 debug-layer errors). 2. **Partial subresources**: added compile-time layout assertions for `D3D12_BARRIER_SUBRESOURCE_RANGE` and `is_whole_resource_barrier`, gating `list.transition` on whole-resource barriers so partial ranges are skipped without disturbing sibling mips/slices/planes (while still honoring UAV ordering flags). Added `list::tests::enhanced_texture_barrier_skips_partial_subresource_ranges` covering @⁠fuzeofficlal's two-mip case (mip-0 clear -> mip-1 flat index 1 and explicit mip-1 range barriers to `COPY_SOURCE` -> subsequent mip-0 clear, asserting `RENDER_TARGET` is preserved and 0 D3D12 debug-layer errors occur). 3. **ABI evidence**: slot 146 (`barrier_groups`) is already wired on `main` in `NEWER_METHODS` (`crates/victory-gpu/src/list.rs:1514`), and all `BarrierGroup`, `TextureBarrier`, `D3D12_BARRIER_SUBRESOURCE_RANGE`, and `D3D12_BARRIER_LAYOUT` layouts/values match the Windows D3D12 headers at compile time and in `enhanced_layout_mapping_and_abi`. This environment has no local title binary/disassembly (per asset policy), so verifying slot-146 call sites directly from the title's own executable remains open for someone with a local binary. 4. **Unrelated formatting churn**: reverted all 4 formatting-only hunks (`clear_dsv`, `allocate_upload`, `execute_indirect`, and `allocate_upload_is_aligned_and_below_40_bits`). The diff now touches only `crates/victory-gpu/src/list.rs` in two hunks (`barrier_groups` and `mod tests`). Verified on `6264e86` (Windows MSVC): - `cargo run -p xtask -- policy --staged`: `asset policy: 1 files ok` - `cargo clippy --workspace --all-targets -- -D warnings` & `--all-features`: clean - `cargo test -p victory-gpu --locked list`: 13 passed, 0 failed - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --locked list -- --test-threads=1`: 13 passed, 0 failed (0 D3D12 debug-layer errors) - `cargo test --workspace --locked`: 0 failures across all workspace crates
Author
Owner

@⁠nathanbzrr on GitHub · 2026-11-25 21:54 UTC · original

Rebased onto origin/main (61bfc77, new head 4783e28):

  • Resolved the conflict in crates/victory-gpu/src/list.rs inside barrier_groups, keeping enhanced texture barrier translation and partial-subresource gating while preserving origin/main's diagnostics breadcrumb (list.note_op(...) from eed1670).
  • Adapted host_resource / list.transition / host::legal_state / host::transition / host.rtv borrows for origin/main's owned ID3D12Resource return values (69d1e8e) and updated new_newer_list in list::tests for List::hosts / List::segment (9cc37c5).

Verified on 4783e28 (Windows MSVC):

  • cargo run -p xtask -- policy: asset policy: 186 files ok
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings & --all-features: clean
  • cargo test -p victory-gpu --lib --locked -- list::tests --test-threads=1: 8 passed, 0 failed
  • VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked -- list::tests --test-threads=1: 8 passed, 0 failed
**@⁠nathanbzrr** on GitHub · 2026-11-25 21:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/642#issuecomment-7175701117) Rebased onto `origin/main` (`61bfc77`, new head `4783e28`): - Resolved the conflict in `crates/victory-gpu/src/list.rs` inside `barrier_groups`, keeping enhanced texture barrier translation and partial-subresource gating while preserving `origin/main`'s diagnostics breadcrumb (`list.note_op(...)` from `eed1670`). - Adapted `host_resource` / `list.transition` / `host::legal_state` / `host::transition` / `host.rtv` borrows for `origin/main`'s owned `ID3D12Resource` return values (`69d1e8e`) and updated `new_newer_list` in `list::tests` for `List::hosts` / `List::segment` (`9cc37c5`). Verified on `4783e28` (Windows MSVC): - `cargo run -p xtask -- policy`: `asset policy: 186 files ok` - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` & `--all-features`: clean - `cargo test -p victory-gpu --lib --locked -- list::tests --test-threads=1`: 8 passed, 0 failed - `VICTORY_D3D12_WARP=1 VICTORY_D3D12_DEBUG=1 cargo test -p victory-gpu --features diagnostics --lib --locked -- list::tests --test-threads=1`: 8 passed, 0 failed
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/642/head:github-bot/gh-642'
git switch 'github-bot/gh-642'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-642'
git switch 'github-bot/gh-642'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-642'
git switch 'github-bot/gh-642'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-642'
git switch 'main'
git merge --squash 'github-bot/gh-642'
git switch 'main'
git merge --ff-only 'github-bot/gh-642'
git switch 'main'
git merge 'github-bot/gh-642'
git push origin 'main'
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!642
No description provided.