blob: 7887349a9acb7c258aeb830c90c1f509be857de4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/public/gles2/gles2_private.h"
#include <assert.h>
#include <stddef.h>
#include "mojo/public/c/gles2/gles2.h"
#include "mojo/public/gles2/gles2_interface.h"
static mojo::GLES2Support* g_gles2_support = NULL;
static mojo::GLES2Interface* g_gles2_interface = NULL;
extern "C" {
void MojoGLES2Initialize(MojoAsyncWaiter* async_waiter) {
assert(g_gles2_support);
return g_gles2_support->Initialize(async_waiter);
}
void MojoGLES2Terminate() {
assert(g_gles2_support);
return g_gles2_support->Terminate();
}
MojoGLES2Context MojoGLES2CreateContext(
MojoHandle handle,
MojoGLES2ContextLost lost_callback,
MojoGLES2DrawAnimationFrame animation_callback,
void* closure) {
return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle),
lost_callback,
animation_callback,
closure);
}
void MojoGLES2DestroyContext(MojoGLES2Context context) {
return g_gles2_support->DestroyContext(context);
}
void MojoGLES2MakeCurrent(MojoGLES2Context context) {
assert(g_gles2_support);
g_gles2_support->MakeCurrent(context);
g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext();
}
void MojoGLES2SwapBuffers() {
assert(g_gles2_support);
return g_gles2_support->SwapBuffers();
}
void MojoGLES2RequestAnimationFrames(MojoGLES2Context context) {
assert(g_gles2_support);
return g_gles2_support->RequestAnimationFrames(context);
}
void MojoGLES2CancelAnimationFrames(MojoGLES2Context context) {
assert(g_gles2_support);
return g_gles2_support->CancelAnimationFrames(context);
}
void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) {
assert(g_gles2_support);
return g_gles2_support->GetGLES2Interface(context);
}
void* MojoGLES2GetContextSupport(MojoGLES2Context context) {
assert(g_gles2_support);
return g_gles2_support->GetContextSupport(context);
}
#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
ReturnType gl##Function PARAMETERS { \
return g_gles2_interface->Function ARGUMENTS; \
}
#include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
#undef VISIT_GL_CALL
} // extern "C"
namespace mojo {
GLES2Support::~GLES2Support() {}
void GLES2Support::Init(GLES2Support* gles2_support) {
assert(!g_gles2_support);
g_gles2_support = gles2_support;
}
} // namespace mojo
|