internal/graphicsdriver: define Resetter

This commit is contained in:
Hajime Hoshi 2023-03-22 18:35:46 +09:00
parent 8cbf545e0f
commit 61ee811579
2 changed files with 5 additions and 1 deletions

View File

@ -550,7 +550,7 @@ func InitializeGraphicsDriverState(graphicsDriver graphicsdriver.Graphics) (err
// 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. // If the graphics driver doesn't have an API to reset, ResetGraphicsDriverState does nothing.
func ResetGraphicsDriverState(graphicsDriver graphicsdriver.Graphics) (err error) { func ResetGraphicsDriverState(graphicsDriver graphicsdriver.Graphics) (err error) {
if r, ok := graphicsDriver.(interface{ Reset() error }); ok { if r, ok := graphicsDriver.(graphicsdriver.Resetter); ok {
runOnRenderThread(func() { runOnRenderThread(func() {
err = r.Reset() err = r.Reset()
}) })

View File

@ -57,6 +57,10 @@ type Graphics interface {
DrawTriangles(dst ImageID, srcs [graphics.ShaderImageCount]ImageID, shader ShaderID, dstRegions []DstRegion, indexOffset int, blend Blend, uniforms []uint32, evenOdd bool) error DrawTriangles(dst ImageID, srcs [graphics.ShaderImageCount]ImageID, shader ShaderID, dstRegions []DstRegion, indexOffset int, blend Blend, uniforms []uint32, evenOdd bool) error
} }
type Resetter interface {
Reset() error
}
type Image interface { type Image interface {
ID() ImageID ID() ImageID
Dispose() Dispose()