mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 02:38:53 +01:00
parent
a30f075896
commit
771e5685f8
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user