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

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

Issue 7554015: Implemented support for GL constext share groups in the renderer process. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // allocate both fake PluginWindowHandles and NativeViewIds and map 93 // allocate both fake PluginWindowHandles and NativeViewIds and map
94 // from fake NativeViewIds to PluginWindowHandles, but this seems like 94 // from fake NativeViewIds to PluginWindowHandles, but this seems like
95 // unnecessary complexity at the moment. 95 // unnecessary complexity at the moment.
96 // 96 //
97 // The render_view_id is currently also only used on Mac OS X. 97 // The render_view_id is currently also only used on Mac OS X.
98 // TODO(kbr): clean up the arguments to this function and make them 98 // TODO(kbr): clean up the arguments to this function and make them
99 // more cross-platform. 99 // more cross-platform.
100 static RendererGLContext* CreateViewContext( 100 static RendererGLContext* CreateViewContext(
101 GpuChannelHost* channel, 101 GpuChannelHost* channel,
102 int render_view_id, 102 int render_view_id,
103 RendererGLContext* share_group,
103 const char* allowed_extensions, 104 const char* allowed_extensions,
104 const int32* attrib_list, 105 const int32* attrib_list,
105 const GURL& active_arl); 106 const GURL& active_arl);
106 107
107 #if defined(OS_MACOSX) 108 #if defined(OS_MACOSX)
108 // On Mac OS X only, view RendererGLContexts actually behave like offscreen 109 // On Mac OS X only, view RendererGLContexts actually behave like offscreen
109 // RendererGLContexts, and require an explicit resize operation which is 110 // RendererGLContexts, and require an explicit resize operation which is
110 // slightly different from that of offscreen RendererGLContexts. 111 // slightly different from that of offscreen RendererGLContexts.
111 void ResizeOnscreen(const gfx::Size& size); 112 void ResizeOnscreen(const gfx::Size& size);
112 #endif 113 #endif
113 114
114 // Create a RendererGLContext that renders to an offscreen frame buffer. If 115 // Create a RendererGLContext that renders to an offscreen frame buffer. If
115 // parent is not NULL, that RendererGLContext can access a copy of the created 116 // parent is not NULL, that RendererGLContext can access a copy of the created
116 // RendererGLContext's frame buffer that is updated every time SwapBuffers is 117 // RendererGLContext's frame buffer that is updated every time SwapBuffers is
117 // called. It is not as general as shared RendererGLContexts in other 118 // called. It is not as general as shared RendererGLContexts in other
118 // implementations of OpenGL. If parent is not NULL, it must be used on the 119 // implementations of OpenGL. If parent is not NULL, it must be used on the
119 // same thread as the parent. A child RendererGLContext may not outlive its 120 // same thread as the parent. A child RendererGLContext may not outlive its
120 // parent. attrib_list must be NULL or a NONE-terminated list of 121 // parent. attrib_list must be NULL or a NONE-terminated list of
121 // attribute/value pairs. 122 // attribute/value pairs.
122 static RendererGLContext* CreateOffscreenContext( 123 static RendererGLContext* CreateOffscreenContext(
123 GpuChannelHost* channel, 124 GpuChannelHost* channel,
124 const gfx::Size& size, 125 const gfx::Size& size,
126 RendererGLContext* share_group,
125 const char* allowed_extensions, 127 const char* allowed_extensions,
126 const int32* attrib_list, 128 const int32* attrib_list,
127 const GURL& active_url); 129 const GURL& active_url);
128 130
129 // Sets the parent context. If any parent textures have been created for 131 // Sets the parent context. If any parent textures have been created for
130 // another parent, it is important to delete them before changing the parent. 132 // another parent, it is important to delete them before changing the parent.
131 bool SetParent(RendererGLContext* parent); 133 bool SetParent(RendererGLContext* parent);
132 134
133 // Resize an offscreen frame buffer. The resize occurs on the next call to 135 // Resize an offscreen frame buffer. The resize occurs on the next call to
134 // SwapBuffers. This is to avoid waiting until all pending GL calls have been 136 // SwapBuffers. This is to avoid waiting until all pending GL calls have been
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 bool IsCommandBufferContextLost(); 184 bool IsCommandBufferContextLost();
183 185
184 CommandBufferProxy* GetCommandBufferProxy(); 186 CommandBufferProxy* GetCommandBufferProxy();
185 187
186 private: 188 private:
187 explicit RendererGLContext(GpuChannelHost* channel); 189 explicit RendererGLContext(GpuChannelHost* channel);
188 190
189 bool Initialize(bool onscreen, 191 bool Initialize(bool onscreen,
190 int render_view_id, 192 int render_view_id,
191 const gfx::Size& size, 193 const gfx::Size& size,
194 RendererGLContext* share_group,
192 const char* allowed_extensions, 195 const char* allowed_extensions,
193 const int32* attrib_list, 196 const int32* attrib_list,
194 const GURL& active_url); 197 const GURL& active_url);
195 void Destroy(); 198 void Destroy();
196 199
197 void OnSwapBuffers(); 200 void OnSwapBuffers();
198 void OnContextLost(); 201 void OnContextLost();
199 202
200 scoped_refptr<GpuChannelHost> channel_; 203 scoped_refptr<GpuChannelHost> channel_;
201 base::WeakPtr<RendererGLContext> parent_; 204 base::WeakPtr<RendererGLContext> parent_;
202 scoped_ptr<Callback0::Type> swap_buffers_callback_; 205 scoped_ptr<Callback0::Type> swap_buffers_callback_;
203 scoped_ptr<Callback1<ContextLostReason>::Type> context_lost_callback_; 206 scoped_ptr<Callback1<ContextLostReason>::Type> context_lost_callback_;
204 uint32 parent_texture_id_; 207 uint32 parent_texture_id_;
205 CommandBufferProxy* command_buffer_; 208 CommandBufferProxy* command_buffer_;
206 gpu::gles2::GLES2CmdHelper* gles2_helper_; 209 gpu::gles2::GLES2CmdHelper* gles2_helper_;
207 int32 transfer_buffer_id_; 210 int32 transfer_buffer_id_;
208 gpu::gles2::GLES2Implementation* gles2_implementation_; 211 gpu::gles2::GLES2Implementation* gles2_implementation_;
209 gfx::Size size_; 212 gfx::Size size_;
210 Error last_error_; 213 Error last_error_;
211 int frame_number_; 214 int frame_number_;
212 215
213 DISALLOW_COPY_AND_ASSIGN(RendererGLContext); 216 DISALLOW_COPY_AND_ASSIGN(RendererGLContext);
214 }; 217 };
215 218
216 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_ 219 #endif // CONTENT_RENDERER_GPU_RENDERER_GL_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698