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 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ | |
6 #define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include "mojo/public/c/gles2/gles2.h" | |
11 | |
12 // Structure used to bind the GLES2 functions of a DSO to theose of the | |
13 // embedder. | |
14 // This is the ABI between the embedder and the DSO. It can only have new | |
15 // functions added to the end. No other changes are supported. | |
16 #pragma pack(push, 8) | |
17 struct MojoGLES2Thunks { | |
18 size_t size; // Should be set to sizeof(MojoGLES2Thunks). | |
19 | |
20 void (*GLES2Initialize)(const MojoAsyncWaiter* async_waiter); | |
21 void (*GLES2Terminate)(void); | |
22 MojoGLES2Context (*GLES2CreateContext)( | |
23 MojoHandle handle, | |
24 MojoGLES2ContextLost lost_callback, | |
25 void* closure); | |
26 void (*GLES2DestroyContext)(MojoGLES2Context context); | |
27 void (*GLES2MakeCurrent)(MojoGLES2Context context); | |
28 void (*GLES2SwapBuffers)(void); | |
29 | |
30 // TODO(piman): We shouldn't have to leak those 2 interfaces, especially in a | |
31 // type-unsafe way. | |
32 void* (*GLES2GetGLES2Interface)(MojoGLES2Context context); | |
33 void* (*GLES2GetContextSupport)(MojoGLES2Context context); | |
34 | |
35 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | |
36 ReturnType (*Function) PARAMETERS; | |
37 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | |
viettrungluu
2014/07/28 22:11:05
Is this resilient to changes? Is autogen going to
Elliot Glaysher
2014/07/28 22:21:27
The functions added from gles2_call_visitor_autoge
| |
38 #undef VISIT_GL_CALL | |
39 }; | |
40 #pragma pack(pop) | |
41 | |
42 // Intended to be called from the embedder. Returns a |MojoCore| initialized | |
43 // to contain pointers to each of the embedder's MojoCore functions. | |
44 inline MojoGLES2Thunks MojoMakeGLES2Thunks() { | |
45 MojoGLES2Thunks gles2_thunks = { | |
46 sizeof(MojoGLES2Thunks), | |
47 MojoGLES2Initialize, | |
48 MojoGLES2Terminate, | |
49 MojoGLES2CreateContext, | |
50 MojoGLES2DestroyContext, | |
51 MojoGLES2MakeCurrent, | |
52 MojoGLES2SwapBuffers, | |
53 MojoGLES2GetGLES2Interface, | |
54 MojoGLES2GetContextSupport, | |
55 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | |
56 gl##Function, | |
57 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | |
58 #undef VISIT_GL_CALL | |
59 }; | |
60 | |
61 return gles2_thunks; | |
62 } | |
63 | |
64 // Use this type for the function found by dynamically discovering it in | |
65 // a DSO linked with mojo_system. For example: | |
66 // MojoSetGLES2ThunksFn mojo_set_gles2_thunks_fn = | |
67 // reinterpret_cast<MojoSetGLES2ThunksFn>(app_library.GetFunctionPointer( | |
68 // "MojoSetGLES2Thunks")); | |
69 // The expected size of |gles2_thunks} is returned. | |
70 // The contents of |gles2_thunks| are copied. | |
71 typedef size_t (*MojoSetGLES2ThunksFn)(const MojoGLES2Thunks* gles2_thunks); | |
72 | |
73 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ | |
OLD | NEW |