Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: content/renderer/gpu/renderer_gl_context.h

Issue 7205012: RendererGLContext supports reparenting a GL context. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 RendererGLContexts in the 6 // and pepper's PGL. This API is used to manage OpenGL RendererGLContexts in the
7 // Chrome renderer process in a way that is consistent with other platforms. 7 // Chrome renderer process in a way that is consistent with other platforms.
8 8
9 #ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ 9 #ifndef CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_
10 #define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ 10 #define CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Create a RendererGLContext that renders to an offscreen frame buffer. If 101 // Create a RendererGLContext that renders to an offscreen frame buffer. If
102 // parent is not NULL, that RendererGLContext can access a copy of the created 102 // parent is not NULL, that RendererGLContext can access a copy of the created
103 // RendererGLContext's frame buffer that is updated every time SwapBuffers is 103 // RendererGLContext's frame buffer that is updated every time SwapBuffers is
104 // called. It is not as general as shared RendererGLContexts in other 104 // called. It is not as general as shared RendererGLContexts in other
105 // implementations of OpenGL. If parent is not NULL, it must be used on the 105 // implementations of OpenGL. If parent is not NULL, it must be used on the
106 // same thread as the parent. A child RendererGLContext may not outlive its 106 // same thread as the parent. A child RendererGLContext may not outlive its
107 // parent. attrib_list must be NULL or a NONE-terminated list of 107 // parent. attrib_list must be NULL or a NONE-terminated list of
108 // attribute/value pairs. 108 // attribute/value pairs.
109 static RendererGLContext* CreateOffscreenContext( 109 static RendererGLContext* CreateOffscreenContext(
110 GpuChannelHost* channel, 110 GpuChannelHost* channel,
111 RendererGLContext* parent,
112 const gfx::Size& size, 111 const gfx::Size& size,
113 const char* allowed_extensions, 112 const char* allowed_extensions,
114 const int32* attrib_list, 113 const int32* attrib_list,
115 const GURL& active_url); 114 const GURL& active_url);
116 115
116 // Sets the parent context. If any parent textures have been created for
117 // another parent, it is important to delete them before changing the parent.
118 bool SetParent(RendererGLContext* parent);
119
117 // Resize an offscreen frame buffer. The resize occurs on the next call to 120 // Resize an offscreen frame buffer. The resize occurs on the next call to
118 // SwapBuffers. This is to avoid waiting until all pending GL calls have been 121 // SwapBuffers. This is to avoid waiting until all pending GL calls have been
119 // executed by the GPU process. Everything rendered up to the call to 122 // executed by the GPU process. Everything rendered up to the call to
120 // SwapBuffers will be lost. A lost RendererGLContext will be reported if the 123 // SwapBuffers will be lost. A lost RendererGLContext will be reported if the
121 // resize fails. 124 // resize fails.
122 void ResizeOffscreen(const gfx::Size& size); 125 void ResizeOffscreen(const gfx::Size& size);
123 126
124 // For an offscreen frame buffer RendererGLContext, return the texture ID with 127 // For an offscreen frame buffer RendererGLContext, return the texture ID with
125 // respect to the parent RendererGLContext. Returns zero if RendererGLContext 128 // respect to the parent RendererGLContext. Returns zero if RendererGLContext
126 // does not have a parent. 129 // does not have a parent.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // Destroy a latch. 179 // Destroy a latch.
177 bool DestroyLatch(uint32 latch); 180 bool DestroyLatch(uint32 latch);
178 181
179 // All child contexts get a latch pair automatically. These latches are used 182 // All child contexts get a latch pair automatically. These latches are used
180 // for synchronization with parent context. If *this* context does not have a 183 // for synchronization with parent context. If *this* context does not have a
181 // parent context, these methods will return false. 184 // parent context, these methods will return false.
182 bool GetParentToChildLatch(uint32* parent_to_child_latch); 185 bool GetParentToChildLatch(uint32* parent_to_child_latch);
183 bool GetChildToParentLatch(uint32* child_to_parent_latch); 186 bool GetChildToParentLatch(uint32* child_to_parent_latch);
184 187
185 private: 188 private:
186 RendererGLContext(GpuChannelHost* channel, 189 explicit RendererGLContext(GpuChannelHost* channel);
187 RendererGLContext* parent);
188 190
189 bool Initialize(bool onscreen, 191 bool Initialize(bool onscreen,
190 gfx::PluginWindowHandle render_surface, 192 gfx::PluginWindowHandle render_surface,
191 int render_view_id, 193 int render_view_id,
192 const gfx::Size& size, 194 const gfx::Size& size,
193 const char* allowed_extensions, 195 const char* allowed_extensions,
194 const int32* attrib_list, 196 const int32* attrib_list,
195 const GURL& active_url); 197 const GURL& active_url);
196 void Destroy(); 198 void Destroy();
197 199
(...skipping 13 matching lines...) Expand all
211 int32 transfer_buffer_id_; 213 int32 transfer_buffer_id_;
212 gpu::gles2::GLES2Implementation* gles2_implementation_; 214 gpu::gles2::GLES2Implementation* gles2_implementation_;
213 gfx::Size size_; 215 gfx::Size size_;
214 Error last_error_; 216 Error last_error_;
215 int frame_number_; 217 int frame_number_;
216 218
217 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); 219 DISALLOW_COPY_AND_ASSIGN(RendererGLContext);
218 }; 220 };
219 221
220 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ 222 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698