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) NewImage(width, height int) (Image, error)
NewScreenFramebufferImage(width, height int) (Image, error) NewScreenFramebufferImage(width, height int) (Image, error)
Initialize() error Initialize() error
Reset() error
SetVsyncEnabled(enabled bool) SetVsyncEnabled(enabled bool)
FramebufferYDirection() YDirection FramebufferYDirection() YDirection
NeedsRestoring() bool NeedsRestoring() bool

View File

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

View File

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