mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +00:00
gpu,gpu/backend: implement generic backend.NewDevice
NewDevice creates a Device given an API, which is the necessary GPU resources for a backend. Convert gpu.New to take an API instead of a backend.Device directly. In turn, this frees us to later unexport the backend package along with the backend implementations (for now just gioui.org/gpu/gl for OpenGL). It also allows programs that embed Gio (such as gioui.org/example/glfw) to freely choose a backend, not just OpenGL. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -11,8 +11,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"gioui.org/app/internal/srgb"
|
||||
"gioui.org/gpu/backend"
|
||||
"gioui.org/gpu/gl"
|
||||
"gioui.org/gpu"
|
||||
"gioui.org/internal/glimpl"
|
||||
)
|
||||
|
||||
@@ -118,8 +117,8 @@ func NewContext(disp NativeDisplayType) (*Context, error) {
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (c *Context) Backend() (backend.Device, error) {
|
||||
return gl.NewBackend(nil)
|
||||
func (c *Context) API() gpu.API {
|
||||
return gpu.OpenGL{}
|
||||
}
|
||||
|
||||
func (c *Context) ReleaseSurface() {
|
||||
|
||||
Reference in New Issue
Block a user