Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: mojo/public/platform/native/gles2_thunks.h

Issue 413303002: mojo: Convert gles2 to the new thunking system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Split the set of thunks in two. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 interface which manipulates GLES2 surfaces to a
13 // DSO to theose of the embedder.
viettrungluu 2014/07/29 00:27:06 s/theose/those/
14 //
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.
17 #pragma pack(push, 8)
18 struct MojoGLES2ControlThunks {
19 size_t size; // Should be set to sizeof(MojoGLES2ControlThunks).
20
21 void (*GLES2Initialize)(const MojoAsyncWaiter* async_waiter);
22 void (*GLES2Terminate)(void);
viettrungluu 2014/07/29 00:27:06 This is actually C++ here; no extra "void" needed.
23 MojoGLES2Context (*GLES2CreateContext)(
24 MojoHandle handle,
25 MojoGLES2ContextLost lost_callback,
26 void* closure);
27 void (*GLES2DestroyContext)(MojoGLES2Context context);
28 void (*GLES2MakeCurrent)(MojoGLES2Context context);
29 void (*GLES2SwapBuffers)(void);
viettrungluu 2014/07/29 00:27:06 "
30
31 // TODO(piman): We shouldn't have to leak those 2 interfaces, especially in a
32 // type-unsafe way.
33 void* (*GLES2GetGLES2Interface)(MojoGLES2Context context);
34 void* (*GLES2GetContextSupport)(MojoGLES2Context context);
35 };
36
37 // Intended to be called from the embedder. Returns an object initialized to
38 // contain pointers to each of the embedder's MojoGLES2ControlThunks functions.
39 inline MojoGLES2ControlThunks MojoMakeGLES2ControlThunks() {
40 MojoGLES2ControlThunks gles2_control_thunks = {
41 sizeof(MojoGLES2ControlThunks),
42 MojoGLES2Initialize,
43 MojoGLES2Terminate,
44 MojoGLES2CreateContext,
45 MojoGLES2DestroyContext,
46 MojoGLES2MakeCurrent,
47 MojoGLES2SwapBuffers,
48 MojoGLES2GetGLES2Interface,
49 MojoGLES2GetContextSupport
50 };
51
52 return gles2_control_thunks;
53 }
54
55 // Use this type for the function found by dynamically discovering it in
56 // a DSO linked with mojo_system. For example:
57 // MojoSetGLES2ControlThunksFn mojo_set_gles2_control_thunks_fn =
58 // reinterpret_cast<MojoSetGLES2ControlThunksFn>(
59 // app_library.GetFunctionPointer("MojoSetGLES2ControlThunks"));
60 // The expected size of |gles2_control_thunks| is returned.
61 // The contents of |gles2_control_thunks| are copied.
62 typedef size_t (*MojoSetGLES2ControlThunksFn)(
63 const MojoGLES2ControlThunks* gles2_control_thunks);
64
65 // -----------------------------------------------------------------------------
66
67 // Like MojoGLES2ControlThunks, but specifies the frozen GLES2 API. Separated
68 // out as MojoGLES2ControlThunks may be modified and added to, but this
69 // interface is frozen.
70 struct MojoGLES2ImplThunks {
71 size_t size; // Should be set to sizeof(MojoGLES2ImplThunks).
72
73 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
74 ReturnType (*Function) PARAMETERS;
75 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
76 #undef VISIT_GL_CALL
77 };
78 #pragma pack(pop)
79
80 // Intended to be called from the embedder to get the embeder's implementation
viettrungluu 2014/07/29 00:27:06 s/embeder/embedder/
81 // of GLES2.
82 inline MojoGLES2ImplThunks MojoMakeGLES2ImplThunks() {
83 MojoGLES2ImplThunks gles2_impl_thunks = {
84 sizeof(MojoGLES2ImplThunks),
85 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
86 gl##Function,
87 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
88 #undef VISIT_GL_CALL
89 };
90
91 return gles2_impl_thunks;
92 }
93
94 // Use this type for the function found by dynamically discovering it in
95 // a DSO linked with mojo_system. For example:
96 // MojoSetGLES2ImplThunksFn mojo_set_gles2_impl_thunks_fn =
97 // reinterpret_cast<MojoSetGLES2ImplThunksFn>(
98 // app_library.GetFunctionPointer("MojoSetGLES2ImplThunks"));
99 // The expected size of |gles2_impl_thunks| is returned.
100 // The contents of |gles2_impl_thunks| are copied.
101 typedef size_t (*MojoSetGLES2ImplThunksFn)(
102 const MojoGLES2ImplThunks* gles2_impl_thunks);
103
104 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_THUNKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698