From c183555cc8985f8b9df80fb1bc9034e79ddc9fd5 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 29 Jul 2022 16:20:07 +0900 Subject: [PATCH] internal/graphicsdriver/directx: bug fix: check the error at CreateGraphicsPipelineState at initialization CreateGraphicsPipelineState someitmes causes an error DXGI_ERROR_DEVICE_HUNG, but we failed to know why. Instead of fixing this, check the error earlier and use the fallback grpahics library OpenGL in this case. Updates #2198 --- internal/graphicsdriver/directx/graphics_windows.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index dad7fd79d..b11a15348 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -294,6 +294,11 @@ func (g *Graphics) initializeDesktop(useWARP bool, useDebugLayer bool) (ferr err } i.Dispose() + // Check whether an unexpected error happens or not: DXGI_ERROR_DEVICE_HUNG (#2198). + if _, err := g.pipelineStates.builtinGraphicsPipelineState(g.device, builtinPipelineStatesKey{}); err != nil { + return err + } + return nil }