mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #292] d3d12: ResolveSubresource averages a typeless resource in the format it names (sRGB in linear light) #344
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#344
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/292
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/10023📝 Commits (3)
ab27482Implement Vulkan color MIN and MAX resolves95c52eetest: d3d12_vulkan_device expects a colour MAX resolve to be accepted and keeps a non-resolve mode refused9b9679ed3d12: ResolveSubresource averages a typeless resource in the format it names (sRGB in linear light)📊 Changes
13 files changed (+911 additions, -30 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 -20)📝
runtime/test/d3d12_msaa_draw_test.cpp(+130 -5)📝
runtime/test/d3d12_vulkan_device_test.cpp(+5 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Stacked on
#9971This PR is based on
#9971(colour MIN/MAX resolves): both changeprepare_resolveinruntime/src/vulkan_replay.handd3d12_msaa_draw_test.cpp. Until#9971merges, this diff also shows its 3 commits; the only new commit is the last one (d3d12: ResolveSubresource averages a typeless resource in the format it names). Review that commit alone, or wait for#9971and I will rebase.What
ResolveSubresourcecarries itsFormatto the replay (aFormatfield incommand_list.h, set only when a resource is typeless). The replay views both images in that format and resolves in a rendering scope (colour attachment, AVERAGE), so sRGB is averaged in linear light. Needs ALLOW_RENDER_TARGET on both resources, otherwise refused as before.Why
The Format was dropped, so a typeless 4x RGBA8 resolved "as R8G8B8A8_UNORM_SRGB" was averaged as UNORM with no error, giving wrong colours; and a typeless source into a typed sRGB destination was refused in
prepare_resolve(the Vulkan formats differ) and failed the whole command list, so the frame was dropped. Both are common for swapchain-style typeless render targets.Rebased cleanly on current main; supersedes
#8685's sibling work that lived only on my fork (ship-resolve-format, never opened here). The conflict with#9971inprepare_resolvewas resolved by keeping both paths: the MIN/MAX path now also requires equal source and destination formats (the check the old line had), and the typeless view path runs after it.Tested
Local clang-cl-19 + xwin build, Wine 10 on lavapipe (llvmpipe). No GPU pod (all off).
d3d12_msaa_draw_testexit 0. Pixel of a 4-sample quadrant, with R/G/B/A: typeless to typeless as sRGB 0,137,225,255; typeless to typed sRGB 0,137,225,255; typeless as UNORM 0,64,191,255, all equal to the wanted values; the earlier 4096-pixel MSAA match and the MIN/MAX checks of#9971still pass.#9971's code, without this commit): exit 1 atline 401: last_execute_result(queue.p) == ReplayResult::success, i.e. the list is refused.d3d12_vulkan_device_test: same single failure as on main, line 6581 (tiles == 1, llvmpipe tiling), nothing new.Not verified
#9809/#9815fix it). A throwaway local patch of those shim lines was used and is not in this PR. I did not rebuild after the last small main updates.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.