Repository navigation
Runtime: MSAA PSOs take the standard sample pattern; draws check attachment sample counts - #831
Conversation
|
Independent Windows readback at I drew the same left-hand quad twice into a 64×64 target (sample quality 0), red 200 with mask M and green 160 with mask All 18 images per path matched in every channel, covering 368,640 pixels over five paths: Leonida Vulkan on RTX 5080 and AMD Radeon Graphics, and native D3D12 on the same adapters and WARP. Both Vulkan runs had validation enabled and counted zero errors. At x = 32.5, swapping the equal-population masks Source-built fixtures only. AI-assisted verification. |
totonicpu
left a comment
There was a problem hiding this comment.
Quick heads-up on the PR diff: this branch currently includes the full M0/M1/presenter diff (README.md, docs/d3d12_vulkan.md, vulkan_present.h, d3d12_compute_test, d3d12_draw_test, d3d12_present_test) on top of an older main, which makes the MSAA-specific changes hard to isolate and will conflict with recent main.
Rebasing onto current main (or setting the PR base branch to the dependency PR if it stacks on #291) will make the MSAA PSO/draw diff much cleaner to review.
|
@totonicpu, thanks. I can't set the base to #291's branch: it lives in @Ryx69's fork, and a PR here can only target a branch of this repository. Rebasing onto
Once #291 is merged I'll rebase all four onto |
3a47c38 to
512c85d
Compare
|
Rebased all four onto #291's new head |
|
At My source-built test cleared a 4× D32 DSV to 1 and a 4× RGBA8 RTV to blue 240. Two full-screen indexed draws used z=0 and LESS. The first enabled depth writes, disabled all RTV color channels, and returned alpha 0 or 1 with the PSO sample mask shown below. The second disabled alpha-to-coverage, enabled all four samples and wrote green 160. It could color exactly those samples where the first draw had left depth at 1. I resolved the RTV and checked all 4,096 pixels.
Unlisted RGB channels were zero and resolved alpha was 255. The Vulkan layer on RTX 5080 and Radeon 1002:13c0 and native D3D12 on both adapters and WARP matched exactly in all nine cases. Zero Vulkan validation errors. Using alpha endpoints avoids assuming how a particular GPU distributes fractional alpha over its four samples. Windows 11 build 26200, NVIDIA 616.92 and AMD 26.10.1. |
512c85d to
8cbf2c2
Compare
…chment sample counts CreateGraphicsPipelineState refused every SampleDesc.Quality but 0. Native D3D12 (RX 7800 XT, a Radeon iGPU and WARP) accepts 0, D3D12_STANDARD_MULTISAMPLE_PATTERN and D3D12_CENTER_MULTISAMPLE_PATTERN and refuses 1 (past NumQualityLevels). The standard pattern is Vulkan's standard positions, so it is accepted; the centre pattern needs custom sample locations and is refused with a log until those exist. At replay every bound render target and depth target must have the PSO's sample count (D3D12 leaves a mismatch undefined, Vulkan's dynamic rendering forbids it), so a mismatched draw fails the list with invalid_subresource instead of reaching the driver. d3d12_msaa_draw_test (in ctest): 4x draws with a depth target, SampleMask 0x1 and ResolveSubresource; the quality rules; a 4x PSO into a 1x target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8cbf2c2 to
4f61715
Compare
Claimed in #634: #634 (comment)
Narrowed after rebase. Most of what this PR first did, multisampled PSOs and draws, landed on
mainin @Vonsek's 445f796. This branch is now one commit onmain003e7812with the two piecesmainstill lacks.What and why
PSO sample quality (
d3d12_vulkan_device.cpp):CreateGraphicsPipelineStaterefused everySampleDesc.Qualityexcept 0. Native D3D12 accepts the two pattern values too, measured with a standalone D3D12 program (no Leonida code), 1× and 4× RGBA8:S_OKNumQualityLevels= 1)E_INVALIDARGD3D12_STANDARD_MULTISAMPLE_PATTERNS_OKD3D12_CENTER_MULTISAMPLE_PATTERNS_OKThe standard pattern is Vulkan's standard sample positions, so it is now accepted. The resource side already accepted it, so a standard-pattern target can now be drawn with a matching PSO. The centre pattern needs custom sample locations, which is Runtime: SetSamplePositions and the centre sample pattern on VK_EXT_sample_locations #848's area, so for now it is refused with a log (
E_NOTIMPL) rather than drawn with the wrong positions.Attachment sample counts at replay (
vulkan_replay.h): every bound render target and depth target must have the PSO's count. D3D12 leaves a mismatch undefined, and Vulkan's dynamic rendering forbids it. Such a draw now fails the list withinvalid_subresourceinstead of reaching the driver.Tested
AMD Radeon RX 7800 XT (RDNA3), driver 26.10.1 (32.0.32015.7029), Windows 11 Pro (26300), MSVC 14.44, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, Ninja RelWithDebInfo,
LEONIDA_VK_VALIDATION=1:d3d12_msaa_draw_test(now in ctest,SKIP_RETURN_CODE 77), 0 validation errors:SampleMask 0x1draw andResolveSubresource. All 4,096 pixels match, and 64 edge pixels are partial.E_INVALIDARG; the standard pattern is accepted.invalid_subresource.rasterizationSamples4×.main's quality rule, the standard-pattern PSO is refused.ctest -j4102/104. The two failures ared3d12_vulkan_device(line 3403) andd3d12_draw(VUID-vkDestroyPipeline-pipeline-00765); both fail the same way on cleanmain003e7812on this machine.@Vonsek also tested alpha-to-coverage per-sample depth on the previous head (see above); that behaviour comes from
mainnow.Checklist
docs/design.md, with how it was confirmed. (N/A: runtime only.)AI-assisted (Claude Code).
🤖 Generated with Claude Code