mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
app,app/internal/wm: release OpenGL context after use
Otherwise, making a context current on another thread may result in an EGL_BAD_ACCESS error. Fixes gio#248 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -117,6 +117,8 @@ func (c *d3d11Context) MakeCurrent() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *d3d11Context) ReleaseCurrent() {}
|
||||||
|
|
||||||
func (c *d3d11Context) Lock() {}
|
func (c *d3d11Context) Lock() {}
|
||||||
|
|
||||||
func (c *d3d11Context) Unlock() {}
|
func (c *d3d11Context) Unlock() {}
|
||||||
|
|||||||
@@ -139,6 +139,10 @@ func (c *context) MakeCurrent() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *context) ReleaseCurrent() {
|
||||||
|
C.gio_makeCurrent(0)
|
||||||
|
}
|
||||||
|
|
||||||
func (w *window) NewContext() (Context, error) {
|
func (w *window) NewContext() (Context, error) {
|
||||||
return newContext(w)
|
return newContext(w)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ func (c *context) MakeCurrent() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *context) ReleaseCurrent() {}
|
||||||
|
|
||||||
func (w *window) NewContext() (Context, error) {
|
func (w *window) NewContext() (Context, error) {
|
||||||
return newContext(w)
|
return newContext(w)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,10 @@ func (c *context) MakeCurrent() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *context) ReleaseCurrent() {
|
||||||
|
C.gio_clearCurrentContext()
|
||||||
|
}
|
||||||
|
|
||||||
func (w *window) NewContext() (Context, error) {
|
func (w *window) NewContext() (Context, error) {
|
||||||
return newContext(w)
|
return newContext(w)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ type Context interface {
|
|||||||
API() gpu.API
|
API() gpu.API
|
||||||
Present() error
|
Present() error
|
||||||
MakeCurrent() error
|
MakeCurrent() error
|
||||||
|
ReleaseCurrent()
|
||||||
Refresh() error
|
Refresh() error
|
||||||
Release()
|
Release()
|
||||||
Lock()
|
Lock()
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ func (l *renderLoop) renderLoop(ctx wm.Context) error {
|
|||||||
initErr <- err
|
initErr <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer ctx.ReleaseCurrent()
|
||||||
g, err := gpu.New(ctx.API())
|
g, err := gpu.New(ctx.API())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
initErr <- err
|
initErr <- err
|
||||||
|
|||||||
Reference in New Issue
Block a user