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.
5 #include "mojo/public/platform/native/gles2_thunks.h"
9 #include "mojo/public/platform/native/thunk_export.h"
13 static MojoGLES2ControlThunks g_control_thunks
= {0};
15 MojoGLES2Context
MojoGLES2CreateContext(MojoHandle handle
,
16 MojoGLES2ContextLost lost_callback
,
18 const MojoAsyncWaiter
* async_waiter
) {
19 assert(g_control_thunks
.GLES2CreateContext
);
20 return g_control_thunks
.GLES2CreateContext(
21 handle
, lost_callback
, closure
, async_waiter
);
24 void MojoGLES2DestroyContext(MojoGLES2Context context
) {
25 assert(g_control_thunks
.GLES2DestroyContext
);
26 g_control_thunks
.GLES2DestroyContext(context
);
29 void MojoGLES2MakeCurrent(MojoGLES2Context context
) {
30 assert(g_control_thunks
.GLES2MakeCurrent
);
31 g_control_thunks
.GLES2MakeCurrent(context
);
34 void MojoGLES2SwapBuffers() {
35 assert(g_control_thunks
.GLES2SwapBuffers
);
36 g_control_thunks
.GLES2SwapBuffers();
39 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context
) {
40 assert(g_control_thunks
.GLES2GetGLES2Interface
);
41 return g_control_thunks
.GLES2GetGLES2Interface(context
);
44 void* MojoGLES2GetContextSupport(MojoGLES2Context context
) {
45 assert(g_control_thunks
.GLES2GetContextSupport
);
46 return g_control_thunks
.GLES2GetContextSupport(context
);
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
);