Index: mojo/public/platform/nacl/mojo_irt.h |
diff --git a/mojo/public/platform/nacl/mojo_irt.h b/mojo/public/platform/nacl/mojo_irt.h |
index db3a180ffd333748115a2fc18647b4360d56271b..58889f39ace60426fb839bcdd5bcd36081d22b76 100644 |
--- a/mojo/public/platform/nacl/mojo_irt.h |
+++ b/mojo/public/platform/nacl/mojo_irt.h |
@@ -8,6 +8,9 @@ |
#ifndef MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_ |
#define MOJO_PUBLIC_PLATFORM_NACL_MOJO_IRT_H_ |
+#include "mojo/public/c/gpu/MGL/mgl.h" |
+#include "mojo/public/c/gpu/MGL/mgl_onscreen.h" |
+#include "mojo/public/c/gpu/MGL/mgl_signal_sync_point.h" |
#include "mojo/public/c/system/buffer.h" |
#include "mojo/public/c/system/data_pipe.h" |
#include "mojo/public/c/system/message_pipe.h" |
@@ -85,6 +88,68 @@ struct nacl_irt_mojo { |
MojoResult (*_MojoGetInitialHandle)(MojoHandle* handle); |
}; |
+#define NACL_IRT_MGL_v0_1 "nacl-irt-mgl-0.1" |
+ |
+struct nacl_irt_mgl { |
+ // Creates a context at the given API version or returns MGL_NO_CONTEXT. |
+ // |command_buffer_handle| must be a command buffer message pipe handle from |
+ // the Gpu service or another source. The callee takes ownership of this |
+ // handle. |
+ // |share_group| specifies the share group to create this context in. If this |
+ // is MGL_NO_CONTEXT a new share group will be created for this context. |
+ // |lost_callback|, if not null, will be invoked when the context is lost. |
+ // |async_waiter| must be a pointer to a MojoAsyncWaiter implementation that |
+ // is usable from any thread the returned MGLContext will be used from for as |
+ // long as the context exists. |
+ MGLContext (*MGLCreateContext)(MGLOpenGLAPIVersion version, |
+ MojoHandle command_buffer_handle, |
+ MGLContext share_group, |
+ MGLContextLostCallback lost_callback, |
+ void* lost_callback_closure, |
+ const struct MojoAsyncWaiter* async_waiter); |
+ |
+ // Destroys the |context|. |
+ void (*MGLDestroyContext)(MGLContext context); |
+ |
+ // Makes |context| the current MGLContext for the calling thread. Calling with |
+ // MGL_NO_CONTEXT clears the current context. |
+ void (*MGLMakeCurrent)(MGLContext context); |
+ |
+ // Returns the currently bound context for the calling thread or |
+ // MGL_NO_CONTEXT if there is none. |
+ MGLContext (*MGLGetCurrentContext)(void); |
+ |
+ // Returns GL function usable in any context that advertise the corresponding |
+ // extension in their GL_EXTENSIONS string, or null for functions that the |
+ // implementation does not support. The implementation only advertises GL |
+ // functions. |
+ // |name| is the name of the GL function. |
+ MGLMustCastToProperFunctionPointerType (*MGLGetProcAddress)(const char* name); |
+}; |
+ |
+#define NACL_IRT_MGL_ONSCREEN_v0_1 "nacl-irt-mgl-onscreen-0.1" |
+ |
+struct nacl_irt_mgl_onscreen { |
+ // Resizes the default framebuffer for the currently bound onscreen |
+ // MGLContext. |
+ void (*MGLResizeSurface)(uint32_t width, uint32_t height); |
+ |
+ // Presents the default framebuffer for the currently bound onscreen |
+ // MGLContext to the windowing system or display. |
+ void (*MGLSwapBuffers)(void); |
+}; |
+ |
+#define NACL_IRT_MGL_SIGNAL_SYNC_POINT_v0_1 "nacl-irt-mgl-signal-sync-point-0.1" |
+ |
+struct nacl_irt_mgl_signal_sync_point { |
+ // MGLSignalSyncPoint signals the given sync point in the current context and |
+ // invokes |callback| when the service side acknowleges that the sync point |
+ // has been passed. |
+ void (*MGLSignalSyncPoint)(uint32_t sync_point, |
+ MGLSignalSyncPointCallback callback, |
+ void* closure); |
+}; |
+ |
#ifdef __cplusplus |
extern "C" { |
#endif |