mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
app,app/headless: expose Backends from window and headless contexts
This is a refactoring change to prepare for another gpu.Backend implementations. Notably, app/loop.go no longer imports gpu/gl. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"gioui.org/app/internal/glimpl"
|
||||
"gioui.org/gpu"
|
||||
"gioui.org/gpu/gl"
|
||||
)
|
||||
|
||||
@@ -50,8 +51,8 @@ func newContext(w *window) (*context, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *context) Functions() *glimpl.Functions {
|
||||
return c.c
|
||||
func (c *context) Backend() (gpu.Backend, error) {
|
||||
return gl.NewBackend(c.c)
|
||||
}
|
||||
|
||||
func (c *context) Release() {
|
||||
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
|
||||
"gioui.org/app/internal/glimpl"
|
||||
"gioui.org/app/internal/srgb"
|
||||
"gioui.org/gpu"
|
||||
"gioui.org/gpu/gl"
|
||||
)
|
||||
|
||||
type context struct {
|
||||
@@ -45,8 +47,8 @@ func newContext(w *window) (*context, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *context) Functions() *glimpl.Functions {
|
||||
return c.f
|
||||
func (c *context) Backend() (gpu.Backend, error) {
|
||||
return gl.NewBackend(c.f)
|
||||
}
|
||||
|
||||
func (c *context) Release() {
|
||||
|
||||
@@ -6,6 +6,8 @@ package window
|
||||
|
||||
import (
|
||||
"gioui.org/app/internal/glimpl"
|
||||
"gioui.org/gpu"
|
||||
"gioui.org/gpu/gl"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -40,8 +42,8 @@ func newContext(w *window) (*context, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *context) Functions() *glimpl.Functions {
|
||||
return c.c
|
||||
func (c *context) Backend() (gpu.Backend, error) {
|
||||
return gl.NewBackend(c.c)
|
||||
}
|
||||
|
||||
func (c *context) Release() {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"gioui.org/app/internal/glimpl"
|
||||
"gioui.org/gpu"
|
||||
"gioui.org/io/event"
|
||||
"gioui.org/io/system"
|
||||
"gioui.org/unit"
|
||||
@@ -32,7 +32,7 @@ type Callbacks interface {
|
||||
}
|
||||
|
||||
type Context interface {
|
||||
Functions() *glimpl.Functions
|
||||
Backend() (gpu.Backend, error)
|
||||
Present() error
|
||||
MakeCurrent() error
|
||||
Release()
|
||||
|
||||
Reference in New Issue
Block a user