[DX] MSAA render target support (#1043)#1236
Draft
alsepkow wants to merge 6 commits into
Draft
Conversation
Adds support for multi-sample render targets on the D3D12 backend so the
offload test suite can exercise MSAA pipelines and validate resolved
output.
* Pipeline schema: new `OutputProperties.SampleCount` (default 1) on
the render-target buffer, parsed in `Pipeline.cpp`.
* API plumbing: `TextureCreateDesc::SampleCount` and
`TraditionalRasterPipelineCreateDesc::SampleCount`;
`createDefaultDepthStencilTarget` now takes a sample-count override
so the DSV always matches the bound RT.
* DX backend:
- `createTexture` honours the sample count on RT allocations.
- `createTraditionalRasterPipeline` sets `SampleDesc.Count` and
`RasterizerState.MultisampleEnable` from the descriptor.
- `createRenderTarget` allocates a single-sample
`ResolvedRenderTarget` alongside the MSAA RT when SampleCount > 1.
- `createGraphicsCommands` issues `ResolveSubresource` with the
required `RESOLVE_SOURCE`/`RESOLVE_DEST` state transitions and
copies the resolved texture (not the MSAA RT) into the readback
buffer.
- `createDepthStencil` threads SampleCount through so depth matches.
* VK / MTL backends: ignore the new field (default 1 keeps existing
tests untouched); mesh-shader pipeline path left at SampleCount=1
since no MSAA mesh-shader caller is wired yet.
* Test: `Feature/MSAA/render-target-msaa-resolve.test` renders a
fully-covering triangle into a 2x2 4x-MSAA RT and validates the
resolved 2x2 output. UNSUPPORTED: Vulkan || Metal. XFAIL: Clang.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Picks up the DriverVer fix (upstream llvm#1228) so clang-tidy stops failing on Device.cpp. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Report 4x R32G32B32A32_FLOAT MSAA support through api-query and expose it as the MSAA_4xSamples lit feature. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes misc-const-correctness warnings-as-errors from clang-tidy in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The shared TextureCreateDesc.SampleCount field was added but VK and MTL silently ignored it. Add explicit not-supported errors so the contract is honest across backends. Tests that need MSAA already mark themselves UNSUPPORTED: Vulkan || Metal, so this guard is belt-and-suspenders. Tracks divergence concern raised in early PR review. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds D3D12 backend support for MSAA render targets. The schema gains
Pipeline.SampleCount(1, 2, 4, 8); the DX backend creates the RT with the requestedSampleCount, threads it into PSO creation, and resolves to a single-sampled staging target before readback. Vulkan parity is on the parent issue.Tests:
MSAA.4x.testexercises a triangle rendered into a 4x MSAA target with edge antialiasing visible in readback. PASS ond3d12,warp-d3d12.Remaining on parent #1043 (not in this PR):
SV_Coverage,SV_SampleIndex,Texture2DMS(Add tests for Texture2DMS #1140, Add tests for Texture2DMSArray #1141, [EPIC]: Improve rasterization tests coverage #1146).Refs #1043
Assisted by Claude Opus 4.7.