internal/graphicsdriver/opengl: Give up restorign on browsers

Using restorable images is expensive as this sometimes requires to
load pixels from GPU. On browsers, just reloading the application
should be fine when the context lost happens.

Closes #1603
This commit is contained in:
Hajime Hoshi
2021-06-26 16:50:12 +09:00
parent 38ce46328a
commit 8ff42f55a1
3 changed files with 3 additions and 29 deletions

View File

@@ -23,7 +23,6 @@ import (
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl/gles"
"github.com/hajimehoshi/ebiten/v2/internal/jsutil"
"github.com/hajimehoshi/ebiten/v2/internal/shaderir"
"github.com/hajimehoshi/ebiten/v2/internal/web"
)
type (
@@ -85,7 +84,6 @@ const (
var (
isWebGL2Available = !forceWebGL1 && (js.Global().Get("WebGL2RenderingContext").Truthy() || js.Global().Get("go2cpp").Truthy())
needsRestoring = !web.IsMobileBrowser() && !js.Global().Get("go2cpp").Truthy()
)
type contextImpl struct {
@@ -526,7 +524,8 @@ func (c *context) flush() {
}
func (c *context) needsRestoring() bool {
return needsRestoring
// Though it is possible to have a logic to restore the graphics data for GPU, do not use it for performance (#1603).
return false
}
func (c *context) canUsePBO() bool {