[PR #1830] d3d12: ResolveSubresource averages a typeless resource in the format it names, and colour MIN/MAX resolves (OLD-10023, carries #292) #1843

Open
opened 2026-11-26 21:19:09 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1830
Author: @potatoe0100
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: carry/old-10023


📝 Commits (3)

  • 2ca4262 Implement Vulkan color MIN and MAX resolves
  • 6a208ad test: d3d12_vulkan_device expects a colour MAX resolve to be accepted and keeps a non-resolve mode refused
  • 158ed8c d3d12: ResolveSubresource averages a typeless resource in the format it names (sRGB in linear light)

📊 Changes

13 files changed (+911 additions, -29 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+17 -3)
📝 runtime/shims/d3d12_com.cpp (+11 -1)
📝 runtime/shims/d3d12_com.h (+5 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+28 -0)
➕ runtime/src/color_resolve.frag (+31 -0)
➕ runtime/src/color_resolve.vert (+6 -0)
➕ runtime/src/color_resolve_spv.h (+199 -0)
📝 runtime/src/command_list.h (+4 -1)
📝 runtime/src/vulkan_backend.h (+20 -0)
➕ runtime/src/vulkan_color_resolve.h (+278 -0)
📝 runtime/src/vulkan_replay.h (+177 -19)
📝 runtime/test/d3d12_msaa_draw_test.cpp (+130 -5)
📝 runtime/test/d3d12_vulkan_device_test.cpp (+5 -0)

📄 Description

Claimed in the coordination issue as: OLD-10023 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162810126)

What and why

Carries forward old-pr/10023 (draft #292) by @tedin7, rebased on main 0d80bc5df with the author's three commits:

  • colour MIN and MAX resolves implemented with a small fragment pass (vulkan_color_resolve.h, hand-written GLSL in color_resolve.vert/.frag);
  • d3d12_vulkan_device_test expects a colour MAX resolve to be accepted and still refuses a non-resolve mode;
  • ResolveSubresource averages a typeless resource in the format it names, so a typeless RGBA8 resolved as R8G8B8A8_UNORM_SRGB averages in linear light.

Rebase notes (runtime/src/vulkan_backend.h, runtime/src/vulkan_replay.h):

  • Kept main's quad-index helper next to the new colour-resolve helper, and indirect_clamp next to color_resolves in the submission slot.
  • main now asks has_helper_dispatch() where the branch listed the helper kinds inline; p.color_extremum is added there, so a colour MIN/MAX resolve still splits the statistics segments as the author's version did.
  • The new early returns use main's unsupported_at(__LINE__).

Supersedes draft #292 (its branch can be deleted once this lands).

Tested

VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8.

  • With LEONIDA_VK_VALIDATION=1: d3d12_vulkan_device, d3d12_msaa_draw and vk_sync_validation pass, 0 VUIDs.
  • Full ctest -j 6: 439 tests, all pass (xmem failed once while other builds ran at the same time and passes 3 of 3 on its own).

GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro 26H2 (build 26300)

AI-assisted: yes (Claude Code), by a non-developer tester.

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. (n/a: no translator change)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1830 **Author:** [@potatoe0100](https://github.com/potatoe0100) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/old-10023` --- ### 📝 Commits (3) - [`2ca4262`](https://github.com/ubiquitarianism/leonida/commit/2ca426248302fb472de1f11422c1e3172a47ca0e) Implement Vulkan color MIN and MAX resolves - [`6a208ad`](https://github.com/ubiquitarianism/leonida/commit/6a208ad7a0548a1d50a666727cbfab04d0c9c265) test: d3d12_vulkan_device expects a colour MAX resolve to be accepted and keeps a non-resolve mode refused - [`158ed8c`](https://github.com/ubiquitarianism/leonida/commit/158ed8c8ad35d3588aad3052be23a948647f82f8) d3d12: ResolveSubresource averages a typeless resource in the format it names (sRGB in linear light) ### 📊 Changes **13 files changed** (+911 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+17 -3) 📝 `runtime/shims/d3d12_com.cpp` (+11 -1) 📝 `runtime/shims/d3d12_com.h` (+5 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+28 -0) ➕ `runtime/src/color_resolve.frag` (+31 -0) ➕ `runtime/src/color_resolve.vert` (+6 -0) ➕ `runtime/src/color_resolve_spv.h` (+199 -0) 📝 `runtime/src/command_list.h` (+4 -1) 📝 `runtime/src/vulkan_backend.h` (+20 -0) ➕ `runtime/src/vulkan_color_resolve.h` (+278 -0) 📝 `runtime/src/vulkan_replay.h` (+177 -19) 📝 `runtime/test/d3d12_msaa_draw_test.cpp` (+130 -5) 📝 `runtime/test/d3d12_vulkan_device_test.cpp` (+5 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-10023 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7162810126) ### What and why Carries forward `old-pr/10023` (draft #292) by @tedin7, rebased on `main` `0d80bc5df` with the author's three commits: - colour `MIN` and `MAX` resolves implemented with a small fragment pass (`vulkan_color_resolve.h`, hand-written GLSL in `color_resolve.vert/.frag`); - `d3d12_vulkan_device_test` expects a colour `MAX` resolve to be accepted and still refuses a non-resolve mode; - `ResolveSubresource` averages a typeless resource in the format it names, so a typeless RGBA8 resolved as `R8G8B8A8_UNORM_SRGB` averages in linear light. Rebase notes (`runtime/src/vulkan_backend.h`, `runtime/src/vulkan_replay.h`): - Kept `main`'s quad-index helper next to the new colour-resolve helper, and `indirect_clamp` next to `color_resolves` in the submission slot. - `main` now asks `has_helper_dispatch()` where the branch listed the helper kinds inline; `p.color_extremum` is added there, so a colour MIN/MAX resolve still splits the statistics segments as the author's version did. - The new early returns use `main`'s `unsupported_at(__LINE__)`. Supersedes draft #292 (its branch can be deleted once this lands). ### Tested VS 2022 (MSVC 19.44) RelWithDebInfo + Ninja, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8. - With `LEONIDA_VK_VALIDATION=1`: `d3d12_vulkan_device`, `d3d12_msaa_draw` and `vk_sync_validation` pass, 0 VUIDs. - Full `ctest -j 6`: 439 tests, all pass (`xmem` failed once while other builds ran at the same time and passes 3 of 3 on its own). GPUs tested: NVIDIA GeForce RTX 4060, driver 621.14, Windows 11 Pro 26H2 (build 26300) AI-assisted: yes (Claude Code), by a non-developer tester. ### 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. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1843
No description provided.