From a22125a075a52a5b3ab41b5daf3a30fa77d62c15 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 10 Jul 2022 19:55:24 +0900 Subject: [PATCH] internal/graphicsdriver/directx: bug fix: ResizeBuffers failed without the flag Closes #2193 --- internal/graphicsdriver/directx/graphics_windows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index 3987f0cec..576de50f3 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -661,7 +661,11 @@ func (g *Graphics) resizeSwapChainDesktop(width, height int) error { r.Release() } - if err := g.swapChain.ResizeBuffers(frameCount, uint32(width), uint32(height), _DXGI_FORMAT_B8G8R8A8_UNORM, 0); err != nil { + var flag uint32 + if g.allowTearing { + flag |= uint32(_DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING) + } + if err := g.swapChain.ResizeBuffers(frameCount, uint32(width), uint32(height), _DXGI_FORMAT_B8G8R8A8_UNORM, flag); err != nil { return err }