diff --git a/internal/driver/graphics.go b/internal/driver/graphics.go index ddab90f15..ce40329f2 100644 --- a/internal/driver/graphics.go +++ b/internal/driver/graphics.go @@ -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 diff --git a/internal/graphicscommand/command.go b/internal/graphicscommand/command.go index b76ec8487..a82a86dc9 100644 --- a/internal/graphicscommand/command.go +++ b/internal/graphicscommand/command.go @@ -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 { - return runOnMainThread(func() error { - return theGraphicsDriver.Reset() - }) + if r, ok := theGraphicsDriver.(interface{ Reset() error }); ok { + return runOnMainThread(func() error { + return r.Reset() + }) + } + return nil } // MaxImageSize returns the maximum size of an image. diff --git a/internal/graphicsdriver/metal/graphics.go b/internal/graphicsdriver/metal/graphics.go index 3f23a737b..3c3d2a8d3 100644 --- a/internal/graphicsdriver/metal/graphics.go +++ b/internal/graphicsdriver/metal/graphics.go @@ -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