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 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ | 5 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ |
6 #define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ | 6 #define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "mojo/public/c/gles2/gles2.h" | 10 #include "mojo/public/c/gles2/gles2.h" |
11 | 11 |
12 // Structure used to bind the interface which manipulates GLES2 surfaces to a | 12 // Structure used to bind the interface which manipulates GLES2 surfaces to a |
13 // DSO to theose of the embedder. | 13 // DSO to theose of the embedder. |
14 // | 14 // |
15 // This is the ABI between the embedder and the DSO. It can only have new | 15 // This is the ABI between the embedder and the DSO. It can only have new |
16 // functions added to the end. No other changes are supported. | 16 // functions added to the end. No other changes are supported. |
17 #pragma pack(push, 8) | 17 #pragma pack(push, 8) |
18 struct MojoGLES2ControlThunks { | 18 struct MojoGLES2ControlThunks { |
19 size_t size; // Should be set to sizeof(MojoGLES2ControlThunks). | 19 size_t size; // Should be set to sizeof(MojoGLES2ControlThunks). |
20 | 20 |
21 void (*GLES2Initialize)(const MojoAsyncWaiter* async_waiter); | 21 MojoGLES2Context (*GLES2CreateContext)(MojoHandle handle, |
22 void (*GLES2Terminate)(); | 22 MojoGLES2ContextLost lost_callback, |
23 MojoGLES2Context (*GLES2CreateContext)( | 23 void* closure, |
24 MojoHandle handle, | 24 const MojoAsyncWaiter* async_waiter); |
25 MojoGLES2ContextLost lost_callback, | |
26 void* closure); | |
27 void (*GLES2DestroyContext)(MojoGLES2Context context); | 25 void (*GLES2DestroyContext)(MojoGLES2Context context); |
28 void (*GLES2MakeCurrent)(MojoGLES2Context context); | 26 void (*GLES2MakeCurrent)(MojoGLES2Context context); |
29 void (*GLES2SwapBuffers)(); | 27 void (*GLES2SwapBuffers)(); |
30 | 28 |
31 // TODO(piman): We shouldn't have to leak these 2 interfaces, especially in a | 29 // TODO(piman): We shouldn't have to leak these 2 interfaces, especially in a |
32 // type-unsafe way. | 30 // type-unsafe way. |
33 void* (*GLES2GetGLES2Interface)(MojoGLES2Context context); | 31 void* (*GLES2GetGLES2Interface)(MojoGLES2Context context); |
34 void* (*GLES2GetContextSupport)(MojoGLES2Context context); | 32 void* (*GLES2GetContextSupport)(MojoGLES2Context context); |
35 }; | 33 }; |
36 #pragma pack(pop) | 34 #pragma pack(pop) |
37 | 35 |
38 // Intended to be called from the embedder. Returns an object initialized to | 36 // Intended to be called from the embedder. Returns an object initialized to |
39 // contain pointers to each of the embedder's MojoGLES2ControlThunks functions. | 37 // contain pointers to each of the embedder's MojoGLES2ControlThunks functions. |
40 inline MojoGLES2ControlThunks MojoMakeGLES2ControlThunks() { | 38 inline MojoGLES2ControlThunks MojoMakeGLES2ControlThunks() { |
41 MojoGLES2ControlThunks gles2_control_thunks = { | 39 MojoGLES2ControlThunks gles2_control_thunks = { |
42 sizeof(MojoGLES2ControlThunks), | 40 sizeof(MojoGLES2ControlThunks), |
43 MojoGLES2Initialize, | |
44 MojoGLES2Terminate, | |
45 MojoGLES2CreateContext, | 41 MojoGLES2CreateContext, |
46 MojoGLES2DestroyContext, | 42 MojoGLES2DestroyContext, |
47 MojoGLES2MakeCurrent, | 43 MojoGLES2MakeCurrent, |
48 MojoGLES2SwapBuffers, | 44 MojoGLES2SwapBuffers, |
49 MojoGLES2GetGLES2Interface, | 45 MojoGLES2GetGLES2Interface, |
50 MojoGLES2GetContextSupport | 46 MojoGLES2GetContextSupport |
51 }; | 47 }; |
52 | 48 |
53 return gles2_control_thunks; | 49 return gles2_control_thunks; |
54 } | 50 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // a DSO linked with mojo_system. For example: | 93 // a DSO linked with mojo_system. For example: |
98 // MojoSetGLES2ImplThunksFn mojo_set_gles2_impl_thunks_fn = | 94 // MojoSetGLES2ImplThunksFn mojo_set_gles2_impl_thunks_fn = |
99 // reinterpret_cast<MojoSetGLES2ImplThunksFn>( | 95 // reinterpret_cast<MojoSetGLES2ImplThunksFn>( |
100 // app_library.GetFunctionPointer("MojoSetGLES2ImplThunks")); | 96 // app_library.GetFunctionPointer("MojoSetGLES2ImplThunks")); |
101 // The expected size of |gles2_impl_thunks| is returned. | 97 // The expected size of |gles2_impl_thunks| is returned. |
102 // The contents of |gles2_impl_thunks| are copied. | 98 // The contents of |gles2_impl_thunks| are copied. |
103 typedef size_t (*MojoSetGLES2ImplThunksFn)( | 99 typedef size_t (*MojoSetGLES2ImplThunksFn)( |
104 const MojoGLES2ImplThunks* gles2_impl_thunks); | 100 const MojoGLES2ImplThunks* gles2_impl_thunks); |
105 | 101 |
106 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ | 102 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_ |
OLD | NEW |