internal/restorable: Bug fix: Test failed on macOS (Metal)

This commit is contained in:
Hajime Hoshi 2021-07-09 20:20:45 +09:00
parent 17869143c0
commit b0106e95b9
3 changed files with 7 additions and 8 deletions

View File

@ -42,7 +42,6 @@ type Graphics interface {
NewImage(width, height int) (Image, error)
NewScreenFramebufferImage(width, height int) (Image, error)
Initialize() error
Reset() error
SetVsyncEnabled(enabled bool)
FramebufferYDirection() YDirection
NeedsRestoring() bool

View File

@ -662,10 +662,14 @@ func InitializeGraphicsDriverState() error {
}
// ResetGraphicsDriverState resets the current graphics driver state.
// If the graphics driver doesn't have an API to reset, ResetGraphicsDriverState does nothing.
func ResetGraphicsDriverState() error {
if r, ok := theGraphicsDriver.(interface{ Reset() error }); ok {
return runOnMainThread(func() error {
return theGraphicsDriver.Reset()
return r.Reset()
})
}
return nil
}
// MaxImageSize returns the maximum size of an image.

View File

@ -767,10 +767,6 @@ func (g *Graphics) Initialize() error {
return nil
}
func (g *Graphics) Reset() error {
panic("metal: Reset is not implemented")
}
func (g *Graphics) flushRenderCommandEncoderIfNeeded() {
if g.rce == (mtl.RenderCommandEncoder{}) {
return