Jump to content
  • Advertisement
Sign in to follow this  
matt77hias

DXGI_FORMAT_R16G16B16A16_FLOAT and multi sampling

Recommended Posts

MSDN says that FEATURE_LEVEL_10_1 devices are required to support 4x MSAA for all render targets except R32G32B32A32 and R32G32B32.  FEATURE_LEVEL_11_0 devices are required to support 4x MSAA for all render target formats, and 8x MSAA for all render target formats except R32G32B32A32 formats.

So why do I obtain a 0 result (i.e. the format and sample count combination is not supported for the installed adapter)?

const HRESULT result = device->CheckMultisampleQualityLevels(
               DXGI_FORMAT_R16G16B16A16_FLOAT, texture_desc.SampleDesc.Count,
                &texture_desc.SampleDesc.Quality);
ThrowIfFailed(result, "Texture 2D creation failed: %08X.", result);
if (result == 0u) {
      // Why?
}
 --texture_desc.SampleDesc.Quality;

 

Share this post


Link to post
Share on other sites
Advertisement

0 is the value of S_OK, which means format supports your MSAA configuration. Failing HRESULTS all have negative values.

Share this post


Link to post
Share on other sites
1 hour ago, MJP said:

0 is the value of S_OK, which means format supports your MSAA configuration. Failing HRESULTS all have negative values.

In all other cases, this is true. But MSDN says explicitly that if 0 is returned the combination of the format and sample count is not supported.

If I let the code run further, I won't able to create the texture resource.

Share this post


Link to post
Share on other sites

Apparently (besides my misinterpretation) the failure is due to descriptor which specifies SRV, RTV and UAV. It doesn't work for UAV.

Share this post


Link to post
Share on other sites

I think there is a misunderstanding here, the multisampling of the requested format is not available when the output parameter pNumQualityLevels is zero when the function returns. The HRESULT value which the function returns should still be zero. 

This is a snippet from a code I use to create a multisampled texture2d with the max quality level supported:

if ((*ppTexture2D)->desc.SampleDesc.Count > 1)
{
	UINT quality;
	device->CheckMultisampleQualityLevels(_ConvertFormat((*ppTexture2D)->desc.Format), (*ppTexture2D)->desc.SampleDesc.Count, &quality);
	(*ppTexture2D)->desc.SampleDesc.Quality = quality - 1;
	if (quality == 0)
	{
		assert(0 && "MSAA Samplecount not supported!");
		(*ppTexture2D)->desc.SampleDesc.Count = 1;
	}
}

 

Edited by turanszkij

Share this post


Link to post
Share on other sites

But is it possible to create a multi sampled UAV?

If not, this forces my deferred shading to go back to the rendering (instead of compute) pipeline. It doesn't make sense for deferred, but my deferred is a hybrid anyway so for forward parts this is ok. Furthermore, MSAA can be boosted to SSAA with irregular samples by using SV_SampleIndex.

Edited by matt77hias

Share this post


Link to post
Share on other sites

What is numlevel in your case. I usually keep quality level to zero ( but don't use msaa much at work sadly and did not msaa in a long time ). 

Hardware like GCN have features to do MSAA but dropping some fragments ( like 4x but only memory for 2 fragments ) and need very custom compute resolve. This is on console, PC don't expose that, but the quality level may and then make UAV undefined if != 0

Share this post


Link to post
Share on other sites
11 minutes ago, galop1n said:

What is numlevel in your case. I usually keep quality level to zero ( but don't use msaa much at work sadly and did not msaa in a long time ). 

Hardware like GCN have features to do MSAA but dropping some fragments ( like 4x but only memory for 2 fragments ) and need very custom compute resolve. This is on console, PC don't expose that, but the quality level may and then make UAV undefined if != 0

I obtain 1, so 0 after subtraction.

MSDN mentions: An unordered access view (UAV) is a view of an unordered access resource (which can include buffers, textures, and texture arrays, though without multi-sampling). This is a joke right? Or am I misinterpreting?

Share this post


Link to post
Share on other sites

It is a slight bummer. But I now use the rendering instead of compute pipeline for deferred MSAA (treating it as SSAA by using SV_SampleIndex). If you want fast deferred, use FXAA ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
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!