From c22957f6784192a389647d42888ae5892d5e9016 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 29 Mar 2023 00:42:01 +0900 Subject: [PATCH] internal/graphicsdriver/directx: dispose a screen image explicitly A screen image in DirectX 12 should not include any buffers to release so there is not a bug, but disposing it explicitly when resizing the window should be polite. --- internal/graphicsdriver/directx/graphics12_windows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/graphicsdriver/directx/graphics12_windows.go b/internal/graphicsdriver/directx/graphics12_windows.go index c814ee9c8..9d2410471 100644 --- a/internal/graphicsdriver/directx/graphics12_windows.go +++ b/internal/graphicsdriver/directx/graphics12_windows.go @@ -994,6 +994,11 @@ func (g *graphics12) NewImage(width, height int) (graphicsdriver.Image, error) { } func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) { + if g.screenImage != nil { + g.screenImage.Dispose() + g.screenImage = nil + } + if err := g.updateSwapChain(width, height); err != nil { return nil, err }