d3d12: color MIN and MAX resolves for typed 2D resources #240

Closed
Andretuta wants to merge 2 commits from upstream-pr/240 into main
Andretuta commented 2026-11-24 02:51:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:51:17Z.


Carried over from old PR 9971 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9971, 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.
tedin7: 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):

What

Vulkan color D3D12_RESOLVE_MODE_MIN / MAX resolves for typed 2D resources (ResolveSubresourceRegion). The replay now runs a small fullscreen pass (runtime/src/color_resolve.vert/.frag, SPIR-V checked in as color_resolve_spv.h, driver vulkan_color_resolve.h) that takes the per-channel min or max over the samples of the source. AVERAGE and the existing depth/stencil path are unchanged. A mode that is not a colour resolve at all (for example ENCODE_SAMPLER_FEEDBACK, value 4) is still refused at Close with E_INVALIDARG.

Why

Before this, a command list with a colour MIN or MAX resolve failed at ExecuteCommandLists ("invalid copy or resolve; nothing was submitted"), so any frame that records one is dropped whole. That is a first-frame blocker for titles that use these modes.

Rebased cleanly on current main; supersedes #8685 closed during org migration.

Tested

Built locally with clang-cl-19 + xwin and run under Wine 10 on lavapipe (llvmpipe, LLVM 19.1.7). No GPU pod: all pods are off.

  • d3d12_msaa_draw_test: exit 0 with the fix. Output: "MSAA: 4x draws resolved, 4096 pixels matched; 64 of 189 edge pixels are partial". New checks: a 4x target with only sample 0 written resolves to {0,0,0,255} under MIN and {0,255,255,255} under MAX inside the 8x8 rect, and to the 1:3 mix under AVERAGE, all 64 pixels x 3 modes compared byte for byte with a read-back.
  • Negative control (same two test files on origin/main code): d3d12_msaa_draw_test exits 1 at line 296: list->Close() == S_OK; d3d12_vulkan_device_test exits 1 at its new line 6280 list->Close() == S_OK (colour MAX resolve).
  • d3d12_vulkan_device_test: passes the new MAX-accepted and mode-4-refused checks, then stops at line 6581 (tiles == 1, GetResourceTiling on llvmpipe). The same line 6581 failure occurs on main without my change.
  • d3d12_depth_resolve_test and d3d12_view_slices_test exit 1 on llvmpipe both with and without this change; their full output is line for line identical (47 lines; view_slices "6 failures" on both). No regression, but not a clean pass either.

Not verified

  • No real GPU run (pods off); only llvmpipe.
  • At test time main did not compile (console descriptor heap, known; #9809 / #9815 fix it). For the runs I applied a throwaway local patch to those two shim files in a scratch tree; it is not in this PR. I rebased onto the latest main afterwards without rebuilding.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465163754 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/240). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:51:17Z. --- > Carried over from **old PR 9971** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9971`, 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. > `tedin7`: 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): ## What Vulkan color `D3D12_RESOLVE_MODE_MIN` / `MAX` resolves for typed 2D resources (`ResolveSubresourceRegion`). The replay now runs a small fullscreen pass (`runtime/src/color_resolve.vert/.frag`, SPIR-V checked in as `color_resolve_spv.h`, driver `vulkan_color_resolve.h`) that takes the per-channel min or max over the samples of the source. AVERAGE and the existing depth/stencil path are unchanged. A mode that is not a colour resolve at all (for example ENCODE_SAMPLER_FEEDBACK, value 4) is still refused at Close with E_INVALIDARG. ## Why Before this, a command list with a colour MIN or MAX resolve failed at `ExecuteCommandLists` ("invalid copy or resolve; nothing was submitted"), so any frame that records one is dropped whole. That is a first-frame blocker for titles that use these modes. Rebased cleanly on current main; supersedes `#8685` closed during org migration. ## Tested Built locally with clang-cl-19 + xwin and run under Wine 10 on lavapipe (llvmpipe, LLVM 19.1.7). No GPU pod: all pods are off. - `d3d12_msaa_draw_test`: exit 0 with the fix. Output: "MSAA: 4x draws resolved, 4096 pixels matched; 64 of 189 edge pixels are partial". New checks: a 4x target with only sample 0 written resolves to {0,0,0,255} under MIN and {0,255,255,255} under MAX inside the 8x8 rect, and to the 1:3 mix under AVERAGE, all 64 pixels x 3 modes compared byte for byte with a read-back. - Negative control (same two test files on origin/main code): `d3d12_msaa_draw_test` exits 1 at `line 296: list->Close() == S_OK`; `d3d12_vulkan_device_test` exits 1 at its new line 6280 `list->Close() == S_OK` (colour MAX resolve). - `d3d12_vulkan_device_test`: passes the new MAX-accepted and mode-4-refused checks, then stops at line 6581 (`tiles == 1`, GetResourceTiling on llvmpipe). The same line 6581 failure occurs on main without my change. - `d3d12_depth_resolve_test` and `d3d12_view_slices_test` exit 1 on llvmpipe both with and without this change; their full output is line for line identical (47 lines; view_slices "6 failures" on both). No regression, but not a clean pass either. ## Not verified - No real GPU run (pods off); only llvmpipe. - At test time main did not compile (console descriptor heap, known; `#9809` / `#9815` fix it). For the runs I applied a throwaway local patch to those two shim files in a scratch tree; it is not in this PR. I rebased onto the latest main afterwards without rebuilding.
OreoFR commented 2026-11-29 17:02:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T17:02:49Z.


@tedin7 this carried-over PR (your old PR 9971) now conflicts with main (runtime/src/vulkan_backend.h, runtime/src/vulkan_replay.h). Could you merge main into it, by pushing to its branch or in your own PR from it (no force-push needed)? If there's no update within 24 h, OreoFR may carry it in a new PR that keeps you as co-author (per the maintainers' plan). — OreoFR's agent (AI-assisted)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7259377691 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/240#issuecomment-7259377691). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T17:02:49Z. --- @tedin7 this carried-over PR (your old PR 9971) now conflicts with `main` (`runtime/src/vulkan_backend.h`, `runtime/src/vulkan_replay.h`). Could you merge `main` into it, by pushing to its branch or in your own PR from it (no force-push needed)? If there's no update within 24 h, OreoFR may carry it in a new PR that keeps you as co-author (per the maintainers' plan). — OreoFR's agent (AI-assisted)
MoonEyes commented 2026-11-30 13:59:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T13:59:15Z.


Closing this draft as superseded by #1830 (open, by potatoe0100): compared line by line, 3 of the 628 lines this head (95c52eed8) adds are missing there, in the same files. Nothing here is judged wrong, and a conflict is not the reason. Please reopen it if #1830 does not land or leaves something out.

AI-assisted (Claude Code). Closed at the owner's request (MoonEyes), superseded pull requests being fine to close (aslan2142).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7280661969 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/240#issuecomment-7280661969). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T13:59:15Z. --- Closing this draft as superseded by #1830 (open, by potatoe0100): compared line by line, 3 of the 628 lines this head (`95c52eed8`) adds are missing there, in the same files. Nothing here is judged wrong, and a conflict is not the reason. Please reopen it if #1830 does not land or leaves something out. AI-assisted (Claude Code). Closed at the owner's request (MoonEyes), superseded pull requests being fine to close (aslan2142).

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!240
No description provided.