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

Side by Side Diff: content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.cc

Issue 7058035: WebGraphicsContext3DCommandBufferImpl cleanup, Canvas2D thottling fix, GpuScheduler fix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tests and feedback 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h" 7 #include "content/renderer/gpu/webgraphicscontext3d_command_buffer_impl.h"
8 8
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #ifndef GL_GLEXT_PROTOTYPES 10 #ifndef GL_GLEXT_PROTOTYPES
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 context_->ResizeOffscreen(gfx::Size(width, height)); 224 context_->ResizeOffscreen(gfx::Size(width, height));
225 // Force a SwapBuffers to get the framebuffer to resize. 225 // Force a SwapBuffers to get the framebuffer to resize.
226 context_->SwapBuffers(); 226 context_->SwapBuffers();
227 } 227 }
228 228
229 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 229 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
230 scanline_.reset(new uint8[width * 4]); 230 scanline_.reset(new uint8[width * 4]);
231 #endif // FLIP_FRAMEBUFFER_VERTICALLY 231 #endif // FLIP_FRAMEBUFFER_VERTICALLY
232 } 232 }
233 233
234 WebGLId WebGraphicsContext3DCommandBufferImpl::createCompositorTexture(
235 WGC3Dsizei width, WGC3Dsizei height) {
236 return context_->CreateParentTexture(gfx::Size(width, height));
237 }
238
239 void WebGraphicsContext3DCommandBufferImpl::deleteCompositorTexture(
240 WebGLId parent_texture) {
241 context_->DeleteParentTexture(parent_texture);
242 }
243
244 #ifdef FLIP_FRAMEBUFFER_VERTICALLY 234 #ifdef FLIP_FRAMEBUFFER_VERTICALLY
245 void WebGraphicsContext3DCommandBufferImpl::FlipVertically( 235 void WebGraphicsContext3DCommandBufferImpl::FlipVertically(
246 uint8* framebuffer, 236 uint8* framebuffer,
247 unsigned int width, 237 unsigned int width,
248 unsigned int height) { 238 unsigned int height) {
249 uint8* scanline = scanline_.get(); 239 uint8* scanline = scanline_.get();
250 if (!scanline) 240 if (!scanline)
251 return; 241 return;
252 unsigned int row_bytes = width * 4; 242 unsigned int row_bytes = width * 4;
253 unsigned int count = height / 2; 243 unsigned int count = height / 2;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 target, level, xoffset, yoffset, width, height, format, type, access); 330 target, level, xoffset, yoffset, width, height, format, type, access);
341 } 331 }
342 332
343 void WebGraphicsContext3DCommandBufferImpl::unmapTexSubImage2DCHROMIUM( 333 void WebGraphicsContext3DCommandBufferImpl::unmapTexSubImage2DCHROMIUM(
344 const void* mem) { 334 const void* mem) {
345 gl_->UnmapTexSubImage2DCHROMIUM(mem); 335 gl_->UnmapTexSubImage2DCHROMIUM(mem);
346 } 336 }
347 337
348 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM( 338 void WebGraphicsContext3DCommandBufferImpl::copyTextureToParentTextureCHROMIUM(
349 WebGLId texture, WebGLId parentTexture) { 339 WebGLId texture, WebGLId parentTexture) {
350 copyTextureToCompositor(texture, parentTexture); 340 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::copyTextureToCompositor");
341 gl_->CopyTextureToParentTextureCHROMIUM(texture, parentTexture);
342 gl_->Flush();
351 } 343 }
352 344
353 void WebGraphicsContext3DCommandBufferImpl::getParentToChildLatchCHROMIUM( 345 void WebGraphicsContext3DCommandBufferImpl::getParentToChildLatchCHROMIUM(
354 WGC3Duint* latch_id) 346 WGC3Duint* latch_id)
355 { 347 {
356 if (!context_->GetParentToChildLatch(latch_id)) { 348 if (!context_->GetParentToChildLatch(latch_id)) {
357 LOG(ERROR) << "getLatch must only be called on child context"; 349 LOG(ERROR) << "getLatch must only be called on child context";
358 synthesizeGLError(GL_INVALID_OPERATION); 350 synthesizeGLError(GL_INVALID_OPERATION);
359 *latch_id = gpu::kInvalidLatchId; 351 *latch_id = gpu::kInvalidLatchId;
360 } 352 }
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 } 1003 }
1012 1004
1013 void WebGraphicsContext3DCommandBufferImpl::deleteShader(WebGLId shader) { 1005 void WebGraphicsContext3DCommandBufferImpl::deleteShader(WebGLId shader) {
1014 gl_->DeleteShader(shader); 1006 gl_->DeleteShader(shader);
1015 } 1007 }
1016 1008
1017 void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) { 1009 void WebGraphicsContext3DCommandBufferImpl::deleteTexture(WebGLId texture) {
1018 gl_->DeleteTextures(1, &texture); 1010 gl_->DeleteTextures(1, &texture);
1019 } 1011 }
1020 1012
1021 void WebGraphicsContext3DCommandBufferImpl::copyTextureToCompositor(
1022 WebGLId texture, WebGLId parentTexture) {
1023 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::copyTextureToCompositor");
1024 gl_->CopyTextureToParentTextureCHROMIUM(texture, parentTexture);
1025 gl_->Flush();
1026 }
1027
1028 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() { 1013 void WebGraphicsContext3DCommandBufferImpl::OnSwapBuffersComplete() {
1029 // This may be called after tear-down of the RenderView. 1014 // This may be called after tear-down of the RenderView.
1030 RenderView* renderview = 1015 RenderView* renderview =
1031 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 1016 web_view_ ? RenderView::FromWebView(web_view_) : NULL;
1032 if (renderview) 1017 if (renderview)
1033 renderview->OnViewContextSwapBuffersComplete(); 1018 renderview->OnViewContextSwapBuffersComplete();
1034 } 1019 }
1035 1020
1036 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback( 1021 void WebGraphicsContext3DCommandBufferImpl::setContextLostCallback(
1037 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb) 1022 WebGraphicsContext3D::WebGraphicsContextLostCallback* cb)
1038 { 1023 {
1039 context_lost_callback_ = cb; 1024 context_lost_callback_ = cb;
1040 } 1025 }
1041 1026
1042 void WebGraphicsContext3DCommandBufferImpl::OnContextLost() { 1027 void WebGraphicsContext3DCommandBufferImpl::OnContextLost() {
1043 if (context_lost_callback_) { 1028 if (context_lost_callback_) {
1044 context_lost_callback_->onContextLost(); 1029 context_lost_callback_->onContextLost();
1045 } 1030 }
1046 1031
1047 RenderView* renderview = 1032 RenderView* renderview =
1048 web_view_ ? RenderView::FromWebView(web_view_) : NULL; 1033 web_view_ ? RenderView::FromWebView(web_view_) : NULL;
1049 if (renderview) 1034 if (renderview)
1050 renderview->OnViewContextSwapBuffersAborted(); 1035 renderview->OnViewContextSwapBuffersAborted();
1051 } 1036 }
1052 1037
1053 #endif // defined(ENABLE_GPU) 1038 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698