Jump to content
  • Advertisement
Sign in to follow this  
DarkRonin

8x FSAA not working on render targets

This topic is 1032 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

 

I have render targets working nicely in my game, but I cant figure out how to make the render target render at 8x FSAA like the back buffer is doing.

 

Here is a screenshot of my scene. The left is a render target rendered at full screen to the back buffer and the right side is the same sphere model rendered direct to the back buffer right after the render target draw.

 

XbdASTT.png

 

As you can see, the render target is getting no FSAA softening. Where the model on the right is.

 

I tried matching the render target texture desc to the back buffer like this

 

textureDesc.SampleDesc.Count = 8;

 

But this results in a crash, which for some reason is being caused by a NULL pointer in the vertex shader for the render target, which only happens when the 'Count' is not equal to 1.

 

Any advice on how to make the render target receive FSAA / MSAA would be awesome.

 

Thanks in advance :)

 

 

 

Share this post


Link to post
Share on other sites
Advertisement
Certainly is. The image above is the draw of the render target being dawn to the back buffer and then another drawing of the model on top (the right hand side is the second draw).

Share this post


Link to post
Share on other sites

He means when the sample count is set to 8, obviously.

 
Sorry, wasn't so obvious to me.
 
The render target creation actually does fail if I set textureDesc.SampleDesc.Count = 8
 
D3D11_TEXTURE2D_DESC textureDesc;
 
ZeroMemory(&textureDesc, sizeof(textureDesc));
textureDesc.Width = nWidth;
textureDesc.Height = nHeight;
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;//DXGI_FORMAT_R32G32B32A32_FLOAT;// DXGI_FORMAT_R8G8B8A8_UNORM;
textureDesc.SampleDesc.Count = 8;
textureDesc.SampleDesc.Quality = 0;
textureDesc.Usage = D3D11_USAGE_DEFAULT;
textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
textureDesc.CPUAccessFlags = 0;
textureDesc.MiscFlags = 0;
Does anything look wrong with how I am setting up the texture description?

The texture creation call succeeds but the CreateRenderTargetView() fails.

Thanks again. Edited by DarkRonin

Share this post


Link to post
Share on other sites
Oooh. I just worked it out.

I needed to specify D3D11_RTV_DIMENSION_TEXTURE2DMS instead of D3D11_RTV_DIMENSION_TEXTURE2D.

Thanks for guiding me in the right direction smile.png

Share this post


Link to post
Share on other sites

You will probably find that what you also want to do is use ResolveSubResource() to copy the MSAA texture to a normal one to read it back with. If you don't do that you may get some weird looking results as you will be reading back individual samples.

 

If you're doing that I'd also drop the D3D11_BIND_SHADER_RESOURCE flag from the MSAA version to make sure you don't try and use it directly. Making an MSAA render target a shader resource is also not supported on a D3DFEATURE_LEVEL_9_* device.

Share this post


Link to post
Share on other sites

Thanks for the advice Adam.

 

I'm not getting any weird graphical results as such, but I am getting some pretty nasty warnings and errors in the debug pane that I am working through. ResolveSubResource() looks like it might be the answer to those though.

 

Thanks for the heads up smile.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!