Justin R.
Justin R.

Reputation: 24021

Enabling antialiasing in Windows Store Apps

I have a D3D11 application for Windows Store that currently does not use antialiasing, and I would like to enable it.

According to MSDN, MSAA is disabled in Windows Store apps:

DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL
Use this flag to specify the flip presentation model and to specify that DXGI persist the contents of the back buffer after you call IDXGISwapChain1::Present1. This flag cannot be used with multisampling.
Note Windows Store apps must use DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL.

Because this limitation applies only to the back buffer, it sounds like the best workaround is to create a new off-screen render target, enable MSAA on that, render everything to it, and immediately before Present, blit the off-screen target to the back buffer (probably with ResolveSubresource).

I've started implementing this, but I'm not sure how to modify my swap chain and render target view. Can anybody advise me as to the correct order of operations here?

Upvotes: 1

Views: 740

Answers (1)

davidleonardcook
davidleonardcook

Reputation: 91

What you suggest is correct. Create an MSAA render target using CreateTexture2D followed by CreateRenderTargetView. The DXGI_SAMPLE_DESC field of D3D11_TEXTURE2D_DESC contains the MSAA settings. Then render your scene to this render target, and ResolveSubresource into the back buffer. The swap chain doesn't need to change.

Upvotes: 2

Related Questions