Tests: a refused depth resolve is checked by its Close alone #288

Closed
github-bot wants to merge 1 commit from gh-pr/288/head into gh-pr/288/base
Owner

@⁠Andretuta on GitHub · 2026-11-24 03:00 UTC · original
ubiquitarianism:old-pr/10019 → main · +32 −27 · 2 files · 1 commits · closed without merging

Carried over from old PR 10019 by tugasky in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10019, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tugasky: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Claimed in the coordination issue as: claim (the d3d12_depth_resolve red on Windows AMD item; the follow-up comment there corrects the first framing — this is the test's model, not the layer)

Depends on: none. It conflicts with none of the open PRs; main itself does not compile today (see Tested), which the open build-fix PRs handle separately.

What and why

d3d12_depth_resolve is red on every device at d083a2cc, not only on AMD, with these 8 lines (the Close 0x80070057 is the correct refusal):

refused D24S8 depth AVERAGE rect 1: Close 0x80070057, destination changed
refused D24S8 stencil AVERAGE rect 0: Close 0x80070057, destination changed
refused D24S8 stencil as X24_G8 AVERAGE rect 1: Close 0x80070057, destination changed
refused D24S8 stencil, rectangle to another offset MAX rect 1: Close 0x80070057, destination changed
refused D24S8 stencil subresource as R24_X8 MIN rect 0: Close 0x80070057, destination changed
refused D32S8 depth AVERAGE rect 0: Close 0x80070057, destination changed
refused D32S8 stencil AVERAGE rect 1: Close 0x80070057, destination changed
refused D32S8 stencil subresource as R32_X8X24 MAX rect 0: Close 0x80070057, destination changed

The refused loop recorded its resolve into the same list as the clears, executed the list even though Close had failed, and compared the destination with expected_planes(c, false). The layer refuses to replay a list whose recording failed (ExecuteCommandLists, d3d12_com.cpp), which is the contract docs/d3d12_vulkan.md already states: "Refused calls fail Close and record nothing". So nothing of that list runs, the destination keeps what it held before, and the readback resource the test reads it through starts zeroed (d3d12_vulkan_device.cpp). The comparison could only pass where the expected stencil was 0: the 4 stencil-less D32 refused cases passed, and all 8 refused cases with a stencil plane failed — AMD, NVIDIA and WARP alike. The host arms were never the problem: every remaining AMD difference is already classified host quirk: the host differs from the clears; the layer matches them and WARP is 71 of 71.

This checks a refused case by its Close alone (the host arm still checks that the host refuses too), treats "a mode the device lacks" the same way, drops the now meaningless run_invalid parameter of resolve_and_read, and says in docs/d3d12_vulkan.md why the destination is not compared. That an invalid list's earlier commands do not run is already measured by d3d12_queue_list_type_test ("and its earlier CopyBufferRegion did not modify the destination buffer"), so no coverage is lost.

Tested

Windows 11, RX 9070 XT (RDNA4, GFX1201), Adrenalin 26.11.2 / Vulkan 1.4.359, MSVC 19.44, RelWithDebInfo, Ninja, ctest -R 'd3d12_depth_resolve$|d3d12_typeless_depth$|d3d12_msaa_draw$':

run d3d12_depth_resolve AMD arm WARP arm
before, d083a2cc (no patch) FAIL, the 8 lines above 63 of 97 match, 18 host quirks, 7 refusals alike 71 of 71 match
after PASS 63 of 97 match, 18 host quirks, 7 refusals alike 71 of 71 match

After: 134 host comparisons matched, 12 calls were refused at Close, 0 modes the device lacks were refused; 20 edge MIN/MAX pairs differ — the same counts as before, so the fix removes only the impossible comparison. d3d12_typeless_depth passes before and after.

d3d12_msaa_draw segfaults on main before and after this patch for an unrelated reason: the slot-14 CreateDescriptorHeap wrapper reads an address/size past the 16-byte PC desc, a normal PC heap then takes the console path and GetCPUDescriptorHandleForHeapStart hands out a stack pointer. Reported as a finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117047515

Note on building: main at d083a2cc does not compile. create_console_descriptor_heap passes d->state() (a const DeviceState&) where DescriptorHeap wants DeviceState& and calls Device::identity(), which is private; d3d12_xs_device.cpp also misses the d3d12_com.h include that declares it. I built with those two lines worked around locally and neither workaround is in this pull request; the open build-fix PRs (#9873, #9941, #9867, #9978 and others) cover them.

No game data: the test writes its own resources under %TEMP%\leonida_depth_resolve_test.

AI-assisted: yes (Cline).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. — not a translator change.
**@⁠Andretuta** on GitHub · 2026-11-24 03:00 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/288) `ubiquitarianism:old-pr/10019` → `main` · +32 −27 · 2 files · 1 commits · closed without merging > Carried over from **old PR 10019** by `tugasky` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10019`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tugasky`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Claimed in the coordination issue as: [claim](https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7116798311) (the `d3d12_depth_resolve` red on Windows AMD item; the follow-up comment there corrects the first framing — this is the test's model, not the layer) Depends on: none. It conflicts with none of the open PRs; `main` itself does not compile today (see Tested), which the open build-fix PRs handle separately. ### What and why `d3d12_depth_resolve` is red on every device at `d083a2cc`, not only on AMD, with these 8 lines (the `Close 0x80070057` is the correct refusal): ``` refused D24S8 depth AVERAGE rect 1: Close 0x80070057, destination changed refused D24S8 stencil AVERAGE rect 0: Close 0x80070057, destination changed refused D24S8 stencil as X24_G8 AVERAGE rect 1: Close 0x80070057, destination changed refused D24S8 stencil, rectangle to another offset MAX rect 1: Close 0x80070057, destination changed refused D24S8 stencil subresource as R24_X8 MIN rect 0: Close 0x80070057, destination changed refused D32S8 depth AVERAGE rect 0: Close 0x80070057, destination changed refused D32S8 stencil AVERAGE rect 1: Close 0x80070057, destination changed refused D32S8 stencil subresource as R32_X8X24 MAX rect 0: Close 0x80070057, destination changed ``` The refused loop recorded its resolve into the same list as the clears, executed the list even though `Close` had failed, and compared the destination with `expected_planes(c, false)`. The layer refuses to replay a list whose recording failed (`ExecuteCommandLists`, `d3d12_com.cpp`), which is the contract `docs/d3d12_vulkan.md` already states: "Refused calls fail `Close` and record nothing". So nothing of that list runs, the destination keeps what it held before, and the readback resource the test reads it through starts zeroed (`d3d12_vulkan_device.cpp`). The comparison could only pass where the expected stencil was 0: the 4 stencil-less D32 refused cases passed, and all 8 refused cases with a stencil plane failed — AMD, NVIDIA and WARP alike. The host arms were never the problem: every remaining AMD difference is already classified `host quirk: the host differs from the clears; the layer matches them` and WARP is `71 of 71`. This checks a refused case by its `Close` alone (the host arm still checks that the host refuses too), treats "a mode the device lacks" the same way, drops the now meaningless `run_invalid` parameter of `resolve_and_read`, and says in `docs/d3d12_vulkan.md` why the destination is not compared. That an invalid list's earlier commands do not run is already measured by `d3d12_queue_list_type_test` ("and its earlier CopyBufferRegion did not modify the destination buffer"), so no coverage is lost. ### Tested Windows 11, RX 9070 XT (RDNA4, GFX1201), Adrenalin 26.11.2 / Vulkan 1.4.359, MSVC 19.44, RelWithDebInfo, Ninja, `ctest -R 'd3d12_depth_resolve$|d3d12_typeless_depth$|d3d12_msaa_draw$'`: | run | `d3d12_depth_resolve` | AMD arm | WARP arm | |---|---|---|---| | before, `d083a2cc` (no patch) | **FAIL**, the 8 lines above | 63 of 97 match, 18 host quirks, 7 refusals alike | 71 of 71 match | | after | **PASS** | 63 of 97 match, 18 host quirks, 7 refusals alike | 71 of 71 match | After: `134 host comparisons matched, 12 calls were refused at Close, 0 modes the device lacks were refused; 20 edge MIN/MAX pairs differ` — the same counts as before, so the fix removes only the impossible comparison. `d3d12_typeless_depth` passes before and after. `d3d12_msaa_draw` segfaults on `main` before and after this patch for an unrelated reason: the slot-14 `CreateDescriptorHeap` wrapper reads an address/size past the 16-byte PC desc, a normal PC heap then takes the console path and `GetCPUDescriptorHandleForHeapStart` hands out a stack pointer. Reported as a finding: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117047515 Note on building: `main` at `d083a2cc` does not compile. `create_console_descriptor_heap` passes `d->state()` (a `const DeviceState&`) where `DescriptorHeap` wants `DeviceState&` and calls `Device::identity()`, which is private; `d3d12_xs_device.cpp` also misses the `d3d12_com.h` include that declares it. I built with those two lines worked around locally and neither workaround is in this pull request; the open build-fix PRs (`#9873`, `#9941`, `#9867`, `#9978` and others) cover them. No game data: the test writes its own resources under `%TEMP%\leonida_depth_resolve_test`. AI-assisted: yes (Cline). ### Checklist - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. — not a translator change.
`resolve_and_read` executed a list whose recording failed, to model "the
layer runs what it recorded". The layer does the opposite on purpose: a
batch holding an invalid list is refused by `ExecuteCommandLists`
(d3d12_com.cpp), and docs/d3d12_vulkan.md already says a refused call
"records nothing". The destination of a refused resolve is therefore never
written, and the readback this test reads it through starts zeroed
(d3d12_vulkan_device.cpp), so the plane comparison in the refused loop
asserted the opposite of the contract: it cannot pass where the clear's
stencil is 0x5a. 8 of the 12 refused cases -- every one with a stencil
plane -- failed on every device, AMD, NVIDIA and WARP alike; the 4
stencil-less D32 cases passed only because their clear's depth is 0.0.

The refused cases now check `Close` alone (the host arm still checks that
the host refuses too), and a resolve the device cannot replay is treated
the same way: nothing is recorded, so nothing is compared. What an invalid
list does when it is executed is already measured by
`d3d12_queue_list_type_test` (its earlier CopyBufferRegion does not run).

The summary line says "calls were refused at Close" instead of "refusals
kept the destination", and docs/d3d12_vulkan.md notes why the destination
is not compared.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:52:02 +00:00
github-bot closed this pull request 2026-11-26 08:52:02 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 19:50 UTC · original

Thanks for this. Closing it as superseded: #66 (merged) fixes the same eight refused … destination changed failures in
d3d12_depth_resolve_test a different way.

  • It runs the clears, the resolve and the read-back as three separate lists, each its own batch.
  • When the layer refuses the resolve, it drops only that batch.
  • So the test can still check both that Close returns E_INVALIDARG and that the destination keeps its clears. That is
    stricter than checking Close alone.

The diagnosis here was right: the layer was correct to refuse the whole batch, and the test was wrong. The branch stays as
old-pr/10019, listed in #17. If you see a case #66 doesn't cover, please open a new PR against current main.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/288#issuecomment-7142656293) Thanks for this. Closing it as superseded: #66 (merged) fixes the same eight `refused … destination changed` failures in `d3d12_depth_resolve_test` a different way. - It runs the clears, the resolve and the read-back as three separate lists, each its own batch. - When the layer refuses the resolve, it drops only that batch. - So the test can still check both that `Close` returns `E_INVALIDARG` **and** that the destination keeps its clears. That is stricter than checking `Close` alone. The diagnosis here was right: the layer was correct to refuse the whole batch, and the test was wrong. The branch stays as `old-pr/10019`, listed in #17. If you see a case #66 doesn't cover, please open a new PR against current `main`. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.