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" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 void MojoGLES2Terminate() { | 23 void MojoGLES2Terminate() { |
24 assert(g_gles2_support); | 24 assert(g_gles2_support); |
25 return g_gles2_support->Terminate(); | 25 return g_gles2_support->Terminate(); |
26 } | 26 } |
27 | 27 |
28 MojoGLES2Context MojoGLES2CreateContext( | 28 MojoGLES2Context MojoGLES2CreateContext( |
29 MojoHandle handle, | 29 MojoHandle handle, |
30 MojoGLES2ContextLost lost_callback, | 30 MojoGLES2ContextLost lost_callback, |
31 MojoGLES2DrawAnimationFrame animation_callback, | |
32 void* closure) { | 31 void* closure) { |
33 return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle), | 32 return g_gles2_support->CreateContext(mojo::MessagePipeHandle(handle), |
34 lost_callback, | 33 lost_callback, |
35 animation_callback, | |
36 closure); | 34 closure); |
37 } | 35 } |
38 | 36 |
39 void MojoGLES2DestroyContext(MojoGLES2Context context) { | 37 void MojoGLES2DestroyContext(MojoGLES2Context context) { |
40 return g_gles2_support->DestroyContext(context); | 38 return g_gles2_support->DestroyContext(context); |
41 } | 39 } |
42 | 40 |
43 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | 41 void MojoGLES2MakeCurrent(MojoGLES2Context context) { |
44 assert(g_gles2_support); | 42 assert(g_gles2_support); |
45 g_gles2_support->MakeCurrent(context); | 43 g_gles2_support->MakeCurrent(context); |
46 g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext(); | 44 g_gles2_interface = g_gles2_support->GetGLES2InterfaceForCurrentContext(); |
47 } | 45 } |
48 | 46 |
49 void MojoGLES2SwapBuffers() { | 47 void MojoGLES2SwapBuffers() { |
50 assert(g_gles2_support); | 48 assert(g_gles2_support); |
51 return g_gles2_support->SwapBuffers(); | 49 return g_gles2_support->SwapBuffers(); |
52 } | 50 } |
53 | 51 |
54 void MojoGLES2RequestAnimationFrames(MojoGLES2Context context) { | |
55 assert(g_gles2_support); | |
56 return g_gles2_support->RequestAnimationFrames(context); | |
57 } | |
58 | |
59 void MojoGLES2CancelAnimationFrames(MojoGLES2Context context) { | |
60 assert(g_gles2_support); | |
61 return g_gles2_support->CancelAnimationFrames(context); | |
62 } | |
63 | |
64 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { | 52 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) { |
65 assert(g_gles2_support); | 53 assert(g_gles2_support); |
66 return g_gles2_support->GetGLES2Interface(context); | 54 return g_gles2_support->GetGLES2Interface(context); |
67 } | 55 } |
68 | 56 |
69 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { | 57 void* MojoGLES2GetContextSupport(MojoGLES2Context context) { |
70 assert(g_gles2_support); | 58 assert(g_gles2_support); |
71 return g_gles2_support->GetContextSupport(context); | 59 return g_gles2_support->GetContextSupport(context); |
72 } | 60 } |
73 | 61 |
74 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | 62 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ |
75 ReturnType gl##Function PARAMETERS { \ | 63 ReturnType gl##Function PARAMETERS { \ |
76 return g_gles2_interface->Function ARGUMENTS; \ | 64 return g_gles2_interface->Function ARGUMENTS; \ |
77 } | 65 } |
78 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | 66 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" |
79 #undef VISIT_GL_CALL | 67 #undef VISIT_GL_CALL |
80 | 68 |
81 } // extern "C" | 69 } // extern "C" |
82 | 70 |
83 namespace mojo { | 71 namespace mojo { |
84 | 72 |
85 GLES2Support::~GLES2Support() {} | 73 GLES2Support::~GLES2Support() {} |
86 | 74 |
87 void GLES2Support::Init(GLES2Support* gles2_support) { | 75 void GLES2Support::Init(GLES2Support* gles2_support) { |
88 assert(!g_gles2_support); | 76 assert(!g_gles2_support); |
89 g_gles2_support = gles2_support; | 77 g_gles2_support = gles2_support; |
90 } | 78 } |
91 | 79 |
92 } // namespace mojo | 80 } // namespace mojo |
OLD | NEW |