gpu/internal/opengl: save and restore GL state only for shared contexts

Most Gio programs have exlusive access to their OpenGL contexts, where
saving and restoring of the GL state is not required.

This change applies to all OpenGL platforms, but matters most for WASM
where syscalls are slow.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-10-05 08:41:12 +02:00
parent 3abc891680
commit 30ecf75a0f
2 changed files with 17 additions and 3 deletions
+3
View File
@@ -50,6 +50,9 @@ type OpenGL struct {
// empty for all other platforms; an OpenGL context is assumed current when
// calling NewDevice.
Context gl.Context
// Shared instructs users of the context to restore the GL state after
// use.
Shared bool
}
type Direct3D11 struct {