Skip to content

D3D-837: map console layout 0x3 on RT+UAV textures to UNORDERED_ACCESS - #8384

Closed
Grimkaaah wants to merge 4 commits into
ProjectLeonida:mainfrom
Grimkaaah:fix/d3d-837-initial-state-0x3
Closed

Grimkaaah wants to merge 4 commits into
ProjectLeonida:mainfrom
Grimkaaah:fix/d3d-837-initial-state-0x3

Conversation

@Grimkaaah

Copy link
Copy Markdown
Contributor

Summary

Coordination claim in #8344. AI-assisted (Cursor / Composer).

Verification

Linux host; the mock test is Windows/MSVC-only (xs_proxy_mock_test). Logic review + diff check here. A Windows second check of ctest -R xs_proxy_mock on this head (after #7356) would help.

Made with Cursor

tedin7 and others added 4 commits November 23, 2026 17:36
…so the state map is checked with the riid and output in place
…VC leaves the upper half of the stack slot), and else-branch the generic forwarder (C4702); found by MartinIndra02 on ProjectLeonida#7356
…S (CLAIM 7110346733)

Stacked on ProjectLeonida#7356's pc_initial_state_word. Barrier layout 0x3 was refused as
buffer-only bits; with ALLOW_UNORDERED_ACCESS it becomes UNORDERED_ACCESS.
@thehollowedone

Copy link
Copy Markdown

Independent native Windows check of 443a179b with MSVC 19.44.35230 x64, Release. The tested revision includes #7356.

The focused xs_proxy_mock CTest passed. For RT+UAV textures, layout 0x3 forwarded as UNORDERED_ACCESS on slots 27, 53 and 76. The RT-only and buffer passthrough controls passed on slots 27 and 53, and the 0x6 render-target and depth controls passed on all three slots.

I also checked a UAV-only RGBA8 texture following the coordination report. All three slots forwarded 0x3 as UNORDERED_ACCESS and preserved the caller's descriptor byte for byte. The test covers argument forwarding to a mock device. Synthetic inputs only. AI-assisted.

@lohant27-netizen

Copy link
Copy Markdown

Tested 443a179bc on Windows 11 (10.0.26300), NVIDIA GeForce RTX 5070 (driver 32.0.16.2101, subgroup 32), MSVC with SDK 10.0.26100, Release, merged alone onto main dfe4e4ad3: pass. xs_proxy_mock and its 5 variants: 6/6.

Heads-up: this conflicts with #8372 (CPU descriptor handles in the list methods, 37 files) in runtime/shims/d3d12_xs_device.cpp, so whichever lands second rebases.

@tupacfan04 tupacfan04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 0x3 → UNORDERED_ACCESS mapping for RT+UAV is correct (runtime/shims/d3d12_xs_device.cpp:1473-1475), and the RT-only/buffer controls are fine. One real defect remains in the full diff:

A plain texture's 0x6 SHADER_RESOURCE layout is still forwarded as 0x6 and refused. :1476-1479 maps 0x6 only for ALLOW_RENDER_TARGET/ALLOW_DEPTH_STENCIL; a plain texture falls through to return state_word, forwarding 0x6. 0x6 is D3D12_BARRIER_LAYOUT_SHADER_RESOURCE; its legacy state is PIXEL_SHADER_RESOURCE | NON_PIXEL_SHADER_RESOURCE (0xC0), not 0x6. The PC layer refuses it at d3d12_vulkan_device.cpp:1531 (s & ~(writes | reads) includes the buffer-only 0x2 bit), so CreateCommittedResource returns E_INVALIDARG.

The mock test hides it: runtime/test/xs_proxy_mock_test.cpp:845 calls the mock with the plain descriptor and kConsole=0x6 and asserts state_of(...) == kConsole; the mock returns S_OK without reaching the layer. The comment at :842 (“a texture without a use flag … left alone”) is the wrong expectation for a valid SHADER_RESOURCE layout.

This is not hypothetical: issue #8344 comment 7110441457 reports 2/2 retail runs where a 2D texture with flags 0 and state 0x6 is refused 6 times per run during the first drawing phase, and the title fails. Fix: map a plain 0x6 to 0xC0 in pc_initial_state_word (or apply the full state_for_barrier_layout table from #7218) and change the test at :845 to expect 0xC0.

Test gap: the new 0x3 block (:861-877) covers RT+UAV, RT-only and a buffer, but not a texture with only ALLOW_UNORDERED_ACCESS and layout 0x3 — the next retail case in the same comment. The code handles it, but a regression requiring both RT and UAV would pass; add UAV-only for slots 27/53/76. Synthetic/code-read only; no game files. AI-assisted (OpenCode).

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.

6 participants