From a448825d48787f9f0172c4b1104da774338f3b29 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 28 Feb 2020 14:50:39 +0000 Subject: [PATCH] app/internal/d3d11: only clear depth buffer if it exists Signed-off-by: Elias Naur --- app/internal/d3d11/backend_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/internal/d3d11/backend_windows.go b/app/internal/d3d11/backend_windows.go index c58683ea..0e87ae55 100644 --- a/app/internal/d3d11/backend_windows.go +++ b/app/internal/d3d11/backend_windows.go @@ -500,7 +500,7 @@ func (b *Backend) Clear(buffers backend.BufferAttachments) { if buffers&backend.BufferAttachmentColor != 0 { b.dev.ctx.ClearRenderTargetView(b.fbo.renderTarget, &b.clearColor) } - if buffers&backend.BufferAttachmentDepth != 0 { + if buffers&backend.BufferAttachmentDepth != 0 && b.fbo.depthView != nil { b.dev.ctx.ClearDepthStencilView(b.fbo.depthView, _D3D11_CLEAR_DEPTH|_D3D11_CLEAR_STENCIL, b.clearDepth, 0) } }