Graphics/Graphics: Add preferred depth format

This commit is contained in:
SirLynix
2022-11-06 23:45:37 +01:00
parent ea3c363b58
commit ad1f3bc321
3 changed files with 19 additions and 0 deletions

View File

@@ -355,6 +355,18 @@ namespace Nz
void Graphics::SelectDepthStencilFormats()
{
for (PixelFormat depthStencilCandidate : { PixelFormat::Depth24, PixelFormat::Depth32F, PixelFormat::Depth16 })
{
if (m_renderDevice->IsTextureFormatSupported(depthStencilCandidate, TextureUsage::DepthStencilAttachment))
{
m_preferredDepthFormat = depthStencilCandidate;
break;
}
}
if (m_preferredDepthFormat == PixelFormat::Undefined)
throw std::runtime_error("no supported depth format found");
for (PixelFormat depthStencilCandidate : { PixelFormat::Depth24Stencil8, PixelFormat::Depth32FStencil8, PixelFormat::Depth16Stencil8 })
{
if (m_renderDevice->IsTextureFormatSupported(depthStencilCandidate, TextureUsage::DepthStencilAttachment))