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.
5 #include "mojo/public/gles2/gles2_private.h"
10 #include "mojo/public/c/gles2/gles2.h"
11 #include "mojo/public/gles2/gles2_interface.h"
13 static mojo::GLES2Support* g_gles2_support = NULL;
14 static mojo::GLES2Interface* g_gles2_interface = NULL;
18 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) {
19 assert(g_gles2_support);
20 return g_gles2_support->Initialize(async_waiter);
23 void MojoGLES2Terminate() {
24 assert(g_gles2_support);
25 return g_gles2_support->Terminate();
28 MojoGLES2Context MojoGLES2CreateContext(
30 MojoGLES2ContextLost lost_callback,
31 MojoGLES2DrawAnimationFrame animation_callback,
33 return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle),
39 void MojoGLES2DestroyContext(MojoGLES2Context context) {
40 return g_gles2_support->DestroyContext(context);
43 void MojoGLES2MakeCurrent(MojoGLES2Context context) {
44 assert(g_gles2_support);
45 g_gles2_support->MakeCurrent(context);
46 g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext();
49 void MojoGLES2SwapBuffers() {
50 assert(g_gles2_support);
51 return g_gles2_support->SwapBuffers();
54 void MojoGLES2RequestAnimationFrames(MojoGLES2Context context) {
55 assert(g_gles2_support);
56 return g_gles2_support->RequestAnimationFrames(context);
59 void MojoGLES2CancelAnimationFrames(MojoGLES2Context context) {
60 assert(g_gles2_support);
61 return g_gles2_support->CancelAnimationFrames(context);
64 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) {
65 assert(g_gles2_support);
66 return g_gles2_support->GetGLES2Interface(context);
69 void* MojoGLES2GetContextSupport(MojoGLES2Context context) {
70 assert(g_gles2_support);
71 return g_gles2_support->GetContextSupport(context);
74 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
75 ReturnType gl##Function PARAMETERS { \
76 return g_gles2_interface->Function ARGUMENTS; \
78 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
85 GLES2Support::~GLES2Support() {}
87 void GLES2Support::Init(GLES2Support* gles2_support) {
88 assert(!g_gles2_support);
89 g_gles2_support = gles2_support;