Skip to content

[upstream #1027] D3D12.X: count the barriers that use a depth buffer as a UAV (#970) - #111

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

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

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Part of xcl-dev#970: diagnostics only, the first of the four steps planned there. Replaces xcl-dev#1021, closed when its fork was deleted (same commit).

A console depth buffer that shaders write too has no ALLOW_UNORDERED_ACCESS on the PC (device_x::pc_resource_desc drops it) and its UAVs are null views (real::dev_create_uav_x), so what shaders write through them is lost. This counts and logs the title's barriers that use such a resource as a UAV, so the effect can be measured before anything changes. No behaviour change: every barrier still goes to the PC as before.

On the retail title of xcl-dev#505 no legacy barrier touches these resources: its texture transitions come through #146 (enhanced barriers, D3D12_BARRIER_GROUP), whose description XCL does not read (it emits one global UAV barrier – HANDOFF lists the #146 description as "not yet"). There, D16 shadow maps (768x768x6, 1024x1024, 512x512) go into or out of the UNORDERED_ACCESS layout once the world starts loading (62–64 s; 12 barriers in a run with every one logged).

What is in it

  • crates/xcl/src/hle/d3d12x/list_x.rs: depth_without_uav (ALLOW_DEPTH_STENCIL without ALLOW_UNORDERED_ACCESS) and note_depth_uav_barrier (counted; the first 8 and every power of two logged), called for transitions from / to UNORDERED_ACCESS and UAV barriers naming the resource in resource_barrier_x; note_depth_uav_barrier_groups reads the texture barriers of [upstream #959] Tests: cover xcl shaders across files, folders, and RPF9 packs #146 (uav_barrier_x) and counts those with the UNORDERED_ACCESS layout or access (barrier_uses_uav). Tests: a_depth_buffer_without_unordered_access_is_one_with_null_uavs, an_enhanced_barrier_into_or_out_of_unordered_access_is_a_uav_use.
  • crates/xcl/src/hle/d3d12x/console_list.rs: the same for console-recorded lists (their replayed transitions and their [upstream #959] Tests: cover xcl shaders across files, folders, and RPF9 packs #146 calls).
  • crates/xcl/src/hle/d3d12x/real.rs: the null-view warning gives its total instead of stopping at 4.

Tested

Regression run

main:

xcl-smoke v1
commit: 09940bb87fa11bc394fd9e5de570c2b7cfd16323
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1271 (PresentX 1271)
presents per 2 s (last 3): 11 10 14
device removals: 0
crashes: 0
peak commit: 27340 MB

this PR:

xcl-smoke v1
commit: ba8d356037b926c6768dd6f956895657d4a101a3
gpu: NVIDIA GeForce RTX 5080
title: game
seconds: 60
exit: 0x0
frames shown: 1296 (PresentX 1297)
presents per 2 s (last 3): 10 25 25
device removals: 0
crashes: 0
peak commit: 27852 MB

Not tested

AI use

  • Claude Code, Claude Opus 5.5: found the null views in the smoke runs, wrote the code, the tests and this description, and ran the tests and the runs above.

🤖 Generated with Claude Code


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

…#970)

A console depth buffer that shaders write too has no ALLOW_UNORDERED_ACCESS
on the PC (pc_resource_desc drops it) and its UAVs are null views, so the
writes are lost. The title's barriers that use such a resource as a UAV are
now counted and logged (the first 8, then every power of two):
- transitions from or to UNORDERED_ACCESS and UAV barriers naming it, both
  for PC-format lists (resource_barrier_x) and console-recorded ones
  (console_list replay);
- enhanced texture barriers (#146, D3D12_BARRIER_GROUP) with the
  UNORDERED_ACCESS layout or access. XCL still turns #146 into one global
  UAV barrier; only the description is read here.
The null-view warning gives its total instead of stopping at 4.

Measured on the retail title of xcl-dev#505 (RTX 5080, 300 s runs, A at 15 s):
no legacy barrier touches these resources; enhanced barriers move D16
shadow maps (768x768x6, 1024x1024, 512x512) into or out of the
UNORDERED_ACCESS layout once the world starts loading (62-64 s; 12 in a
run with every one logged).

No behaviour change: every barrier goes to the PC as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ufoptg

ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner Author

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

@ufoptg ufoptg closed this Nov 25, 2026
@ufoptg
ufoptg deleted the upstream-pr/1027 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