Skip to content

[upstream #1025] D3D12.X: translate list #146 Enhanced Barriers to legacy ResourceBarrier - #113

Closed
ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1025
Closed

ufoptg wants to merge 1 commit into
mainfrom
upstream-pr/1025

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Translate console command list slot #146 (ID3D12GraphicsCommandList7::Barrier(NumBarrierGroups, pBarrierGroups)) into legacy ResourceBarrier calls instead of emitting only a wildcard UAV barrier. Modern Scarlett titles that create resources with barrier layouts (device #127 / #133) rely on #146 for all render-target, depth, shader-resource, and copy layout transitions; dropping those transitions left targets stuck in their initial states.

(The diff is ~950 lines as one self-contained module: ~520 lines for parsing, layout mapping, state tracking, and legacy barrier translation, plus ~395 lines of unit and GPU tests.)

What is in it

  • crates/xcl/src/hle/d3d12x/enhanced_barrier.rs: parses D3D12_BARRIER_GROUP (GLOBAL, TEXTURE, BUFFER) with readable() guards (falling back to the legacy global UAV barrier on unparseable calls), maps D3D12_BARRIER_LAYOUT 0..=31 (including 0x1F) plus access-bit fallback for console-only layouts > 0x1F, tracks whole-resource states for UNDEFINED before layouts, emits aliasing barriers for UNDEFINED placed textures, skips UNORDERED_ACCESS on non-UAV textures and states disallowed on compute/copy lists, forwards emitted transitions to title_textures::note_transitions, and includes 13 unit + GPU tests.
  • crates/xcl/src/hle/d3d12x/device_x.rs, real.rs, list_x.rs, mod.rs: wire slot #146 to enhanced_barrier::barrier_x, align #127/#133 initial layout states with texture-vs-buffer awareness, record initial/legacy barrier states, and clear tracked state on res_release.

Tested

  • AMD Radeon RX 9070 XT (driver 32.0.32015.2008), Intel Core i5-13600KF, Windows 11 Pro 22631, rustc 1.99.1 (58cf8f9c3 2026-10-13), release + test profiles
  • cargo test --workspace -- --test-threads=4: 741 passed, 0 failed, 41 ignored (0 SKIPPED GPU tests)

Regression run

main:

xcl-smoke v1
commit: 6efdabcdaac93ce5cc123a85e85deba5d49cb294
gpu: AMD Radeon RX 9070 XT
title: Game Assets
seconds: 60
exit: 0x0
frames shown: 1512 (PresentX 1512)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14852 MB

PR:

xcl-smoke v1
commit: 1ecefdda3b4627ab8160845942f27ab4e75ce0c5
gpu: AMD Radeon RX 9070 XT
title: Game Assets
seconds: 60
exit: 0x0
frames shown: 1609 (PresentX 1609)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14876 MB

Not tested

  • NVIDIA GPUs, Intel Arc GPUs, Linux / Wine, other retail titles beyond the 60 s smoke run and unit/GPU test suite.

AI use

  • Antigravity (Gemini 4 Neon): rebased the local Enhanced Barriers implementation onto origin/main, cleaned up unused helper/constant warnings, ran the full GPU test suite and 60 s smoke regression check, and drafted this description.

Mirror of xcl-dev#1025 (auto-synced, do not edit).

Console command list slot #146 is ID3D12GraphicsCommandList7::Barrier(NumBarrierGroups, pBarrierGroups) on both older and newer layouts; previously it emitted only a wildcard UAV barrier, dropping every texture layout transition.

- Parse D3D12_BARRIER_GROUP (GLOBAL, TEXTURE, BUFFER) safely with readable() checks; unparseable calls fall back to the legacy global UAV barrier.
- Map D3D12_BARRIER_LAYOUT 0..=31 including 0x1F (DIRECT_QUEUE_GENERIC_READ_COMPUTE_QUEUE_ACCESSIBLE) and fall back to access bits for console-only layouts > 0x1F; align device #127/#133 initial layout states with texture-vs-buffer awareness.
- Track whole-resource states across #127/#133 creation, legacy #26, and enhanced #146 (cleared on res_release) for UNDEFINED Before layouts, forward emitted transitions to title_textures::note_transitions, emit wildcard aliasing barriers for UNDEFINED placed textures, keep non-UAV textures out of UNORDERED_ACCESS, and skip states disallowed on compute/copy lists.
@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

Upstream PR xcl-dev#1025 was closed or merged.

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/1025 branch November 25, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants