D3D12.X: barrier_groups drops UNDEFINED -> target transitions for new COMMON textures (debug layer 538, 527) #3489

Open
opened 2026-11-30 02:00:47 +00:00 by KDenKC · 0 comments
KDenKC commented 2026-11-30 02:00:47 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by KDenKC on 2026-11-30T02:00:47Z.


With XCL_D3D12_DEBUG=1 on the retail title (RTX 5090, XCL_PREPARE=0), newly created targets are drawn/cleared while still in COMMON|PRESENT (id 538, 8×) and fail their next barrier (id 527, same resource 1 ms later):

[   11.544][ 4836][WARN ] D3D12 debug layer (error, id 538): ID3D12CommandQueue1::ExecuteCommandLists: Using Draw on Command List (0x0000000050264600:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]) of resource (0x0000000BFCCEE190:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a render target.  Expected State Bits (all): 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET, Actual State: 0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT], Missing State: 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET.
[   11.545][ 4836][WARN ] D3D12 debug layer (error, id 527): ID3D12CommandQueue1::ExecuteCommandLists: Using ResourceBarrier on Command List (0x0000000050264600:'Unnamed ID3D12GraphicsCommandList Object'): Before state (0x4: D3D12_RESOURCE_STATE_RENDER_TARGET) of resource (0x0000000BFCCEE190:'Unnamed ID3D12Resource Object') (subresource: 0) specified by transition barrier does not match with the state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]) specified in preceding ResourceBarrier or as InitialState
[   55.500][ 4836][WARN ] D3D12 debug layer (error, id 538): ID3D12CommandQueue1::ExecuteCommandLists: Using ClearDepthStencilView on Command List (0x0000000063E3D7D0:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]) of resource (0x0000000A9D4A0FC0:'Unnamed ID3D12Resource Object') (subresource: 1) is invalid for use as a depth buffer.  Expected State Bits (all): 0x10: D3D12_RESOURCE_STATE_DEPTH_WRITE, Actual State: 0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT], Missing State: 0x10: D3D12_RESOURCE_STATE_DEPTH_WRITE.
  • Code (main 53e85fb1): crates/xcl/src/hle/d3d12x/barrier_groups.rs:221-253 (transitions_of, LayoutBefore == UNDEFINED). When a texture has no prior LAST entry (prev = [None, None]), if let Some(before) = prev[p] skips emitting any PC transition while still recording moved(t.res, p, a, stride). The PC resource stays in COMMON for the draw/clear (id 538), and the following RENDER_TARGET -> ... barrier mismatches COMMON (id 527).
  • Likely fix: Seed unknown prev[p] from the resource's recorded creation state (default COMMON) when translating UNDEFINED -> after, so the initial COMMON -> RENDER_TARGET / DEPTH_WRITE transition is emitted.
  • Reproduce: Run the retail title with XCL_D3D12_DEBUG=1 XCL_PREPARE=0 (observed in the first 65 s on RTX 5090; note: observed on an integration stack carrying #3287's barrier_groups.rs, whose UNDEFINED branch is identical on main 53e85fb1).
  • Related: #3287, #1833, #940.

AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.

<!-- greyfinch-sync:ivall/xcl:issue:6687229535 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/3489). Originally posted by [KDenKC](https://github.com/KDenKC) on 2026-11-30T02:00:47Z. --- With `XCL_D3D12_DEBUG=1` on the retail title (RTX 5090, `XCL_PREPARE=0`), newly created targets are drawn/cleared while still in `COMMON|PRESENT` (`id 538`, 8×) and fail their next barrier (`id 527`, same resource 1 ms later): ```text [ 11.544][ 4836][WARN ] D3D12 debug layer (error, id 538): ID3D12CommandQueue1::ExecuteCommandLists: Using Draw on Command List (0x0000000050264600:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]) of resource (0x0000000BFCCEE190:'Unnamed ID3D12Resource Object') (subresource: 0) is invalid for use as a render target. Expected State Bits (all): 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET, Actual State: 0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT], Missing State: 0x4: D3D12_RESOURCE_STATE_RENDER_TARGET. [ 11.545][ 4836][WARN ] D3D12 debug layer (error, id 527): ID3D12CommandQueue1::ExecuteCommandLists: Using ResourceBarrier on Command List (0x0000000050264600:'Unnamed ID3D12GraphicsCommandList Object'): Before state (0x4: D3D12_RESOURCE_STATE_RENDER_TARGET) of resource (0x0000000BFCCEE190:'Unnamed ID3D12Resource Object') (subresource: 0) specified by transition barrier does not match with the state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]) specified in preceding ResourceBarrier or as InitialState [ 55.500][ 4836][WARN ] D3D12 debug layer (error, id 538): ID3D12CommandQueue1::ExecuteCommandLists: Using ClearDepthStencilView on Command List (0x0000000063E3D7D0:'Unnamed ID3D12GraphicsCommandList Object'): Resource state (0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT]) of resource (0x0000000A9D4A0FC0:'Unnamed ID3D12Resource Object') (subresource: 1) is invalid for use as a depth buffer. Expected State Bits (all): 0x10: D3D12_RESOURCE_STATE_DEPTH_WRITE, Actual State: 0x0: D3D12_RESOURCE_STATE_[COMMON|PRESENT], Missing State: 0x10: D3D12_RESOURCE_STATE_DEPTH_WRITE. ``` - **Code (`main` `53e85fb1`):** `crates/xcl/src/hle/d3d12x/barrier_groups.rs:221-253` (`transitions_of`, `LayoutBefore == UNDEFINED`). When a texture has no prior `LAST` entry (`prev = [None, None]`), `if let Some(before) = prev[p]` skips emitting any PC transition while still recording `moved(t.res, p, a, stride)`. The PC resource stays in `COMMON` for the draw/clear (`id 538`), and the following `RENDER_TARGET -> ...` barrier mismatches `COMMON` (`id 527`). - **Likely fix:** Seed unknown `prev[p]` from the resource's recorded creation state (default `COMMON`) when translating `UNDEFINED -> after`, so the initial `COMMON -> RENDER_TARGET` / `DEPTH_WRITE` transition is emitted. - **Reproduce:** Run the retail title with `XCL_D3D12_DEBUG=1 XCL_PREPARE=0` (observed in the first 65 s on RTX 5090; note: observed on an integration stack carrying `#3287`'s `barrier_groups.rs`, whose `UNDEFINED` branch is identical on `main` `53e85fb1`). - **Related:** `#3287`, `#1833`, `#940`. AI use: an agent swarm: Claude Opus 5.5, Claude Sonnet 5.5, GPT-6.2-Sol, Gemini 4 Neon and Gemini 3.8 Flash.
Sign in to join this conversation.
No labels
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.

Reference
xcl-dev/xcl#3489
No description provided.