diff --git a/internal/graphicsdriver/directx/graphics12_windows.go b/internal/graphicsdriver/directx/graphics12_windows.go index 38ee56e56..506e29e62 100644 --- a/internal/graphicsdriver/directx/graphics12_windows.go +++ b/internal/graphicsdriver/directx/graphics12_windows.go @@ -710,6 +710,8 @@ func (g *graphics12) End(present bool) error { if err := g.resizeSwapChainDesktop(g.newScreenWidth, g.newScreenHeight); err != nil { return err } + g.screenImage.width = g.newScreenWidth + g.screenImage.height = g.newScreenHeight g.newScreenWidth = 0 g.newScreenHeight = 0 } @@ -988,9 +990,14 @@ func (g *graphics12) NewImage(width, height int) (graphicsdriver.Image, error) { } func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdriver.Image, error) { + var imageWidth, imageHeight int if g.screenImage != nil { + imageWidth, imageHeight = g.screenImage.width, g.screenImage.height g.screenImage.Dispose() g.screenImage = nil + } else { + imageWidth = width + imageHeight = height } if err := g.updateSwapChain(width, height); err != nil { @@ -1000,8 +1007,8 @@ func (g *graphics12) NewScreenFramebufferImage(width, height int) (graphicsdrive i := &image12{ graphics: g, id: g.genNextImageID(), - width: width, - height: height, + width: imageWidth, + height: imageHeight, screen: true, states: [frameCount]_D3D12_RESOURCE_STATES{0, 0}, }