OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/public/gles2/gles2_private.h" | 5 #include "mojo/public/gles2/gles2_private.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "mojo/public/c/gles2/gles2.h" | 10 #include "mojo/public/c/gles2/gles2.h" |
11 #include "mojo/public/gles2/gles2_interface.h" | 11 #include "mojo/public/gles2/gles2_interface.h" |
12 | 12 |
13 static mojo::GLES2Support* g_gles2_support = NULL; | 13 static mojo::GLES2Support* g_gles2_support = NULL; |
14 static mojo::GLES2Interface* g_gles2_interface = NULL; | 14 static mojo::GLES2Interface* g_gles2_interface = NULL; |
15 | 15 |
16 extern "C" { | 16 extern "C" { |
17 | 17 |
18 void MojoGLES2Initialize(const MojoAsyncWaiter* async_waiter) { | |
19 assert(g_gles2_support); | |
20 return g_gles2_support->Initialize(async_waiter); | |
21 } | |
22 | |
23 void MojoGLES2Terminate() { | |
24 assert(g_gles2_support); | |
25 return g_gles2_support->Terminate(); | |
26 } | |
27 | |
28 MojoGLES2Context MojoGLES2CreateContext( | 18 MojoGLES2Context MojoGLES2CreateContext( |
29 MojoHandle handle, | 19 MojoHandle handle, |
30 MojoGLES2ContextLost lost_callback, | 20 MojoGLES2ContextLost lost_callback, |
31 void* closure) { | 21 void* closure, |
| 22 const MojoAsyncWaiter* async_waiter) { |
32 return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle), | 23 return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle), |
33 lost_callback, | 24 lost_callback, |
34 closure); | 25 closure, |
| 26 async_waiter); |
35 } | 27 } |
36 | 28 |
37 void MojoGLES2DestroyContext(MojoGLES2Context context) { | 29 void MojoGLES2DestroyContext(MojoGLES2Context context) { |
38 return g_gles2_support->DestroyContext(context); | 30 return g_gles2_support->DestroyContext(context); |
39 } | 31 } |
40 | 32 |
41 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | 33 void MojoGLES2MakeCurrent(MojoGLES2Context context) { |
42 assert(g_gles2_support); | 34 assert(g_gles2_support); |
43 g_gles2_support->MakeCurrent(context); | 35 g_gles2_support->MakeCurrent(context); |
44 g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext(); | 36 g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext(); |
(...skipping 26 matching lines...) Expand all Loading... |
71 namespace mojo { | 63 namespace mojo { |
72 | 64 |
73 GLES2Support::~GLES2Support() {} | 65 GLES2Support::~GLES2Support() {} |
74 | 66 |
75 void GLES2Support::Init(GLES2Support* gles2_support) { | 67 void GLES2Support::Init(GLES2Support* gles2_support) { |
76 assert(!g_gles2_support); | 68 assert(!g_gles2_support); |
77 g_gles2_support = gles2_support; | 69 g_gles2_support = gles2_support; |
78 } | 70 } |
79 | 71 |
80 } // namespace mojo | 72 } // namespace mojo |
OLD | NEW |