diff --git a/internal/graphicsdriver/directx/graphics11_windows.go b/internal/graphicsdriver/directx/graphics11_windows.go index 3a9f41152..807009046 100644 --- a/internal/graphicsdriver/directx/graphics11_windows.go +++ b/internal/graphicsdriver/directx/graphics11_windows.go @@ -463,10 +463,6 @@ func (g *graphics11) SetVsyncEnabled(enabled bool) { g.vsyncEnabled = enabled } -func (g *graphics11) NeedsRestoring() bool { - return false -} - func (g *graphics11) NeedsClearingScreen() bool { // TODO: Confirm this is really true. return true diff --git a/internal/graphicsdriver/directx/graphics12_windows.go b/internal/graphicsdriver/directx/graphics12_windows.go index c594f0a30..69740b90e 100644 --- a/internal/graphicsdriver/directx/graphics12_windows.go +++ b/internal/graphicsdriver/directx/graphics12_windows.go @@ -1054,10 +1054,6 @@ func (g *graphics12) SetVsyncEnabled(enabled bool) { g.vsyncEnabled = enabled } -func (g *graphics12) NeedsRestoring() bool { - return false -} - func (g *graphics12) NeedsClearingScreen() bool { // TODO: Confirm this is really true. return true diff --git a/internal/graphicsdriver/graphics.go b/internal/graphicsdriver/graphics.go index d78642d9f..a43710f36 100644 --- a/internal/graphicsdriver/graphics.go +++ b/internal/graphicsdriver/graphics.go @@ -62,7 +62,6 @@ type Graphics interface { NewImage(width, height int) (Image, error) NewScreenFramebufferImage(width, height int) (Image, error) SetVsyncEnabled(enabled bool) - NeedsRestoring() bool NeedsClearingScreen() bool MaxImageSize() int diff --git a/internal/graphicsdriver/metal/graphics_darwin.go b/internal/graphicsdriver/metal/graphics_darwin.go index 6b0031102..216fbd098 100644 --- a/internal/graphicsdriver/metal/graphics_darwin.go +++ b/internal/graphicsdriver/metal/graphics_darwin.go @@ -708,10 +708,6 @@ func (g *Graphics) SetVsyncEnabled(enabled bool) { g.view.setDisplaySyncEnabled(enabled) } -func (g *Graphics) NeedsRestoring() bool { - return false -} - func (g *Graphics) NeedsClearingScreen() bool { return false } diff --git a/internal/graphicsdriver/opengl/graphics.go b/internal/graphicsdriver/opengl/graphics.go index 748428423..44b20d620 100644 --- a/internal/graphicsdriver/opengl/graphics.go +++ b/internal/graphicsdriver/opengl/graphics.go @@ -18,7 +18,6 @@ package opengl import ( "fmt" - "runtime" "unsafe" "github.com/hajimehoshi/ebiten/v2/internal/graphics" @@ -310,20 +309,6 @@ func (g *Graphics) SetVsyncEnabled(enabled bool) { g.vsync = enabled } -func (g *Graphics) NeedsRestoring() bool { - // Though it is possible to have a logic to restore the graphics data for GPU, do not use it for performance (#1603). - if runtime.GOOS == "js" { - return false - } - // On Android, `setPreserveEGLContextOnPause(true)` is called and then context loss unlikely happens. - // If this happens, Ebitengine tries to relaunch the app (#805). - if runtime.GOOS == "android" { - return false - } - // TODO: Remove the entire logic of the restoring (#805). - return g.context.ctx.IsES() -} - func (g *Graphics) NeedsClearingScreen() bool { return true } diff --git a/internal/restorable/images.go b/internal/restorable/images.go index 229452245..4127380b9 100644 --- a/internal/restorable/images.go +++ b/internal/restorable/images.go @@ -23,11 +23,9 @@ import ( // forceRestoring reports whether restoring forcely happens or not. var forceRestoring = false -var needsRestoringByGraphicsDriver bool - // needsRestoring reports whether restoring process works or not. func needsRestoring() bool { - return forceRestoring || needsRestoringByGraphicsDriver + return forceRestoring } // AlwaysReadPixelsFromGPU reports whether ReadPixels always reads pixels from GPU or not. @@ -266,7 +264,6 @@ var graphicsDriverInitialized bool // InitializeGraphicsDriverState initializes the graphics driver state. func InitializeGraphicsDriverState(graphicsDriver graphicsdriver.Graphics) error { graphicsDriverInitialized = true - needsRestoringByGraphicsDriver = graphicsDriver.NeedsRestoring() return graphicscommand.InitializeGraphicsDriverState(graphicsDriver) }