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 on other sites

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

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 on other sites

Zero in pNumQualityLevels, not the HRESULT

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 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 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 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 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 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

Create an account

Register a new account

1. 1
2. 2
Rutin
25
3. 3
4. 4
JoeJ
18
5. 5
gaxio
11

• 14
• 22
• 11
• 11
• 9
• Forum Statistics

• Total Topics
631766
• Total Posts
3002215
×