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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp

Issue 2026803002: Avoid GPU readback in tex(Sub)Image2D(ImageBitmap) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address kbr@'s comments Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "modules/webgl/WebGL2RenderingContextBase.h" 5 #include "modules/webgl/WebGL2RenderingContextBase.h"
6 6
7 #include "bindings/modules/v8/WebGLAny.h" 7 #include "bindings/modules/v8/WebGLAny.h"
8 #include "core/frame/ImageBitmap.h" 8 #include "core/frame/ImageBitmap.h"
9 #include "core/html/HTMLCanvasElement.h" 9 #include "core/html/HTMLCanvasElement.h"
10 #include "core/html/HTMLImageElement.h" 10 #include "core/html/HTMLImageElement.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 break; 454 break;
455 default: 455 default:
456 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid attach ment"); 456 synthesizeGLError(GL_INVALID_ENUM, functionName, "invalid attach ment");
457 return false; 457 return false;
458 } 458 }
459 } 459 }
460 } 460 }
461 return true; 461 return true;
462 } 462 }
463 463
464 bool WebGL2RenderingContextBase::canUseTexImageCanvasByGPU(GLint internalformat, GLenum type) 464 bool WebGL2RenderingContextBase::canUseTexImageByGPU(TexImageFunctionID function ID, GLint internalformat, GLenum type)
465 { 465 {
466 switch (internalformat) { 466 switch (internalformat) {
467 case GL_RGB565: 467 case GL_RGB565:
468 case GL_RGBA4: 468 case GL_RGBA4:
469 case GL_RGB5_A1: 469 case GL_RGB5_A1:
470 // FIXME: ES3 limitation that CopyTexImage with sized internalformat, 470 // FIXME: ES3 limitation that CopyTexImage with sized internalformat,
471 // component sizes have to match the source color format. 471 // component sizes have to match the source color format.
472 return false; 472 return false;
473 default: 473 default:
474 break; 474 break;
475 } 475 }
476 return WebGLRenderingContextBase::canUseTexImageCanvasByGPU(internalformat, type); 476 return WebGLRenderingContextBase::canUseTexImageByGPU(functionID, internalfo rmat, type);
477 } 477 }
478 478
479 void WebGL2RenderingContextBase::invalidateFramebuffer(GLenum target, const Vect or<GLenum>& attachments) 479 void WebGL2RenderingContextBase::invalidateFramebuffer(GLenum target, const Vect or<GLenum>& attachments)
480 { 480 {
481 if (isContextLost()) 481 if (isContextLost())
482 return; 482 return;
483 483
484 Vector<GLenum> translatedAttachments = attachments; 484 Vector<GLenum> translatedAttachments = attachments;
485 if (!checkAndTranslateAttachments("invalidateFramebuffer", target, translate dAttachments)) 485 if (!checkAndTranslateAttachments("invalidateFramebuffer", target, translate dAttachments))
486 return; 486 return;
(...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after
3369 params.skipPixels = m_unpackSkipPixels; 3369 params.skipPixels = m_unpackSkipPixels;
3370 params.skipRows = m_unpackSkipRows; 3370 params.skipRows = m_unpackSkipRows;
3371 if (dimension == Tex3D) { 3371 if (dimension == Tex3D) {
3372 params.imageHeight = m_unpackImageHeight; 3372 params.imageHeight = m_unpackImageHeight;
3373 params.skipImages = m_unpackSkipImages; 3373 params.skipImages = m_unpackSkipImages;
3374 } 3374 }
3375 return params; 3375 return params;
3376 } 3376 }
3377 3377
3378 } // namespace blink 3378 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698