OLD-9971: colour MIN and MAX resolves for typed 2D resources (carries #240) #1184

Closed
github-bot wants to merge 2 commits from gh-pr/1184/head into gh-pr/1184/base
Owner

@⁠TimIdle on GitHub · 2026-11-24 19:48 UTC · original
TimIdle:oldpr-9971-color-minmax → main · +730 −11 · 12 files · 2 commits · closed without merging

Claimed in the coordination issue as: OLD-9971 (claim)

What and why

This carries forward old-pr/9971 by @⁠tedin7 (draft #240). The two commits are cherry-picked onto main unchanged, with tedin7 kept as author.

main serves ResolveSubresourceRegion with D3D12_RESOLVE_MODE_MIN and MAX for depth only. A colour MIN or MAX resolve is refused, so the list fails at Close. Core Vulkan has no colour min or max resolve, so this adds a small fragment-shader resolve (runtime/src/vulkan_color_resolve.h, color_resolve.frag) for typed 2D colour resources, recorded in the replay. docs/d3d12_vulkan.md gets the note.

Tested

Native Windows 11 10.0.26300, MSVC 19.44, RelWithDebInfo, LEONIDA_REQUIRE_VULKAN=ON, on main 42537e7 plus the two commits.

Check Result
d3d12_msaa_draw_test with the fix pass (MIN and MAX compared pixel by pixel with the expected extremes, AVERAGE with the 1:3 mix)
d3d12_msaa_draw_test with main's shims and replay fail: line 296: list->Close() == S_OK (measured on 6293c1c, not rerun after this rebase)
d3d12_vulkan_device_test with the fix pass
d3d12_vulkan_device_test with main's shims and replay fail: line 6291: list->Close() == S_OK (measured on 6293c1c, not rerun after this rebase)
full ctest -j 6 401 of 402 passed, gameinput and gameinput_script disabled. The one failure is d3d12_depth_stencil_uav, a segmentation fault after 304 s in the first run after the build, under -j 6 load. Run alone, it passes 3 of 3 in about 6 s. This PR does not touch that code.

GPUs tested: NVIDIA GeForce RTX 2050 (Ampere GA107, laptop), driver 621.24, Windows 11

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • 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. (No translator rule here.)

🤖 Generated with Claude Code

**@⁠TimIdle** on GitHub · 2026-11-24 19:48 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184) `TimIdle:oldpr-9971-color-minmax` → `main` · +730 −11 · 12 files · 2 commits · closed without merging Claimed in the coordination issue as: OLD-9971 ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)) ### What and why This carries forward `old-pr/9971` by @⁠tedin7 (draft #240). The two commits are cherry-picked onto `main` unchanged, with tedin7 kept as author. `main` serves `ResolveSubresourceRegion` with `D3D12_RESOLVE_MODE_MIN` and `MAX` for depth only. A colour MIN or MAX resolve is refused, so the list fails at `Close`. Core Vulkan has no colour min or max resolve, so this adds a small fragment-shader resolve (`runtime/src/vulkan_color_resolve.h`, `color_resolve.frag`) for typed 2D colour resources, recorded in the replay. `docs/d3d12_vulkan.md` gets the note. ### Tested Native Windows 11 10.0.26300, MSVC 19.44, RelWithDebInfo, `LEONIDA_REQUIRE_VULKAN=ON`, on `main` `42537e7` plus the two commits. | Check | Result | |---|---| | `d3d12_msaa_draw_test` with the fix | pass (MIN and MAX compared pixel by pixel with the expected extremes, AVERAGE with the 1:3 mix) | | `d3d12_msaa_draw_test` with `main`'s shims and replay | fail: `line 296: list->Close() == S_OK` (measured on `6293c1c`, not rerun after this rebase) | | `d3d12_vulkan_device_test` with the fix | pass | | `d3d12_vulkan_device_test` with `main`'s shims and replay | fail: `line 6291: list->Close() == S_OK` (measured on `6293c1c`, not rerun after this rebase) | | full `ctest -j 6` | 401 of 402 passed, `gameinput` and `gameinput_script` disabled. The one failure is `d3d12_depth_stencil_uav`, a segmentation fault after 304 s in the first run after the build, under `-j 6` load. Run alone, it passes 3 of 3 in about 6 s. This PR does not touch that code. | GPUs tested: NVIDIA GeForce RTX 2050 (Ampere GA107, laptop), driver 621.24, Windows 11 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator rule here.) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:41:58 +00:00
github-bot closed this pull request 2026-11-26 09:41:58 +00:00
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:09 UTC · original

Recommendation: [WAIT]

Reasoning: Carries #240: adds a fragment-shader path for colour MIN/MAX ResolveSubresourceRegion on typed 2D resources, which core Vulkan lacks; such resolves currently fail at Close. It's a sizeable new runtime path (+730 across 12 files), including a checked-in precompiled color_resolve_spv.h. No reviews or independent runs yet. Before merging, confirm the SPIR-V header regenerates byte-identical from color_resolve.frag/.vert, and get one independent GPU run of the resolve tests. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main.

Impact level: 6/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184#issuecomment-7143115793) **Recommendation:** [WAIT] **Reasoning:** Carries #240: adds a fragment-shader path for colour MIN/MAX `ResolveSubresourceRegion` on typed 2D resources, which core Vulkan lacks; such resolves currently fail at `Close`. It's a sizeable new runtime path (+730 across 12 files), including a checked-in precompiled `color_resolve_spv.h`. No reviews or independent runs yet. Before merging, confirm the SPIR-V header regenerates byte-identical from `color_resolve.frag/.vert`, and get one independent GPU run of the resolve tests. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. **Impact level:** 6/10
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 20:10 UTC · original

Tested cbd9350ab on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan):

  • d3d12_vulkan_device: Passed (7.79 s)
  • d3d12_msaa_draw: Passed (5.58 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 20:10 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184#issuecomment-7143140569) Tested `cbd9350ab` on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan): - `d3d12_vulkan_device`: **Passed** (7.79 s) - `d3d12_msaa_draw`: **Passed** (5.58 s) AI-assisted: yes
Author
Owner

@⁠TimIdle on GitHub · 2026-11-25 00:12 UTC · original

@⁠Deedlyy I checked color_resolve_spv.h against the sources with the command in its header comment, using glslangValidator 16.6.0 from Vulkan SDK 1.4.363.0.

  • Vertex: byte-identical, 262 words.
  • Float, uint and sint fragment: not byte-identical. Each module built here is 4 words longer. spirv-dis shows one difference. The checked-in modules load source_image once before the sample loop, and 16.6.0 loads it again inside the loop. Everything else is the same, and the three checked-in modules pass spirv-val --target-env vulkan1.1.

So the header most likely came from another glslang version, and the shaders do the same work. If you want it to match the current SDK exactly, I can regenerate it in this PR.

@⁠madhyn thank you for the Wine run on the RTX 3060 Ti.

**@⁠TimIdle** on GitHub · 2026-11-25 00:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184#issuecomment-7148267457) @⁠Deedlyy I checked `color_resolve_spv.h` against the sources with the command in its header comment, using glslangValidator 16.6.0 from Vulkan SDK 1.4.363.0. - Vertex: byte-identical, 262 words. - Float, uint and sint fragment: not byte-identical. Each module built here is 4 words longer. `spirv-dis` shows one difference. The checked-in modules load `source_image` once before the sample loop, and 16.6.0 loads it again inside the loop. Everything else is the same, and the three checked-in modules pass `spirv-val --target-env vulkan1.1`. So the header most likely came from another glslang version, and the shaders do the same work. If you want it to match the current SDK exactly, I can regenerate it in this PR. @⁠madhyn thank you for the Wine run on the RTX 3060 Ti.
Author
Owner

@⁠TimIdle on GitHub · 2026-11-25 06:37 UTC · original

Rebased onto main 42537e7. main now has an indexed quad-list expansion pass, so vulkan_replay.h checks helper dispatches through has_helper_dispatch. The colour MIN and MAX resolve is a helper dispatch too, so p.color_extremum now sits in that function and both statistics splits still see it. In vulkan_backend.h the colour resolve hook stays next to main's quad index hook. On the RTX 2050 d3d12_msaa_draw_test and d3d12_vulkan_device_test pass. The full ctest is 401 of 402. The one failure, d3d12_depth_stencil_uav, crashed once under parallel load and passes 3 of 3 alone.

**@⁠TimIdle** on GitHub · 2026-11-25 06:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184#issuecomment-7154991144) Rebased onto `main` `42537e7`. `main` now has an indexed quad-list expansion pass, so `vulkan_replay.h` checks helper dispatches through `has_helper_dispatch`. The colour MIN and MAX resolve is a helper dispatch too, so `p.color_extremum` now sits in that function and both statistics splits still see it. In `vulkan_backend.h` the colour resolve hook stays next to `main`'s quad index hook. On the RTX 2050 `d3d12_msaa_draw_test` and `d3d12_vulkan_device_test` pass. The full `ctest` is 401 of 402. The one failure, `d3d12_depth_stencil_uav`, crashed once under parallel load and passes 3 of 3 alone.
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-25 17:14 UTC · original

Thanks! #1830 contains these two commits unchanged plus the typeless ResolveSubresource commit (#292), and it currently merges cleanly while this one conflicts, so this one may be superseded; maintainers can decide.

AI-assisted: yes (Claude Code compared the diffs against origin/main; I reviewed it).

**@⁠MoonEyes** on GitHub · 2026-11-25 17:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184#issuecomment-7169222070) Thanks! #1830 contains these two commits unchanged plus the typeless ResolveSubresource commit (#292), and it currently merges cleanly while this one conflicts, so this one may be superseded; maintainers can decide. AI-assisted: yes (Claude Code compared the diffs against origin/main; I reviewed it).
Author
Owner

@⁠TimIdle on GitHub · 2026-11-26 04:16 UTC · original

Thanks for checking. I compared both branches. The test commit is identical, and the implementation commit adds and removes the same lines as mine, only the hunk positions differ since each one sits on a different main.

#1830 also has #292 and merges clean, so it already covers this. I'll close this one in favour of #1830 so the maintainers don't review the same change twice.

The RTX 2050 proof here still applies to it: on main d3d12_msaa_draw fails at line 296 and d3d12_vulkan_device at line 6291, both pass with the fix.

AI-assisted: yes (Claude Code compared the commits by patch content).

**@⁠TimIdle** on GitHub · 2026-11-26 04:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1184#issuecomment-7182449895) Thanks for checking. I compared both branches. The test commit is identical, and the implementation commit adds and removes the same lines as mine, only the hunk positions differ since each one sits on a different main. #1830 also has #292 and merges clean, so it already covers this. I'll close this one in favour of #1830 so the maintainers don't review the same change twice. The RTX 2050 proof here still applies to it: on main d3d12_msaa_draw fails at line 296 and d3d12_vulkan_device at line 6291, both pass with the fix. AI-assisted: yes (Claude Code compared the commits by patch content).

Pull request closed

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