gpu: support forced OpenGL ES mode, for ANGLE on macOS

macOS is the only platform where desktop OpenGL is used. To support
foreign ANGLE contexts add a setting to override Gio's selection of
OpenGL implementation.

The bulk of this change is making all function pointers per-context
instead of global, and loading the OpenGL library dynamically. As a side
effect we're closer to Gio tolerating a platform without any OpenGL
implementation. For example, Apple has deprecated OpenGL and OpenGL ES
on its platforms and may remove them in the future.

Note that as a side-effect of this change, Gio needs Go 1.16 or newer to
run on iOS.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-05-14 21:07:04 +02:00
parent 163be2ffd4
commit b622412ac6
6 changed files with 672 additions and 221 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ type Functions struct {
type Context js.Value
func NewFunctions(ctx Context) (*Functions, error) {
func NewFunctions(ctx Context, forceES bool) (*Functions, error) {
f := &Functions{
Ctx: js.Value(ctx),
uint8Array: js.Global().Get("Uint8Array"),
+664 -216
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -98,7 +98,7 @@ type Functions struct {
type Context interface{}
func NewFunctions(ctx Context) (*Functions, error) {
func NewFunctions(ctx Context, forceES bool) (*Functions, error) {
if ctx != nil {
panic("non-nil context")
}