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_ |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Initialize the GGL library. This must have completed before any other GGL | 31 // Initialize the GGL library. This must have completed before any other GGL |
32 // functions are invoked. | 32 // functions are invoked. |
33 bool Initialize(); | 33 bool Initialize(); |
34 | 34 |
35 // Terminate the GGL library. This must be called after any other GGL functions | 35 // Terminate the GGL library. This must be called after any other GGL functions |
36 // have completed. | 36 // have completed. |
37 bool Terminate(); | 37 bool Terminate(); |
38 | 38 |
39 // Create a GGL context that renders directly to a view. | 39 // Create a GGL context that renders directly to a view. |
40 Context* CreateViewContext(GpuChannelHost* channel, gfx::NativeViewId view); | 40 // |
| 41 // NOTE: on Mac OS X, this entry point is only used to set up the |
| 42 // accelerated compositor's output. On this platform, we actually pass |
| 43 // a gfx::PluginWindowHandle in place of the gfx::NativeViewId, |
| 44 // because the facility to allocate a fake PluginWindowHandle is |
| 45 // already in place. We could add more entry points and messages to |
| 46 // allocate both fake PluginWindowHandles and NativeViewIds and map |
| 47 // from fake NativeViewIds to PluginWindowHandles, but this seems like |
| 48 // unnecessary complexity at the moment. |
| 49 // |
| 50 // The render_view_id is currently also only used on Mac OS X. |
| 51 // TODO(kbr): clean up the arguments to this function and make them |
| 52 // more cross-platform. |
| 53 Context* CreateViewContext(GpuChannelHost* channel, |
| 54 gfx::NativeViewId view, |
| 55 int render_view_id); |
| 56 |
| 57 #if defined(OS_MACOSX) |
| 58 // On Mac OS X only, view contexts actually behave like offscreen contexts, and |
| 59 // require an explicit resize operation which is slightly different from that |
| 60 // of offscreen contexts. |
| 61 void ResizeOnscreenContext(Context* context, const gfx::Size& size); |
| 62 #endif |
41 | 63 |
42 // Create a GGL context that renders to an offscreen frame buffer. If parent is | 64 // Create a GGL context that renders to an offscreen frame buffer. If parent is |
43 // not NULL, that context can access a copy of the created | 65 // not NULL, that context can access a copy of the created |
44 // context's frame buffer that is updated every time SwapBuffers is called. It | 66 // context's frame buffer that is updated every time SwapBuffers is called. It |
45 // is not as general as shared contexts in other implementations of OpenGL. If | 67 // is not as general as shared contexts in other implementations of OpenGL. If |
46 // parent is not NULL, it must be used on the same thread as the parent. A child | 68 // parent is not NULL, it must be used on the same thread as the parent. A child |
47 // context may not outlive its parent. | 69 // context may not outlive its parent. |
48 Context* CreateOffscreenContext(GpuChannelHost* channel, | 70 Context* CreateOffscreenContext(GpuChannelHost* channel, |
49 Context* parent, | 71 Context* parent, |
50 const gfx::Size& size); | 72 const gfx::Size& size); |
(...skipping 27 matching lines...) Expand all Loading... |
78 | 100 |
79 // TODO(gman): Remove this | 101 // TODO(gman): Remove this |
80 void DisableShaderTranslation(Context* context); | 102 void DisableShaderTranslation(Context* context); |
81 | 103 |
82 // Return the current GGL error. | 104 // Return the current GGL error. |
83 Error GetError(); | 105 Error GetError(); |
84 | 106 |
85 } // namespace ggl | 107 } // namespace ggl |
86 | 108 |
87 #endif // CHROME_RENDERER_GGL_GGL_H_ | 109 #endif // CHROME_RENDERER_GGL_GGL_H_ |
OLD | NEW |