Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: mojo/gles2/mgl_impl.cc

Issue 1288583002: Add MGL entry points and port spinning_cube to use them (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/gles2/BUILD.gn ('k') | mojo/public/c/gpu/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/gles2/mgl_impl.cc
diff --git a/mojo/gles2/mgl_impl.cc b/mojo/gles2/mgl_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..56c5f8f3034410d53a90ca2e9a5737ef48cc4444
--- /dev/null
+++ b/mojo/gles2/mgl_impl.cc
@@ -0,0 +1,72 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file implements the MGL and MGL onscreen entry points exposed to the
+// Mojo application by the shell.
+//
+// TODO(jamesr): These entry points are implemented on top of the MojoGLES2
+// family, which for control functions is backwards. The MojoGLES2 control
+// entry points should be implemented on top of these entry points while we
+// deprecate them.
+
+#include "mojo/public/c/gles2/gles2.h"
+#include "mojo/public/c/gpu/MGL/mgl.h"
+#include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
+#include "mojo/public/cpp/system/message_pipe.h"
+
+extern "C" {
+
+MGLContext MGLCreateContext(MGLOpenGLAPIVersion version,
+ MojoHandle command_buffer_handle,
+ MGLContext share_group,
+ MGLContextLostCallback lost_callback,
+ void* lost_callback_closure,
+ const struct MojoAsyncWaiter* async_waiter) {
+ // TODO(jamesr): Support ES 3.0 / 3.1 where possible.
+ if (version != MGL_API_VERSION_GLES2) {
+ MojoClose(command_buffer_handle);
+ return MGL_NO_CONTEXT;
+ }
+ // TODO(jamesr): Plumb through share groups.
+ if (share_group != MGL_NO_CONTEXT) {
+ MojoClose(command_buffer_handle);
+ return MGL_NO_CONTEXT;
+ }
+
+ return reinterpret_cast<MGLContext>(
+ MojoGLES2CreateContext(command_buffer_handle, lost_callback,
+ lost_callback_closure, async_waiter));
+}
+
+void MGLDestroyContext(MGLContext context) {
+ MojoGLES2DestroyContext(reinterpret_cast<MojoGLES2Context>(context));
+}
+
+void MGLMakeCurrent(MGLContext context) {
+ MojoGLES2MakeCurrent(reinterpret_cast<MojoGLES2Context>(context));
+ // TODO(jamesr): Plumb through loss information.
+}
+
+MGLContext MGLGetCurrentContext() {
+ // TODO(jamesr): Implement.
+ return MGL_NO_CONTEXT;
+}
+
+// TODO(jamesr): Hack - this symbol is defined in //mojo/gles2/gles2_impl.cc.
+// What should really happen here is this should call into the data structure
+// underlying MGLContext, but that can't happen until control is inverted.
+void MojoGLES2glResizeCHROMIUM(uint32_t width,
+ uint32_t height,
+ float scale_factor);
+
+void MGLResizeSurface(uint32_t width, uint32_t height) {
+ // TODO(jamesr): Implement
+ MojoGLES2glResizeCHROMIUM(width, height, 1.f);
+}
+
+void MGLSwapBuffers() {
+ MojoGLES2SwapBuffers();
+}
+
+} // extern "C"
« no previous file with comments | « mojo/gles2/BUILD.gn ('k') | mojo/public/c/gpu/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698