gpu: reset to the default framebuffer on reset

The macOS backend doesn't re-create contexts, holding on to the first
created instead. Make sure the GPU leaves the default framebuffer bound,
in case the context is re-used.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-04-23 00:27:04 +02:00
parent aefc6f3625
commit 02d4316c56
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -50,6 +50,11 @@ func (c *context) Release() {
c.Lock()
defer c.Unlock()
C.gio_clearCurrentContext()
// We could release the context with [view clearGLContext]
// and rely on [view openGLContext] auto-creating a new context.
// However that second context is not properly set up by
// OpenGLContextView, so we'll stay on the safe side and keep
// the first context around.
}
func (c *context) Present() error {
+1
View File
@@ -354,6 +354,7 @@ func (g *GPU) BeginFrame() {
g.ctx.SetBlend(false)
g.renderer.pather.stenciler.invalidateFBO()
g.coverTimer.end()
g.ctx.BindFramebuffer(g.defFBO)
}
func (g *GPU) EndFrame() {