| 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 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) { | 15 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) { |
| 17 assert(g_control_thunks.GLES2Initialize); | 16 assert(g_control_thunks.GLES2Initialize); |
| 18 g_control_thunks.GLES2Initialize(async_waiter); | 17 g_control_thunks.GLES2Initialize(async_waiter); |
| 19 } | 18 } |
| 20 | 19 |
| 21 void MojoGLES2Terminate() { | 20 void MojoGLES2Terminate() { |
| 22 assert(g_control_thunks.GLES2Terminate); | 21 assert(g_control_thunks.GLES2Terminate); |
| 23 g_control_thunks.GLES2Terminate(); | 22 g_control_thunks.GLES2Terminate(); |
| 24 } | 23 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 49 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { | 48 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { |
| 50 assert(g_control_thunks.GLES2GetGLES2Interface); | 49 assert(g_control_thunks.GLES2GetGLES2Interface); |
| 51 return g_control_thunks.GLES2GetGLES2Interface(context); | 50 return g_control_thunks.GLES2GetGLES2Interface(context); |
| 52 } | 51 } |
| 53 | 52 |
| 54 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { | 53 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { |
| 55 assert(g_control_thunks.GLES2GetContextSupport); | 54 assert(g_control_thunks.GLES2GetContextSupport); |
| 56 return g_control_thunks.GLES2GetContextSupport(context); | 55 return g_control_thunks.GLES2GetContextSupport(context); |
| 57 } | 56 } |
| 58 | 57 |
| 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( | 58 extern "C" THUNK_EXPORT size_t MojoSetGLES2ControlThunks( |
| 68 const MojoGLES2ControlThunks* gles2_control_thunks) { | 59 const MojoGLES2ControlThunks* gles2_control_thunks) { |
| 69 if (gles2_control_thunks->size >= sizeof(g_control_thunks)) | 60 if (gles2_control_thunks->size >= sizeof(g_control_thunks)) |
| 70 g_control_thunks = *gles2_control_thunks; | 61 g_control_thunks = *gles2_control_thunks; |
| 71 return sizeof(g_control_thunks); | 62 return sizeof(g_control_thunks); |
| 72 } | 63 } |
| 73 | 64 |
| 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" | 65 } // extern "C" |
| OLD | NEW |