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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « mojo/gles2/BUILD.gn ('k') | mojo/public/c/gpu/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This file implements the MGL and MGL onscreen entry points exposed to the
6 // Mojo application by the shell.
7 //
8 // TODO(jamesr): These entry points are implemented on top of the MojoGLES2
9 // family, which for control functions is backwards. The MojoGLES2 control
10 // entry points should be implemented on top of these entry points while we
11 // deprecate them.
12
13 #include "mojo/public/c/gles2/gles2.h"
14 #include "mojo/public/c/gpu/MGL/mgl.h"
15 #include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
16 #include "mojo/public/cpp/system/message_pipe.h"
17
18 extern "C" {
19
20 MGLContext MGLCreateContext(MGLOpenGLAPIVersion version,
21 MojoHandle command_buffer_handle,
22 MGLContext share_group,
23 MGLContextLostCallback lost_callback,
24 void* lost_callback_closure,
25 const struct MojoAsyncWaiter* async_waiter) {
26 // TODO(jamesr): Support ES 3.0 / 3.1 where possible.
27 if (version != MGL_API_VERSION_GLES2) {
28 MojoClose(command_buffer_handle);
29 return MGL_NO_CONTEXT;
30 }
31 // TODO(jamesr): Plumb through share groups.
32 if (share_group != MGL_NO_CONTEXT) {
33 MojoClose(command_buffer_handle);
34 return MGL_NO_CONTEXT;
35 }
36
37 return reinterpret_cast<MGLContext>(
38 MojoGLES2CreateContext(command_buffer_handle, lost_callback,
39 lost_callback_closure, async_waiter));
40 }
41
42 void MGLDestroyContext(MGLContext context) {
43 MojoGLES2DestroyContext(reinterpret_cast<MojoGLES2Context>(context));
44 }
45
46 void MGLMakeCurrent(MGLContext context) {
47 MojoGLES2MakeCurrent(reinterpret_cast<MojoGLES2Context>(context));
48 // TODO(jamesr): Plumb through loss information.
49 }
50
51 MGLContext MGLGetCurrentContext() {
52 // TODO(jamesr): Implement.
53 return MGL_NO_CONTEXT;
54 }
55
56 // TODO(jamesr): Hack - this symbol is defined in //mojo/gles2/gles2_impl.cc.
57 // What should really happen here is this should call into the data structure
58 // underlying MGLContext, but that can't happen until control is inverted.
59 void MojoGLES2glResizeCHROMIUM(uint32_t width,
60 uint32_t height,
61 float scale_factor);
62
63 void MGLResizeSurface(uint32_t width, uint32_t height) {
64 // TODO(jamesr): Implement
65 MojoGLES2glResizeCHROMIUM(width, height, 1.f);
66 }
67
68 void MGLSwapBuffers() {
69 MojoGLES2SwapBuffers();
70 }
71
72 } // extern "C"
OLDNEW
« 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