| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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/gles2/gles2_private.h" | |
| 6 | |
| 7 #include <assert.h> | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include "mojo/public/c/gles2/gles2.h" | |
| 11 #include "mojo/public/gles2/gles2_interface.h" | |
| 12 | |
| 13 static mojo::GLES2Support* g_gles2_support = NULL; | |
| 14 static mojo::GLES2Interface* g_gles2_interface = NULL; | |
| 15 | |
| 16 extern "C" { | |
| 17 | |
| 18 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) { | |
| 19 assert(g_gles2_support); | |
| 20 return g_gles2_support->Initialize(async_waiter); | |
| 21 } | |
| 22 | |
| 23 void MojoGLES2Terminate() { | |
| 24 assert(g_gles2_support); | |
| 25 return g_gles2_support->Terminate(); | |
| 26 } | |
| 27 | |
| 28 MojoGLES2Context MojoGLES2CreateContext( | |
| 29 MojoHandle handle, | |
| 30 MojoGLES2ContextLost lost_callback, | |
| 31 void* closure) { | |
| 32 return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle), | |
| 33 lost_callback, | |
| 34 closure); | |
| 35 } | |
| 36 | |
| 37 void MojoGLES2DestroyContext(MojoGLES2Context context) { | |
| 38 return g_gles2_support->DestroyContext(context); | |
| 39 } | |
| 40 | |
| 41 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | |
| 42 assert(g_gles2_support); | |
| 43 g_gles2_support->MakeCurrent(context); | |
| 44 g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext(); | |
| 45 } | |
| 46 | |
| 47 void MojoGLES2SwapBuffers() { | |
| 48 assert(g_gles2_support); | |
| 49 return g_gles2_support->SwapBuffers(); | |
| 50 } | |
| 51 | |
| 52 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { | |
| 53 assert(g_gles2_support); | |
| 54 return g_gles2_support->GetGLES2Interface(context); | |
| 55 } | |
| 56 | |
| 57 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { | |
| 58 assert(g_gles2_support); | |
| 59 return g_gles2_support->GetContextSupport(context); | |
| 60 } | |
| 61 | |
| 62 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | |
| 63 ReturnType gl##Function PARAMETERS { \ | |
| 64 return g_gles2_interface->Function ARGUMENTS; \ | |
| 65 } | |
| 66 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | |
| 67 #undef VISIT_GL_CALL | |
| 68 | |
| 69 } // extern "C" | |
| 70 | |
| 71 namespace mojo { | |
| 72 | |
| 73 GLES2Support::~GLES2Support() {} | |
| 74 | |
| 75 void GLES2Support::Init(GLES2Support* gles2_support) { | |
| 76 assert(!g_gles2_support); | |
| 77 g_gles2_support = gles2_support; | |
| 78 } | |
| 79 | |
| 80 } // namespace mojo | |
| OLD | NEW |