| 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/platform/native/gles2_thunks.h" | |
| 6 | |
| 7 #include <assert.h> | |
| 8 | |
| 9 #include "mojo/public/platform/native/thunk_export.h" | |
| 10 | |
| 11 extern "C" { | |
| 12 | |
| 13 static MojoGLES2ControlThunks g_control_thunks = {0}; | |
| 14 static MojoGLES2ImplThunks g_impl_thunks = {0}; | |
| 15 | |
| 16 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) { | |
| 17 assert(g_control_thunks.GLES2Initialize); | |
| 18 g_control_thunks.GLES2Initialize(async_waiter); | |
| 19 } | |
| 20 | |
| 21 void MojoGLES2Terminate() { | |
| 22 assert(g_control_thunks.GLES2Terminate); | |
| 23 g_control_thunks.GLES2Terminate(); | |
| 24 } | |
| 25 | |
| 26 MojoGLES2Context MojoGLES2CreateContext( | |
| 27 MojoHandle handle, | |
| 28 MojoGLES2ContextLost lost_callback, | |
| 29 void* closure) { | |
| 30 assert(g_control_thunks.GLES2CreateContext); | |
| 31 return g_control_thunks.GLES2CreateContext(handle, lost_callback, closure); | |
| 32 } | |
| 33 | |
| 34 void MojoGLES2DestroyContext(MojoGLES2Context context) { | |
| 35 assert(g_control_thunks.GLES2DestroyContext); | |
| 36 g_control_thunks.GLES2DestroyContext(context); | |
| 37 } | |
| 38 | |
| 39 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | |
| 40 assert(g_control_thunks.GLES2MakeCurrent); | |
| 41 g_control_thunks.GLES2MakeCurrent(context); | |
| 42 } | |
| 43 | |
| 44 void MojoGLES2SwapBuffers() { | |
| 45 assert(g_control_thunks.GLES2SwapBuffers); | |
| 46 g_control_thunks.GLES2SwapBuffers(); | |
| 47 } | |
| 48 | |
| 49 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { | |
| 50 assert(g_control_thunks.GLES2GetGLES2Interface); | |
| 51 return g_control_thunks.GLES2GetGLES2Interface(context); | |
| 52 } | |
| 53 | |
| 54 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { | |
| 55 assert(g_control_thunks.GLES2GetContextSupport); | |
| 56 return g_control_thunks.GLES2GetContextSupport(context); | |
| 57 } | |
| 58 | |
| 59 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | |
| 60 ReturnType gl##Function PARAMETERS { \ | |
| 61 assert(g_impl_thunks.Function); \ | |
| 62 return g_impl_thunks.Function ARGUMENTS; \ | |
| 63 } | |
| 64 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | |
| 65 #undef VISIT_GL_CALL | |
| 66 | |
| 67 extern "C" THUNK_EXPORT size_t MojoSetGLES2ControlThunks( | |
| 68 const MojoGLES2ControlThunks* gles2_control_thunks) { | |
| 69 if (gles2_control_thunks->size >= sizeof(g_control_thunks)) | |
| 70 g_control_thunks = *gles2_control_thunks; | |
| 71 return sizeof(g_control_thunks); | |
| 72 } | |
| 73 | |
| 74 extern "C" THUNK_EXPORT size_t MojoSetGLES2ImplThunks( | |
| 75 const MojoGLES2ImplThunks* gles2_impl_thunks) { | |
| 76 if (gles2_impl_thunks->size >= sizeof(g_impl_thunks)) | |
| 77 g_impl_thunks = *gles2_impl_thunks; | |
| 78 return sizeof(g_impl_thunks); | |
| 79 } | |
| 80 | |
| 81 } // extern "C" | |
| OLD | NEW |