OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/public/platform/native/gles2_thunks.h" | 5 #include "mojo/public/platform/native/gles2_thunks.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 | 8 |
9 #include "mojo/public/platform/native/thunk_export.h" | 9 #include "mojo/public/platform/native/thunk_export.h" |
10 | 10 |
11 extern "C" { | 11 extern "C" { |
12 | 12 |
13 static MojoGLES2ControlThunks g_control_thunks = {0}; | 13 static MojoGLES2ControlThunks g_control_thunks = {0}; |
14 static MojoGLES2ImplThunks g_impl_thunks = {0}; | |
15 | 14 |
16 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle, | 15 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle, |
17 MojoGLES2ContextLost lost_callback, | 16 MojoGLES2ContextLost lost_callback, |
18 void* closure, | 17 void* closure, |
19 const MojoAsyncWaiter* async_waiter) { | 18 const MojoAsyncWaiter* async_waiter) { |
20 assert(g_control_thunks.GLES2CreateContext); | 19 assert(g_control_thunks.GLES2CreateContext); |
21 return g_control_thunks.GLES2CreateContext( | 20 return g_control_thunks.GLES2CreateContext( |
22 handle, lost_callback, closure, async_waiter); | 21 handle, lost_callback, closure, async_waiter); |
23 } | 22 } |
24 | 23 |
(...skipping 15 matching lines...) Expand all Loading... |
40 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { | 39 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { |
41 assert(g_control_thunks.GLES2GetGLES2Interface); | 40 assert(g_control_thunks.GLES2GetGLES2Interface); |
42 return g_control_thunks.GLES2GetGLES2Interface(context); | 41 return g_control_thunks.GLES2GetGLES2Interface(context); |
43 } | 42 } |
44 | 43 |
45 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { | 44 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { |
46 assert(g_control_thunks.GLES2GetContextSupport); | 45 assert(g_control_thunks.GLES2GetContextSupport); |
47 return g_control_thunks.GLES2GetContextSupport(context); | 46 return g_control_thunks.GLES2GetContextSupport(context); |
48 } | 47 } |
49 | 48 |
50 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | |
51 ReturnType gl##Function PARAMETERS { \ | |
52 assert(g_impl_thunks.Function); \ | |
53 return g_impl_thunks.Function ARGUMENTS; \ | |
54 } | |
55 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | |
56 #undef VISIT_GL_CALL | |
57 | |
58 extern "C" THUNK_EXPORT size_t MojoSetGLES2ControlThunks( | 49 extern "C" THUNK_EXPORT size_t MojoSetGLES2ControlThunks( |
59 const MojoGLES2ControlThunks* gles2_control_thunks) { | 50 const MojoGLES2ControlThunks* gles2_control_thunks) { |
60 if (gles2_control_thunks->size >= sizeof(g_control_thunks)) | 51 if (gles2_control_thunks->size >= sizeof(g_control_thunks)) |
61 g_control_thunks = *gles2_control_thunks; | 52 g_control_thunks = *gles2_control_thunks; |
62 return sizeof(g_control_thunks); | 53 return sizeof(g_control_thunks); |
63 } | 54 } |
64 | 55 |
65 extern "C" THUNK_EXPORT size_t MojoSetGLES2ImplThunks( | |
66 const MojoGLES2ImplThunks* gles2_impl_thunks) { | |
67 if (gles2_impl_thunks->size >= sizeof(g_impl_thunks)) | |
68 g_impl_thunks = *gles2_impl_thunks; | |
69 return sizeof(g_impl_thunks); | |
70 } | |
71 | |
72 } // extern "C" | 56 } // extern "C" |
OLD | NEW |