internal/graphicsdriver: remove NeedsRestoring()

Updates #805
This commit is contained in:
Hajime Hoshi 2024-01-08 22:08:42 +09:00
parent a30f075896
commit 771e5685f8
6 changed files with 1 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}