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

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

Issue 1354353002: Add GetProcAddress to OpenGL control interface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Use deps instead of source Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_MGL_THUNKS_H_ 5 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
6 #define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_ 6 #define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "mojo/public/c/gpu/MGL/mgl.h" 10 #include "mojo/public/c/gpu/MGL/mgl.h"
11 11
12 // Structure used to bind the interface which manipulates MGL contexts to a 12 // Structure used to bind the interface which manipulates MGL contexts 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 MGLThunks { 18 struct MGLThunks {
19 size_t size; // Should be set to sizeof(MGLThunks). 19 size_t size; // Should be set to sizeof(MGLThunks).
20 20
21 MGLContext (*MGLCreateContext)(MGLOpenGLAPIVersion version, 21 MGLContext (*MGLCreateContext)(MGLOpenGLAPIVersion version,
22 MojoHandle command_buffer_handle, 22 MojoHandle command_buffer_handle,
23 MGLContext share_group, 23 MGLContext share_group,
24 MGLContextLostCallback lost_callback, 24 MGLContextLostCallback lost_callback,
25 void* lost_callback_closure, 25 void* lost_callback_closure,
26 const struct MojoAsyncWaiter* async_waiter); 26 const struct MojoAsyncWaiter* async_waiter);
27 void (*MGLDestroyContext)(MGLContext context); 27 void (*MGLDestroyContext)(MGLContext context);
28 void (*MGLMakeCurrent)(MGLContext context); 28 void (*MGLMakeCurrent)(MGLContext context);
29 MGLContext (*MGLGetCurrentContext)(void); 29 MGLContext (*MGLGetCurrentContext)(void);
30 MGLMustCastToProperFunctionPointerType (*MGLGetProcAddress)(const char* name);
30 }; 31 };
31 #pragma pack(pop) 32 #pragma pack(pop)
32 33
33 // Intended to be called from the embedder. Returns an object initialized to 34 // Intended to be called from the embedder. Returns an object initialized to
34 // contain pointers to each of the embedder's MGLThunks functions. 35 // contain pointers to each of the embedder's MGLThunks functions.
35 inline struct MGLThunks MojoMakeMGLThunks() { 36 inline struct MGLThunks MojoMakeMGLThunks() {
36 struct MGLThunks mgl_thunks = { 37 struct MGLThunks mgl_thunks = {
37 sizeof(struct MGLThunks), 38 sizeof(struct MGLThunks),
38 MGLCreateContext, 39 MGLCreateContext,
39 MGLDestroyContext, 40 MGLDestroyContext,
40 MGLMakeCurrent, 41 MGLMakeCurrent,
41 MGLGetCurrentContext, 42 MGLGetCurrentContext,
43 MGLGetProcAddress,
42 }; 44 };
43 45
44 return mgl_thunks; 46 return mgl_thunks;
45 } 47 }
46 48
47 // Use this type for the function found by dynamically discovering it in 49 // Use this type for the function found by dynamically discovering it in
48 // a DSO linked with mojo_system. For example: 50 // a DSO linked with mojo_system. For example:
49 // MojoSetMGLThunksFn mojo_set_gles2_thunks_fn = 51 // MojoSetMGLThunksFn mojo_set_gles2_thunks_fn =
50 // reinterpret_cast<MojoSetMGLThunksFn>( 52 // reinterpret_cast<MojoSetMGLThunksFn>(
51 // app_library.GetFunctionPointer("MojoSetMGLThunks")); 53 // app_library.GetFunctionPointer("MojoSetMGLThunks"));
52 // The expected size of |mgl_thunks| is returned. 54 // The expected size of |mgl_thunks| is returned.
53 // The contents of |mgl_thunks| are copied. 55 // The contents of |mgl_thunks| are copied.
54 typedef size_t (*MojoSetMGLThunksFn)(const struct MGLThunks* mgl_thunks); 56 typedef size_t (*MojoSetMGLThunksFn)(const struct MGLThunks* mgl_thunks);
55 57
56 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_ 58 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
OLDNEW
« no previous file with comments | « mojo/public/platform/native/gles2/call_visitor.h ('k') | mojo/public/platform/native/mgl_thunks.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698