forked from joejulian/gio
gpu,gpu/gl: introduce Backend
A recent change made the OpenGL functions an interface of the functions required for the implementation of GPU, a renderer for Gio operations. That allowed for running Gio on external systems where OpenGL is available. However, to allow for non-OpenGL flavored backends such as Vulkan, Metal and Direct3D, this change introduces Backend for the high-level operations required by GPU. This change also adds a concrete backend to package gl. Type Backend is a first cut heavily based on OpenGL. Future changes will add more backends, where the Backend interface quite possibly will need refinement. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+7
-1
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"gioui.org/app/internal/window"
|
||||
"gioui.org/gpu"
|
||||
"gioui.org/gpu/gl"
|
||||
"gioui.org/op"
|
||||
)
|
||||
|
||||
@@ -66,7 +67,12 @@ func (l *renderLoop) renderLoop(glctx window.Context) error {
|
||||
initErr <- err
|
||||
return
|
||||
}
|
||||
g, err := gpu.New(glctx.Functions())
|
||||
ctx, err := gl.NewBackend(glctx.Functions())
|
||||
if err != nil {
|
||||
initErr <- err
|
||||
return
|
||||
}
|
||||
g, err := gpu.New(ctx)
|
||||
if err != nil {
|
||||
initErr <- err
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user