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

Unified Diff: Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 665073002: WebGL: optimize to draw WebGL on external destination. e.g. 2D Canvas. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 182ba0b004577c248eec139de540030241b2b0e2..e3055786d8ac0ed587e8551b4b4db72d9ad0025c 100644
--- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -297,7 +297,7 @@ bool DrawingBuffer::prepareMailbox(WebExternalTextureMailbox* outMailbox, WebExt
ASSERT(!frontColorBufferMailbox->m_parentDrawingBuffer);
frontColorBufferMailbox->m_parentDrawingBuffer = this;
*outMailbox = frontColorBufferMailbox->mailbox;
- m_frontColorBuffer = frontColorBufferMailbox->textureInfo;
+ m_frontColorBuffer = { frontColorBufferMailbox->textureInfo, frontColorBufferMailbox->mailbox };
return true;
}
@@ -457,8 +457,8 @@ bool DrawingBuffer::initialize(const IntSize& size)
bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platform3DObject texture, GLenum internalFormat, GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, bool fromFrontBuffer)
{
GLint textureId = m_colorBuffer.textureId;
- if (fromFrontBuffer && m_frontColorBuffer.textureId)
- textureId = m_frontColorBuffer.textureId;
+ if (fromFrontBuffer && m_frontColorBuffer.texInfo.textureId)
+ textureId = m_frontColorBuffer.texInfo.textureId;
if (m_contentsChanged) {
if (m_multisampleMode != None) {
@@ -536,12 +536,6 @@ void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer)
return;
Platform3DObject tex = imageBuffer->getBackingTexture();
if (tex) {
- RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
- m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
- m_context->produceTextureDirectCHROMIUM(m_frontColorBuffer.textureId, GL_TEXTURE_2D, bufferMailbox->mailbox.name);
dshwang 2014/10/20 19:00:25 As the method name, this method exists for copying
- m_context->flush();
-
- bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint();
OwnPtr<WebGraphicsContext3DProvider> provider =
adoptPtr(Platform::current()->createSharedOffscreenGraphicsContext3DProvider());
if (!provider)
@@ -550,22 +544,21 @@ void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer)
if (!context)
return;
- context->waitSyncPoint(bufferMailbox->mailbox.syncPoint);
- Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
+ context->waitSyncPoint(m_frontColorBuffer.mailbox.syncPoint);
+ Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, m_frontColorBuffer.mailbox.name);
context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture,
tex, 0, GL_RGBA, GL_UNSIGNED_BYTE);
context->deleteTexture(sourceTexture);
context->flush();
m_context->waitSyncPoint(context->insertSyncPoint());
imageBuffer->didModifyBackingTexture();
-
return;
}
Platform3DObject framebuffer = m_context->createFramebuffer();
m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
// We don't need to bind a copy of m_frontColorBuffer since the texture parameters are untouched.
- m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_frontColorBuffer.textureId, 0);
+ m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_frontColorBuffer.texInfo.textureId, 0);
paintFramebufferToCanvas(framebuffer, size().width(), size().height(), !m_actualAttributes.premultipliedAlpha, imageBuffer);
m_context->deleteFramebuffer(framebuffer);
@@ -617,7 +610,7 @@ void DrawingBuffer::beginDestruction()
setSize(IntSize());
m_colorBuffer = TextureInfo();
- m_frontColorBuffer = TextureInfo();
+ m_frontColorBuffer = FrontBufferInfo();
m_multisampleColorBuffer = 0;
m_depthStencilBuffer = 0;
m_depthBuffer = 0;
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698