disable depth write if active FBO doesn't have a depth attachment

This commit is contained in:
Samuliak 2024-08-30 16:53:00 +02:00
parent cda4799b54
commit a9a4d7b4f8
2 changed files with 6 additions and 6 deletions

View file

@ -251,11 +251,11 @@ void SetFragmentState(T* desc, CachedFBOMtl* lastUsedFBO, CachedFBOMtl* activeFB
if (lastUsedFBO->depthBuffer.texture)
{
auto texture = static_cast<LatteTextureViewMtl*>(lastUsedFBO->depthBuffer.texture);
desc->setDepthAttachmentPixelFormat(texture->GetRGBAView()->pixelFormat());
if (lastUsedFBO->depthBuffer.hasStencil)
{
desc->setStencilAttachmentPixelFormat(texture->GetRGBAView()->pixelFormat());
}
desc->setDepthAttachmentPixelFormat(texture->GetRGBAView()->pixelFormat());
if (lastUsedFBO->depthBuffer.hasStencil)
{
desc->setStencilAttachmentPixelFormat(texture->GetRGBAView()->pixelFormat());
}
}
}