OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This API is consistent with other OpenGL setup APIs like window's WGL | 5 // This API is consistent with other OpenGL setup APIs like window's WGL |
6 // and pepper's PGL. This API is used to manage OpenGL contexts in the Chrome | 6 // and pepper's PGL. This API is used to manage OpenGL contexts in the Chrome |
7 // renderer process in a way that is consistent with other platforms. It is | 7 // renderer process in a way that is consistent with other platforms. It is |
8 // a C style API to ease porting of existing OpenGL software to Chrome. | 8 // a C style API to ease porting of existing OpenGL software to Chrome. |
9 | 9 |
10 #ifndef CHROME_RENDERER_GGL_GGL_H_ | 10 #ifndef CHROME_RENDERER_GGL_GGL_H_ |
11 #define CHROME_RENDERER_GGL_GGL_H_ | 11 #define CHROME_RENDERER_GGL_GGL_H_ |
12 #pragma once | 12 #pragma once |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "gfx/native_widget_types.h" | 15 #include "gfx/native_widget_types.h" |
16 #include "gfx/size.h" | 16 #include "gfx/size.h" |
17 | 17 |
18 class GpuChannelHost; | 18 class GpuChannelHost; |
19 class MessageLoop; | 19 class MessageLoop; |
20 | 20 |
| 21 namespace gpu { |
| 22 namespace gles2 { |
| 23 class GLES2Implementation; |
| 24 } |
| 25 } |
| 26 |
21 namespace media { | 27 namespace media { |
22 class VideoDecodeContext; | 28 class VideoDecodeContext; |
23 class VideoDecodeEngine; | 29 class VideoDecodeEngine; |
24 } | 30 } |
25 | 31 |
26 namespace ggl { | 32 namespace ggl { |
27 | 33 |
28 class Context; | 34 class Context; |
29 | 35 |
30 // These are the same error codes as used by EGL. | 36 // These are the same error codes as used by EGL. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 119 |
114 // Create a new texture in the parent's context. Returns zero if context | 120 // Create a new texture in the parent's context. Returns zero if context |
115 // does not have a parent. | 121 // does not have a parent. |
116 uint32 CreateParentTexture(Context* context, const gfx::Size& size); | 122 uint32 CreateParentTexture(Context* context, const gfx::Size& size); |
117 | 123 |
118 // Deletes a texture in the parent's context. | 124 // Deletes a texture in the parent's context. |
119 void DeleteParentTexture(Context* context, uint32 texture); | 125 void DeleteParentTexture(Context* context, uint32 texture); |
120 | 126 |
121 // Provides a callback that will be invoked when SwapBuffers has completed | 127 // Provides a callback that will be invoked when SwapBuffers has completed |
122 // service side. | 128 // service side. |
123 void SetSwapBuffersCallback(Context* context, | 129 void SetSwapBuffersCallback(Context* context, Callback0::Type* callback); |
124 Callback1<Context*>::Type* callback); | |
125 | 130 |
126 // Set the current GGL context for the calling thread. | 131 // Set the current GGL context for the calling thread. |
127 bool MakeCurrent(Context* context); | 132 bool MakeCurrent(Context* context); |
128 | 133 |
129 // Get the calling thread's current GGL context. | |
130 Context* GetCurrentContext(); | |
131 | |
132 // For a view context, display everything that has been rendered since the | 134 // For a view context, display everything that has been rendered since the |
133 // last call. For an offscreen context, resolve everything that has been | 135 // last call. For an offscreen context, resolve everything that has been |
134 // rendered since the last call to a copy that can be accessed by the parent | 136 // rendered since the last call to a copy that can be accessed by the parent |
135 // context. | 137 // context. |
136 bool SwapBuffers(Context* context); | 138 bool SwapBuffers(Context* context); |
137 | 139 |
138 // Destroy the given GGL context. | 140 // Destroy the given GGL context. |
139 bool DestroyContext(Context* context); | 141 bool DestroyContext(Context* context); |
140 | 142 |
141 // Create a hardware video decode engine corresponding to the context. | 143 // Create a hardware video decode engine corresponding to the context. |
142 media::VideoDecodeEngine* CreateVideoDecodeEngine(Context* context); | 144 media::VideoDecodeEngine* CreateVideoDecodeEngine(Context* context); |
143 | 145 |
144 // Create a hardware video decode context to pair with the hardware video | 146 // Create a hardware video decode context to pair with the hardware video |
145 // decode engine. It can also be used with a software decode engine. | 147 // decode engine. It can also be used with a software decode engine. |
146 // | 148 // |
147 // Set |hardware_decoder| to true if this context is for a hardware video | 149 // Set |hardware_decoder| to true if this context is for a hardware video |
148 // engine. |message_loop| is where the decode context should run on. | 150 // engine. |message_loop| is where the decode context should run on. |
149 media::VideoDecodeContext* CreateVideoDecodeContext(Context* context, | 151 media::VideoDecodeContext* CreateVideoDecodeContext(Context* context, |
150 MessageLoop* message_loop, | 152 MessageLoop* message_loop, |
151 bool hardware_decoder); | 153 bool hardware_decoder); |
152 | 154 |
153 // TODO(gman): Remove this | 155 // TODO(gman): Remove this |
154 void DisableShaderTranslation(Context* context); | 156 void DisableShaderTranslation(Context* context); |
155 | 157 |
| 158 // Allows direct access to the GLES2 implementation so a context |
| 159 // can be used without making it current. |
| 160 gpu::gles2::GLES2Implementation* GetImplementation(Context* context); |
| 161 |
156 // Return the current GGL error. | 162 // Return the current GGL error. |
157 Error GetError(); | 163 Error GetError(Context* context); |
158 | 164 |
159 } // namespace ggl | 165 } // namespace ggl |
160 | 166 |
161 #endif // CHROME_RENDERER_GGL_GGL_H_ | 167 #endif // CHROME_RENDERER_GGL_GGL_H_ |
OLD | NEW |