D3D12: Fixed initial state for MSAA render target.

This commit is contained in:
Branimir Karadžić 2018-05-04 16:35:59 -07:00
parent dcb156b192
commit 724f9829b4
2 changed files with 34 additions and 1 deletions

View File

@ -252,13 +252,21 @@ namespace bgfx
if (1 == result)
{
result = nvAftermathDx12CreateContextHandle(_commandList, &m_aftermathHandle);
BX_WARN(1 == result, "%x", result);
BX_WARN(1 == result, "NV Aftermath: nvAftermathDx12CreateContextHandle failed %x", result);
if (1 == result)
{
return true;
}
}
else
{
switch (result)
{
case int32_t(0xbad0000a): BX_TRACE("NV Aftermath: Debug layer not compatible with Aftermath."); break;
default: BX_TRACE("NV Aftermath: Failed to initialize."); break;
}
}
}
shutdownAftermath();

View File

@ -892,6 +892,31 @@ namespace bgfx { namespace d3d12
m_textVideoMem.resize(false, _init.resolution.width, _init.resolution.height);
m_textVideoMem.clear();
}
if (1 < m_scd.sampleDesc.Count)
{
D3D12_RESOURCE_DESC resourceDesc;
resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
resourceDesc.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT;
resourceDesc.Width = m_scd.width;
resourceDesc.Height = m_scd.height;
resourceDesc.MipLevels = 1;
resourceDesc.Format = m_scd.format;
resourceDesc.SampleDesc = m_scd.sampleDesc;
resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET;
resourceDesc.DepthOrArraySize = 1;
D3D12_CLEAR_VALUE clearValue;
clearValue.Format = resourceDesc.Format;
clearValue.Color[0] = 0.0f;
clearValue.Color[1] = 0.0f;
clearValue.Color[2] = 0.0f;
clearValue.Color[3] = 0.0f;
m_msaaRt = createCommittedResource(m_device, HeapProperty::Texture, &resourceDesc, &clearValue, true);
setDebugObjectName(m_msaaRt, "MSAA Backbuffer");
}
}
m_presentElapsed = 0;