internal/graphicsdriver/metal: refactoring

This commit is contained in:
Hajime Hoshi 2022-12-29 15:27:51 +09:00
parent 5e17791e4e
commit 8d020ad414

View File

@ -204,14 +204,16 @@ func (g *Graphics) flushIfNeeded(present bool) {
}
g.flushRenderCommandEncoderIfNeeded()
// This logic is necessary when skipping clearing the framebuffer.
if present && g.screenDrawable == (ca.MetalDrawable{}) {
g.screenDrawable = g.view.nextDrawable()
if present {
// This check is necessary when skipping to render the screen (SetScreenClearedEveryFrame(false)).
if g.screenDrawable == (ca.MetalDrawable{}) {
g.screenDrawable = g.view.nextDrawable()
}
if g.screenDrawable != (ca.MetalDrawable{}) {
g.cb.PresentDrawable(g.screenDrawable)
}
}
if present && g.screenDrawable != (ca.MetalDrawable{}) {
g.cb.PresentDrawable(g.screenDrawable)
}
g.cb.Commit()
for _, t := range g.tmpTextures {