D3D12.X: on a native host every depth + stencil family is depth only #1649
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1649
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1649"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@shortside on GitHub · 2026-11-24 18:41 UTC · original
shortside:d3d12x/native-host-depth-only→main· +170 −4 · 3 files · 4 commits · openThe depth formats piece of @Ahmet-Dedeler's Mac port (
mac-on-main-wip8fc0600, with its test from aaf191b), rebased ontomainas he suggested in https://github.com/ivall/xcl/issues/258#issuecomment-7133365549. Part of #258.Metal makes no depth-only view of a depth + stencil texture and no view in another depth family than the texture's: its assertion ends the process, where a Windows driver takes or refuses the view. The console reads its depth buffers through exactly such views. So on a native D3D12 host (Apple's D3DMetal) every depth + stencil family becomes the R32 one (R32_TYPELESS / D32_FLOAT / R32_FLOAT), and the stencil plane is lost there: stencil views read the depth.
XCL_DEPTH_STENCIL=1restores the PC mapping. On Windows nothing changes: the host's D3D12 is a PE module and the switch is never on.What it does not do: it does not keep stencil. Losing the stencil plane is a real cost, not a format rename: the title writes material numbers through the stencil plane of some depth targets and tests against them later, so on such a host those passes read depth where they expect stencil (@Ahmet-Dedeler, in the comments). That is a known limit of this mapping and outside this PR.
What is in it (4 commits, +170 / -4; the first three are Ahmet's code with him as author)
D3D12.X: note a native D3D12 host when its first object is adopted(gpu/shader.rs,hle/d3d12x/real.rs, +12):class_foralready asks which module the host's first method is in; none means a native host, kept ingpu::shader::NATIVE_HOST_MEMORYand logged once. The depth change needs it andmaindoes not have it: it is 12 lines out of the port's e97bc3a ("Mac host basics"), nothing else of that commit. Kept here at @Ahmet-Dedeler's request: his vtable branch will read the flag from this place when it is opened.Depth formats on D3DMetal: …(hle/d3d12x/device_x.rs,real.rs): 8fc0600, cherry-picked. One conflict, withpc_initial_state, added onmainat the same place; both kept.Tests: a native host's depth-only formats(device_x.rs): thedevice_xhalf of aaf191b.Tests: the depth format tests name their host; a native host's mapping runs everywhere(device_x.rs,real.rs), mine:depth_onlyis the process's, so after a test had adopted a native host's device, the two tests of the PC's formats that ran later in the same process failed (below). A test now says which host it describes (depth_only_for_test, a thread-local in test builds only), anddepth_stencil_families_become_the_r32_familychecks both answers through the real functions, so the native mapping is tested on Windows too.Tested
main1a0bbe3; new head579e0be(wasfcdb447). Three conflict hunks, both sides kept: inpc_resource_desc,main's new unordered-access flag strip runs first and the depth-only mapping after it;pc_initial_state_for_descstays ahead ofdepth_only; indev_create_uav_x,main'spc_shader_view_formatpath keeps this PR's view trace. After the rebase, the 14 lib tests inhle::d3d12x::device_xandhle::d3d12x::real::that touch depth formats, view formats and unordered access, one per process: 11 passed, 1 failed, 2 crashed. The same three (gpu_depth_buffer_created_for_unordered_access_is_placed,gpu_placed_console_depth_target_with_clear_value,gpu_uav_companion_srv_and_null_image_views) fail or crash the same way onmain1a0bbe3on this host. The other counts below are from headfcdb447, before the rebase, and were not repeated.x86_64-pc-windows-msvcwith clang-cl / lld-link 23.1.6 and an xwin SDK 10.0.26100, Rust 1.100.0, debug. The lib test binary run under Wine.mainis9e3831e(this branch's base), the head isfcdb447; it merges intomainc160d86without conflicts.device_x::|depth|console_format|dsv|format_query, one per process (--exact, 60 s cap), first three commits:main19 passed, 1 failed, 1 without a result at the cap, and the new test does not exist; branch 20 passed, the same 1 failed (gpu_depth_buffer_created_for_unordered_access_is_placed: "UNORDERED_ACCESS without the UAV flag") and the same 1 without a result (gpu_placed_console_depth_target_with_clear_value). No test changed outcome.hle::d3d12x:: --skip ::gpu_ --test-threads=1in one process, skipping 6 tests that crash or hang this host onmaintoo (create_list_reset_and_clear_state_track_initial_pso_on_d3d12,placed_title_textures_share_vram_and_preserve_pixels,d32s8_targets_take_their_own_size_of_video_memory,transitions_apply_when_their_list_is_submitted, and the twosparse::teststhat stopped the run on both sides):main: 130 passed, 4 failed, 1 ignored.console_depth_buffers_and_their_views_are_the_pcs(left: (39, 2), right: (44, 2)) andconsole_formats_are_asked_as_the_pcs(left: (Some(118), 40), right: (Some(118), 45)).fcdb447: 131 passed, 4 failed, 1 ignored:main's four (timestamps_outside_unified_memory_land_after_the_queue,write_buffer_immediate_on_open_existing_heap_visible_to_cpu,mapped_frame_dump_distinguishes_dark_bright_and_undecoded_content,reservable_agrees_with_the_driver) and the new test passing.Regression run
scripts/smoke.ps1unchanged. Neither build shows a frame in 60 s on this host, so this pair only shows that the change adds no crash or device removal here; it does not exercise the depth formats.main:this PR:
fcdb447):main:this PR:
Not tested
maindoes not get that far on D3DMetal (it dies before a depth buffer is made, #750 and the vtable work in #258), so onmainonly the unit tests exercise it. Onmac-on-main-wip, where this code comes from, it is part of what draws.vram::reservablesays no for R32_TYPELESS (D3DMetal does not report TILED for it) whileCreateReservedResourcesucceeds (reservable_agrees_with_the_driverfails onmainhere for that). With this change every depth + stencil buffer is R32_TYPELESS on such a host.AI use
🤖 Generated with Claude Code
Metal makes no depth-only view of a depth + stencil texture and no view in another depth family than the texture's: its assertion ("failed assertion `Texture Creation`") ends the process where a Windows driver takes or refuses the view. Upstream now makes depth buffers typeless and reads them through R24_UNORM_X8 / R32_FLOAT_X8X24 views with stencil in plane 1 – that combination. On a native host (`device_x::depth_only`, XCL_DEPTH_STENCIL=1 restores upstream's mapping) the override sits on upstream's functions: - pc_resource_desc: R32G8X24 / R24G8 families (and the console's D16S8, which upstream maps to R24G8) → R32_TYPELESS / D32_FLOAT / R32_FLOAT (`depth_only_format`). - pc_view_format (pipelines' DSV formats, clear values, format queries) the same. - pc_shader_view_format: any depth-family or stencil view of an R32-family resource → R32_FLOAT (stencil views read the depth: the stencil plane is lost); of a 16-bit depth buffer → R16_UNORM. - pc_depth_view_format: a DSV takes the depth format of the resource's family. - XCL_TRACE_DEPTH_VIEWS=1 logs every view made of a depth-family resource, flushed. Upstream's mappings of B5G5R5A1 / B4G4R4A4 targets and of the console's 116 / 117 are as upstream has them (the local pc_format and view_format_for are gone). Co-Authored-By: Claude Mythos 5.2 <[email protected]> (cherry picked from commit 8fc0600c0b92d70195272c1c15557e128dd06cbc)@Ahmet-Dedeler on GitHub · 2026-11-24 19:13 UTC · original
Thanks for taking this one. Keep the flag here, that's the better order. My vtable branch isn't open as a PR yet and it's still on
508a0c7, so it's easier for me to rebase it onto this than for you to wait on it. When I open it,class_forwill readNATIVE_HOST_MEMORYfrom where you put it.One thing to say clearly in the description, since reviewers on Windows will ask: losing the stencil plane is a real cost and not only a format rename. The title writes material numbers through the stencil plane of some depth targets and tests against them later, so on this host those passes read depth where they expect stencil. That's a known limit of this mapping and not something this PR should try to fix, but it's worth one line under what it does not do.
I can't add a Windows pair. A Mac pair with a title from my port has to wait for its next rebase.
@papasmurph0 on GitHub · 2026-11-24 20:08 UTC · original
Regression run for this PR on Windows / NVIDIA, since it has no
xcl-smokepair yet.Tested
scripts/smoke.ps1 -Seconds 60on the retail title of #505 (game folder passed as a neutral junction, hencetitle: t1), each build from a clean worktree of the exact commit.main:this PR:
Both runs started from the same state (the title's settings already saved, so no first-run screens). The PR's run is within the limits: 121 % of
main's frames, 61 % of its peak commit, no crash, no device removal.Not tested: the change itself: on Windows the host's D3D12 is a PE module, so the depth + stencil mapping is never switched on here (as the description says) and the run is a regression check only. D3DMetal and stencil behaviour there are not covered.
AI use: Claude Code (Claude Opus 5.5) built the trees, made the runs on my PC and wrote this report; I asked for it to be posted.
@DavidM1911 on GitHub · 2026-11-24 21:06 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodifiedmain.)Thanks!
@JJAutoCompare on GitHub · 2026-11-25 04:49 UTC · original
XCL PR #1649 — Windows / Intel Arc A770
Clean head
fcdb447f60ffbed10c2f7eb89494823ca80c8ebbon STOR-WINLAB. Windows 11 Enterprise Evaluation x64 (build 26200), AMD Family 23 Model 113, Intel Arc A770 (driver 32.0.101.9175), DXC 1.9.2609.5, rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Unoptimized dev/test builds, no debuginfo or incremental compilation.Tested
cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the Arc mutex.XCL_ADAPTER=NONE_CPU_ONLY:Tests covered forced native-host R32 resource, shader-view and depth-view mappings, including stencil views reading depth. Windows assertions covered D16S8-to-D24S8 mapping, stencil plane selection and format-query translation.
cargo test --workspace --no-fail-fast -- --test-threads=4ran once viaInvoke-ArcTest.ps1 -WaitMinutes 120withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1. Arc A770 confirmed in the log. Exit 101. The 20 summaries (19 binaries and one doctest target) totaled 761 harness passes, 16 failures, 41 ignored. The three focused tests passed again.Workspace failures and skips
CreateComputePipelineStateerror0x80070057. Four reported mismatches in fused FMA overflow, implicit-LOD sampling, the high half of v_add_f16, or wave64 pixel reductions.RSSetDepthBiasXcheck returned blue where it expected green.SKIPPEDlines inpr1649-suite.log. Two cited missing wave64, two cited missing debug-layer support, one cited tiled tier below 2, and one cited unavailable heap windows. The harness counts all six as passes. Coverage excludes them.Not tested
Apple D3DMetal/Wine, native-host detection and depth/stencil view creation on that backend, other GPUs, and retail title smoke runs. Failure attribution requires a matched main run.
AI use
T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr1649-suite.logand published.@jennydeth on GitHub · 2026-11-25 14:23 UTC · original
First Windows (MSVC) build and run of this head (listed under Not tested).
Setup: RTX 3060 12 GB (32-lane waves, driver 32.0.16.2101), Ryzen 5 5600X, 32 GB RAM, Windows 11 build 26300, Rust 1.100.0 stable-x86_64-pc-windows-msvc, DXC 1.9.2609.5, debug build. Head
579e0be.Result: builds with MSVC; cargo test --workspace -- --test-threads=4: 1251 passed, 0 failed, 46 ignored. SKIPPED: 18 GPU tests for no wave64 (expected on this card); 2 debug-layer tests (no d3d12SDKLayers.dll).
Not tested: a title run on Windows.
AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
@DavidM1911 on GitHub · 2026-11-26 05:58 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.