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