mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 00:45:35 +00:00
ui/app: add Lock/Unlock to Context for macOS
Without locking, asynchronous OpenGL rendering crashes on macOS. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -202,6 +202,7 @@ func (g *GPU) renderLoop(glctx gl.Context) error {
|
||||
case <-g.refresh:
|
||||
g.refreshErr <- glctx.MakeCurrent()
|
||||
case frame := <-g.frames:
|
||||
glctx.Lock()
|
||||
if frame.collectStats && timers == nil && ctx.caps.EXT_disjoint_timer_query {
|
||||
timers = newTimers(ctx)
|
||||
zopsTimer = timers.newTimer()
|
||||
@@ -253,6 +254,7 @@ func (g *GPU) renderLoop(glctx gl.Context) error {
|
||||
res.summary = fmt.Sprintf("f:%7s zt:%7s st:%7s cov:%7s", ft, zt, st, covt)
|
||||
}
|
||||
res.err = err
|
||||
glctx.Unlock()
|
||||
g.results <- res
|
||||
case <-g.stop:
|
||||
break loop
|
||||
|
||||
Reference in New Issue
Block a user