Add MGL entry points and port spinning_cube to use them
This adds MGL entry points for controlling contexts and MGL onscreen
entry points specifically for onscreen contexts and makes the
spinning_cube (and thus surfaces_app) examples use them. The MGL thunks
are plumbed through and implemented in the shell on top of the old
MojoGLES2* entry points. The thunks and headers for OpenGL ES / KHR are
put in place in the SDK in this patch, but the old targets and thunk
targets are still in place and used by most other things.
Plan from here is to:
*) Land this so the new entry points are available to downstream SDK
consumers
*) Port callers over to the new entry points, both in the Mojo repo and
downstream (these patches can be parallelized)
*) When callers of the MojoGLES2 entry points are gone, remove from SDK
and migrate thunk implementations to "proper" places
*) Remove the third_party/khronos headers from everywhere
The MGL entry points are just like the MojoGLES2 ones except:
*) MGLCreateContext allows specifying a version and share group,
although the only accepted values right now are OpenGL ES 2.0
and no share group (same as before)
*) MGL exposes an MGLGetCurrentContext()
*) SwapBuffers() and Resize() are in a separate header and separate
thunk table as they only make sense for the minority of apps that talk
directly to an 'onscreen' context, that is the system compositor and
some demos and tests. In theory the shell could selectively inject
thunks for this table to apps with the correct signatures or whatnot
*) MGL thunks are implemented in .c files to make them easier to
compile with strange toolchain/language combinations
*) MGL does not expose the C++ downcast GLES2Interface getter. As part
of converting things to MGL I'll remove the rest of the users of this.
The full set of OpenGL ES 2 headers including extension headers are put
into the public SDK in this patch, but they aren't being used
universally yet. Since they're the same as the ones in other places in
the mojo repo this "works" but it's a bit sketchy. I'll remove the
other header locations soon but changing that at the same time as
adding the new headers results in an unreviewably large patch so it's
separate.
This patch also bypasses the formatting check for the headers from
khronos since I don't think we want to clang-format them. I'm not sure
how to teach the presubmit to do this - ideas welcome.
R=viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/1288583002 .
diff --git a/shell/BUILD.gn b/shell/BUILD.gn
index 6b6af1c..4bf0c1c 100644
--- a/shell/BUILD.gn
+++ b/shell/BUILD.gn
@@ -216,6 +216,7 @@
deps = [
"//base",
"//mojo/gles2",
+ "//mojo/gles2:mgl",
]
# This target has to include the public thunk headers, which generally