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