From 7321e86a6be19f4d669a9853c0c4bb421076f153 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 26 Apr 2022 01:12:52 +0900 Subject: [PATCH] internal/graphicsdriver/directx: bug fix: the screen image can be nil when resizing the window Closes #2081 --- internal/graphicsdriver/directx/graphics_windows.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/graphicsdriver/directx/graphics_windows.go b/internal/graphicsdriver/directx/graphics_windows.go index 42a60ab86..6255f4f4e 100644 --- a/internal/graphicsdriver/directx/graphics_windows.go +++ b/internal/graphicsdriver/directx/graphics_windows.go @@ -577,7 +577,8 @@ func (g *Graphics) End(present bool) error { return err } - if present { + // The screen image can be nil in the very first frame (#2081). + if present && g.screenImage != nil { g.screenImage.transiteState(g.drawCommandList, _D3D12_RESOURCE_STATE_PRESENT) }