| 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 | |
| 15 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle, | |
| 16 MojoGLES2ContextLost lost_callback, | |
| 17 void* closure, | |
| 18 const MojoAsyncWaiter* async_waiter) { | |
| 19 assert(g_control_thunks.GLES2CreateContext); | |
| 20 return g_control_thunks.GLES2CreateContext( | |
| 21 handle, lost_callback, closure, async_waiter); | |
| 22 } | |
| 23 | |
| 24 void MojoGLES2DestroyContext(MojoGLES2Context context) { | |
| 25 assert(g_control_thunks.GLES2DestroyContext); | |
| 26 g_control_thunks.GLES2DestroyContext(context); | |
| 27 } | |
| 28 | |
| 29 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | |
| 30 assert(g_control_thunks.GLES2MakeCurrent); | |
| 31 g_control_thunks.GLES2MakeCurrent(context); | |
| 32 } | |
| 33 | |
| 34 void MojoGLES2SwapBuffers() { | |
| 35 assert(g_control_thunks.GLES2SwapBuffers); | |
| 36 g_control_thunks.GLES2SwapBuffers(); | |
| 37 } | |
| 38 | |
| 39 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { | |
| 40 assert(g_control_thunks.GLES2GetGLES2Interface); | |
| 41 return g_control_thunks.GLES2GetGLES2Interface(context); | |
| 42 } | |
| 43 | |
| 44 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { | |
| 45 assert(g_control_thunks.GLES2GetContextSupport); | |
| 46 return g_control_thunks.GLES2GetContextSupport(context); | |
| 47 } | |
| 48 | |
| 49 extern "C" THUNK_EXPORT size_t MojoSetGLES2ControlThunks( | |
| 50 const MojoGLES2ControlThunks* gles2_control_thunks) { | |
| 51 if (gles2_control_thunks->size >= sizeof(g_control_thunks)) | |
| 52 g_control_thunks = *gles2_control_thunks; | |
| 53 return sizeof(g_control_thunks); | |
| 54 } | |
| 55 | |
| 56 } // extern "C" | |
| OLD | NEW |