| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Note: This header should be compilable as C. | |
| 6 | |
| 7 #ifndef MOJO_PUBLIC_C_INCLUDE_MGL_MGL_H_ | |
| 8 #define MOJO_PUBLIC_C_INCLUDE_MGL_MGL_H_ | |
| 9 | |
| 10 #include <MGL/mgl_types.h> | |
| 11 #include <mojo/macros.h> | |
| 12 #include <mojo/system/handle.h> | |
| 13 #include <stdint.h> | |
| 14 | |
| 15 MOJO_BEGIN_EXTERN_C | |
| 16 | |
| 17 typedef uint32_t MGLOpenGLAPIVersion; | |
| 18 | |
| 19 // OpenGL ES 2.0 | |
| 20 #define MGL_API_VERSION_GLES2 ((MGLOpenGLAPIVersion)1) | |
| 21 // OpenGL ES 3.0 | |
| 22 #define MGL_API_VERSION_GLES3 ((MGLOpenGLAPIVersion)2) | |
| 23 // OpenGL ES 3.1 | |
| 24 #define MGL_API_VERSION_GLES31 ((MGLOpenGLAPIVersion)3) | |
| 25 | |
| 26 #define MGL_NO_CONTEXT ((MGLContext)0) | |
| 27 | |
| 28 struct MojoAsyncWaiter; | |
| 29 | |
| 30 // Creates a context at the given API version or returns MGL_NO_CONTEXT. | |
| 31 // |command_buffer_handle| must be a command buffer message pipe handle from | |
| 32 // the Gpu service or another source. The callee takes ownership of this | |
| 33 // handle. | |
| 34 // |share_group| specifies the share group to create this context in. | |
| 35 // If this is MGL_NO_CONTEXT a new share group will be created for this context. | |
| 36 // |lost_callback|, if not null, will be invoked when the context is lost. | |
| 37 // |async_waiter| must be a pointer to a MojoAsyncWaiter implementation that is | |
| 38 // usable from any thread the returned MGLContext will be used from | |
| 39 // for as long as the context exists. | |
| 40 MGLContext MGLCreateContext(MGLOpenGLAPIVersion version, | |
| 41 MojoHandle command_buffer_handle, | |
| 42 MGLContext share_group, | |
| 43 MGLContextLostCallback lost_callback, | |
| 44 void* lost_callback_closure, | |
| 45 const struct MojoAsyncWaiter* async_waiter); | |
| 46 void MGLDestroyContext(MGLContext context); | |
| 47 | |
| 48 // Makes |context| the current MGLContext for the calling thread. Calling with | |
| 49 // MGL_NO_CONTEXT clears the current context. | |
| 50 void MGLMakeCurrent(MGLContext context); | |
| 51 | |
| 52 // Returns the currently bound context for the calling thread or MGL_NO_CONTEXT | |
| 53 // if there is none. | |
| 54 MGLContext MGLGetCurrentContext(void); | |
| 55 | |
| 56 // Returns GL function usable in any context that advertise the corresponding | |
| 57 // extension in their GL_EXTENSIONS string, or null for functions that the | |
| 58 // implementation does not support. The implementation only advertises GL | |
| 59 // functions. | |
| 60 // |name| is the name of the GL function. | |
| 61 MGLMustCastToProperFunctionPointerType MGLGetProcAddress(const char* name); | |
| 62 | |
| 63 MOJO_END_EXTERN_C | |
| 64 | |
| 65 #endif // MOJO_PUBLIC_C_INCLUDE_MGL_MGL_H_ | |
| OLD | NEW |