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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 2738163002: Enable CopyTextureCHROMIUM in Blink for Tex{Sub}Image2D with more cases (Closed)
Patch Set: enable fallback path Created 3 years, 8 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 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { 677 if (m_gl->GetGraphicsResetStatusKHR() != GL_NO_ERROR) {
678 // It's possible that the drawing buffer allocation provokes a context loss, 678 // It's possible that the drawing buffer allocation provokes a context loss,
679 // so check again just in case. http://crbug.com/512302 679 // so check again just in case. http://crbug.com/512302
680 return false; 680 return false;
681 } 681 }
682 682
683 return true; 683 return true;
684 } 684 }
685 685
686 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl, 686 bool DrawingBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl,
687 GLenum textureTarget,
687 GLuint texture, 688 GLuint texture,
688 GLenum internalFormat,
689 GLenum destType,
690 GLint level,
691 bool premultiplyAlpha, 689 bool premultiplyAlpha,
692 bool flipY, 690 bool flipY,
693 const IntPoint& destTextureOffset, 691 const IntPoint& destTextureOffset,
694 const IntRect& sourceSubRectangle, 692 const IntRect& sourceSubRectangle,
695 SourceDrawingBuffer sourceBuffer) { 693 SourceDrawingBuffer sourceBuffer) {
696 ScopedStateRestorer scopedStateRestorer(this); 694 ScopedStateRestorer scopedStateRestorer(this);
697 695
698 if (m_contentsChanged) { 696 if (m_contentsChanged) {
699 if (m_antiAliasingMode != None) 697 if (m_antiAliasingMode != None)
700 resolveMultisampleFramebufferInternal(); 698 resolveMultisampleFramebufferInternal();
701 m_gl->Flush(); 699 m_gl->Flush();
702 } 700 }
703 701
704 // Assume that the destination target is GL_TEXTURE_2D. 702 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(textureTarget))
705 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(
706 GL_TEXTURE_2D, internalFormat, destType, level))
707 return false; 703 return false;
708 704
709 // Contexts may be in a different share group. We must transfer the texture 705 // Contexts may be in a different share group. We must transfer the texture
710 // through a mailbox first. 706 // through a mailbox first.
711 GLenum target = 0; 707 GLenum target = 0;
712 gpu::Mailbox mailbox; 708 gpu::Mailbox mailbox;
713 gpu::SyncToken produceSyncToken; 709 gpu::SyncToken produceSyncToken;
714 if (sourceBuffer == FrontBuffer && m_frontColorBuffer) { 710 if (sourceBuffer == FrontBuffer && m_frontColorBuffer) {
715 target = m_frontColorBuffer->parameters.target; 711 target = m_frontColorBuffer->parameters.target;
716 mailbox = m_frontColorBuffer->mailbox; 712 mailbox = m_frontColorBuffer->mailbox;
(...skipping 18 matching lines...) Expand all
735 gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name); 731 gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name);
736 732
737 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; 733 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE;
738 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; 734 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE;
739 if (m_wantAlphaChannel && m_premultipliedAlpha && !premultiplyAlpha) 735 if (m_wantAlphaChannel && m_premultipliedAlpha && !premultiplyAlpha)
740 unpackUnpremultiplyAlphaNeeded = GL_TRUE; 736 unpackUnpremultiplyAlphaNeeded = GL_TRUE;
741 else if (m_wantAlphaChannel && !m_premultipliedAlpha && premultiplyAlpha) 737 else if (m_wantAlphaChannel && !m_premultipliedAlpha && premultiplyAlpha)
742 unpackPremultiplyAlphaNeeded = GL_TRUE; 738 unpackPremultiplyAlphaNeeded = GL_TRUE;
743 739
744 gl->CopySubTextureCHROMIUM( 740 gl->CopySubTextureCHROMIUM(
745 sourceTexture, 0, GL_TEXTURE_2D, texture, 0, destTextureOffset.x(), 741 sourceTexture, 0, textureTarget, texture, 0, destTextureOffset.x(),
746 destTextureOffset.y(), sourceSubRectangle.x(), sourceSubRectangle.y(), 742 destTextureOffset.y(), sourceSubRectangle.x(), sourceSubRectangle.y(),
747 sourceSubRectangle.width(), sourceSubRectangle.height(), flipY, 743 sourceSubRectangle.width(), sourceSubRectangle.height(), flipY,
748 unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); 744 unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded);
749 745
750 gl->DeleteTextures(1, &sourceTexture); 746 gl->DeleteTextures(1, &sourceTexture);
751 747
752 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); 748 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM();
753 749
754 gl->Flush(); 750 gl->Flush();
755 gpu::SyncToken syncToken; 751 gpu::SyncToken syncToken;
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 if (m_pixelUnpackBufferBindingDirty) 1289 if (m_pixelUnpackBufferBindingDirty)
1294 client->DrawingBufferClientRestorePixelUnpackBufferBinding(); 1290 client->DrawingBufferClientRestorePixelUnpackBufferBinding();
1295 } 1291 }
1296 1292
1297 bool DrawingBuffer::shouldUseChromiumImage() { 1293 bool DrawingBuffer::shouldUseChromiumImage() {
1298 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() && 1294 return RuntimeEnabledFeatures::webGLImageChromiumEnabled() &&
1299 m_chromiumImageUsage == AllowChromiumImage; 1295 m_chromiumImageUsage == AllowChromiumImage;
1300 } 1296 }
1301 1297
1302 } // namespace blink 1298 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698