Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #include "mojo/public/c/gles2/gles2.h" | |
| 6 #include "mojo/public/c/gpu/MGL/mgl.h" | |
| 7 #include "mojo/public/c/gpu/MGL/mgl_onscreen.h" | |
| 8 #include "mojo/public/cpp/system/message_pipe.h" | |
| 9 | |
| 10 // This file implements the MGL and MGL onscreen entry points exposed to the | |
|
viettrungluu
2015/08/12 02:48:10
nit: I think you should put the file-level comment
| |
| 11 // Mojo application by the shell. | |
| 12 // | |
| 13 // TODO(jamesr): These entry points are implemented on top of the MojoGLES2 | |
| 14 // family, which for control functions is backwards. The MojoGLES2 control | |
| 15 // entry points | |
|
viettrungluu
2015/08/12 02:48:10
nit: rewrap this comment?
| |
| 16 // should be implemented on top of these entry points while we deprecate them. | |
| 17 extern "C" { | |
|
viettrungluu
2015/08/12 02:48:10
nit: blank line after this one, and maybe also bef
| |
| 18 MGLContext MGLCreateContext(MGLOpenGLAPIVersion version, | |
| 19 MojoHandle command_buffer_handle, | |
| 20 MGLContext share_group, | |
| 21 MGLContextLostCallback lost_callback, | |
| 22 void* lost_callback_closure, | |
| 23 const struct MojoAsyncWaiter* async_waiter) { | |
| 24 // TODO(jamesr): Support ES 3.0 / 3.1 where possible. | |
| 25 if (version != MGL_API_VERSION_GLES2) { | |
| 26 MojoClose(command_buffer_handle); | |
| 27 return MGL_NO_CONTEXT; | |
| 28 } | |
| 29 // TODO(jamesr): Plumb through share groups. | |
| 30 if (share_group != MGL_NO_CONTEXT) { | |
| 31 MojoClose(command_buffer_handle); | |
| 32 return MGL_NO_CONTEXT; | |
| 33 } | |
| 34 | |
| 35 return reinterpret_cast<MGLContext>( | |
| 36 MojoGLES2CreateContext(command_buffer_handle, lost_callback, | |
| 37 lost_callback_closure, async_waiter)); | |
| 38 } | |
| 39 | |
| 40 void MGLDestroyContext(MGLContext context) { | |
| 41 MojoGLES2DestroyContext(reinterpret_cast<MojoGLES2Context>(context)); | |
| 42 } | |
| 43 | |
| 44 int MGLMakeCurrent(MGLContext context) { | |
| 45 MojoGLES2MakeCurrent(reinterpret_cast<MojoGLES2Context>(context)); | |
| 46 // TODO(jamesr): Plumb through loss information through the return value. | |
| 47 return 0; | |
|
viettrungluu
2015/08/12 02:48:10
Aha, so your comment in the header about MGLMakeCu
| |
| 48 } | |
| 49 | |
| 50 MGLContext MGLGetCurrentContext() { | |
| 51 // TODO(jamesr): Implement. | |
| 52 return MGL_NO_CONTEXT; | |
| 53 } | |
| 54 | |
| 55 // TODO(jamesr): Hack - this symbol is defined in //mojo/gles2/gles2_impl.cc. | |
| 56 // What should really happen here is this should call into the data structure | |
| 57 // underlying MGLContext, but that can't happen until control is inverted. | |
| 58 void MojoGLES2glResizeCHROMIUM(uint32_t width, | |
| 59 uint32_t height, | |
| 60 float scale_factor); | |
| 61 | |
| 62 void MGLResizeSurface(uint32_t width, uint32_t height) { | |
| 63 // TODO(jamesr): Implement | |
| 64 MojoGLES2glResizeCHROMIUM(width, height, 1.f); | |
| 65 } | |
| 66 | |
| 67 void MGLSwapBuffers() { | |
| 68 MojoGLES2SwapBuffers(); | |
| 69 } | |
| 70 | |
| 71 } // extern "C" | |
| OLD | NEW |