Repository navigation
Conversation
Apple's D3DMetal (macOS under CrossOver) is native code in no PE module: `class_for` already asks which module the host's first method is in, and gets none there. That is now kept in `gpu::shader::NATIVE_HOST_MEMORY` and logged once. Nothing reads it yet; the depth formats of such a host are the first use (next commit). The flag and its place are those of `mac-on-main-wip` (e97bc3a, "Mac host basics"), taken out on their own; the rest of that commit is not here. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…, on top of upstream's PC formats
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 <noreply@anthropic.com>
(cherry picked from commit 8fc0600)
`depth_only_format` takes both depth + stencil families to the R32 one, role for role, and leaves 16-bit depth and colour formats alone; off a native host the PC mapping is unchanged. The `device_x` part of `mac-on-main-wip` aaf191b; its `isa` tests are not here. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
…g runs everywhere `depth_only` is the process's: once a test has adopted a device of a native host, the tests of the PC's depth formats that run after it in the same process saw the depth-only mapping and failed (`console_depth_buffers_and_their_views_are_the_pcs`: (39, 2) for (44, 2); `console_formats_are_asked_as_the_pcs`: 40 for 45; CrossOver 26.3, D3DMetal, `hle::d3d12x:: --test-threads=1`). Alone they passed. A test now says which host it describes (`depth_only_for_test`, a thread-local in test builds only). The two tests of the PC's formats say "not a native host"; `depth_stencil_families_become_the_r32_family` checks both answers through the real functions (resource descriptions, pipeline and clear-value formats, shader views, depth views), so the native mapping is tested on Windows too, where no host turns it on. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
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, 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. |
|
Regression run for this PR on Windows / NVIDIA, since it has no Tested
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 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. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
XCL PR #1649 — Windows / Intel Arc A770Clean head Tested
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.
Workspace failures and skips
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 |
The depth formats piece of @Ahmet-Dedeler's Mac port (
mac-on-main-wip8fc0600, with its test from aaf191b), rebased ontomainas he suggested in #258 (comment). 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
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
main:this PR:
Not tested
maindoes not get that far on D3DMetal (it dies before a depth buffer is made, D3D12.X: a stage the PC cannot run goes to the fallback without the driver #750 and the vtable work in macOS (Apple Silicon, CrossOver + D3DMetal): the newer retail game reaches its first-run menus at 30 fps #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