rate up
1
rate down
Adding MSAA in DX12
Hello. I was wondering how can i add MSAA in DX12? I have read we need to create a separate MSAA render target and add it to a single swap chain but i don't know how to do that.
Chosen Answer
rate up
0
rate down
Hi Ersin07! That's a great question! Since DX12 doesn't support MSAA swap chains, this is how you can do it. 1. First, you create an MSAA render target, where samplecount is >1 (more than 1 sample). 2. You will need to create an intermediate resource with the same size and format of the MSAA resource, but with samplecount 1. 3. Render your geometry onto your MSAA render target 4. Use .[https://msdn.microsoft.com/en-us/library/windows/desktop/dn903897(v=vs.85).aspx][ID3D12GraphicsCommandList::ResolveSubresource] to resolve your MSAA render target to the intermediate resource Notice how the destination resource must be created with the .[https://msdn.microsoft.com/en-us/library/windows/desktop/ff476259(v=vs.85).aspx][D3D11_USAGE_DEFAULT] usage flag, and that it must be in the .[https://msdn.microsoft.com/en-us/library/windows/desktop/dn986744(v=vs.85).aspx][D3D12_RESOURCE_STATE_RESOLVE_DEST] state. 5. Render the intermediate resource to your swap chain buffer using a full screen quad I'm not sure if it's possible to resolve the MSAA resource directly to your swap chain render target since the destination resource of ResolveSubresource must be created with the D3D11_USAGE_DEFAULT usage flag. If anybody knows if it's possible to resolve directly to the swap chain render target please comment!
Sign in to answer!