app,app/internal/wm: fold context MakeCurrent/ReleaseCurrent into Lock/Unlock

While here, make context Refresh useful and remove the redundant
MakeCurrent from the window loop.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-08-04 12:03:04 +02:00
parent 4dd6a50670
commit 0bdc2e0432
11 changed files with 83 additions and 132 deletions
+8 -9
View File
@@ -35,18 +35,12 @@ func (c *glContext) Release() {
}
func (c *glContext) Refresh() error {
return nil
}
func (c *glContext) MakeCurrent() error {
c.Context.ReleaseSurface()
var (
win windows.Handle
width, height int
)
c.win.w.Run(func() {
win, width, height = c.win.HWND()
})
win, width, height = c.win.HWND()
eglSurf := egl.NativeWindowType(win)
if err := c.Context.CreateSurface(eglSurf, width, height); err != nil {
return err
@@ -55,9 +49,14 @@ func (c *glContext) MakeCurrent() error {
return err
}
c.Context.EnableVSync(true)
c.Context.ReleaseCurrent()
return nil
}
func (c *glContext) Lock() {}
func (c *glContext) Lock() error {
return c.Context.MakeCurrent()
}
func (c *glContext) Unlock() {}
func (c *glContext) Unlock() {
c.Context.ReleaseCurrent()
}