mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:25:53 +01:00
[PR #1014] [CLOSED] Runtime: sample a typeless colour texture's multisample SRV #1052
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#1052
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/1014
Author: @roanh47
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:pr/msaa-typeless📝 Commits (1)
abfe559Runtime: sample a typeless colour texture's multisample SRV📊 Changes
4 files changed (+563 additions, -5 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+7 -2)📝
runtime/CMakeLists.txt(+19 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+34 -3)➕
runtime/test/d3d12_msaa_typeless_srv_test.cpp(+503 -0)📄 Description
Claim: RT-MSAA-TYPELESS-SRV
Builds on the merged multisampled SRV binding (
88dc8beac, "Runtime: bind multisampled 2D and array shader-resource views"). No game data.Log source
runtime/shims/d3d12_vulkan_device.cpp, the multisample SRV refusal inimage_descriptor:The check required the texture's storage format to be typed (
!format.typeless) and the view's format to equal theresource's, so every typeless colour texture was refused, although D3D12 requires an SRV of a typeless resource to
name a concrete member of the texture's typeless family. No legal MSAA SRV of such a texture existed.
Changes
runtime/shims/d3d12_vulkan_device.cppimage_descriptor: an MSAA SRV of a typeless colour texture now resolves the concrete SRV format from thetexture's own typeless family (
format_family), and is refused only when the view names no format (UNKNOWN), atypeless format, another family's format, or one that does not map to a GFX10 format. The generic path then
writes the T# for the named format, as the typed MSAA path already did.
DeviceState::multisample_sampleable(): refuses a view format the GPU does not sample at the texture'ssample count, with
vkGetPhysicalDeviceImageFormatPropertiesand the usages a multisampled colour texture iscreated with (colour attachment, sampled, transfer source/destination).
multisample shader view requires a colour texture); typed MS textures keep the original message. Every refusal still leaves a null descriptor.runtime/test/d3d12_msaa_typeless_srv_test.cpp,runtime/CMakeLists.txt: a new GPU test, ctestd3d12_msaa_typeless_srv.docs/d3d12_vulkan.md: describes the typeless colour resolution and takes "typeless color SRVs" off thedescriptor-path gap list.
Test
Synthetic fixtures only, no game data.
d3d12_msaa_typeless_srv_testcreates a 4x4, 4xR8G8B8A8_TYPELESSrendertarget, clears it to blue through an
R8G8B8A8_UNORMRTV, draws a red triangle over the half above the diagonal anda green quad over the bottom-right quadrant with PSO
SampleMask 0x1, and creates its SRV withFormat = R8G8B8A8_UNORM. It checks the T# decodes to the same image as the default SRV of a typedR8G8B8A8_UNORM4x twin (format, type, width, height, layers, samples; the image address is the only difference),then a compute shader (
cs_sample.comp -DTEST_MS_FLOAT=1) looks the T# up in set 0's hash table and reads all foursamples of the 4x4 image: red where the triangle covers every sample, blue where the clear shows through, green in
sample 0 of the masked quad, and red-or-blue (never green) on the diagonal's partially covered pixels.
Negative cases assert null descriptors for: a typeless view format,
UNKNOWNon a typeless texture, anotherfamily's format, a single-sample view of the 4x texture, a foreign format on a typed MS texture, and an MS view of an
R32G8X24_TYPELESSdepth texture.With the previous shim the test fails:
With the change (MSVC 14.44 / Visual Studio 2022 Build Tools, Ninja,
RelWithDebInfo,LEONIDA_VK_VALIDATION=1):Related suites, same build and validation layer:
python -I scripts/check_no_game_data.py runtime/shims/d3d12_vulkan_device.cpp runtime/CMakeLists.txt runtime/test/d3d12_msaa_typeless_srv_test.cpp docs/d3d12_vulkan.mdexits 0.Note on the logged format (19)
19isDXGI_FORMAT_R32G8X24_TYPELESS, whose family is depth-stencil (texture_storage_formatmaps it to aD32_SFLOAT_S8_UINTimage either way), so the exact retail line describes a multisampled depth SRV, not a colourone. This PR implements the typeless colour resolution the claim describes; that depth view stays refused and is now
logged as
multisample shader view requires a colour texture: 19. The limit is not the format:D32_SFLOAT_S8_UINTis 4x-sampleable here (
vkGetPhysicalDeviceImageFormatProperties), but multisampled depth/stencil SRVs and theimage_msaa_loadlowering translated shaders would need are a documented gap (docs/d3d12_vulkan.md, descriptorpath), so supporting the depth case is left rather than faked.
GPU / driver
NVIDIA GeForce RTX 3070 (8 GiB), NVIDIA driver 610.88 on Windows, Vulkan 1.4.363 SDK.
AI-assisted: DeepSeek v4.1 Flash 1017.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.