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

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

Issue 179973004: Share Group plumbing in Blink; Remove WebGL from default share group (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refactored syncing based on piman@'s feedback Created 6 years, 9 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
Index: Source/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 8b3bd008303b195f7fdd492ce4be180db5346f18..d9740e23b487860adc3990b69f2d343f0c25d0c3 100644
--- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -329,14 +329,34 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
}
m_context->flush();
}
- Platform3DObject sourceTexture = m_colorBuffer;
- if (!context->makeContextCurrent())
+ if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, level))
return false;
- if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, level))
+ GLint boundTexture = 0;
+ m_context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
Ken Russell (switch to Gerrit) 2014/03/12 21:23:38 One of the two callers of this method is ImageBuff
+
+ // Contexts may be in a different share group. We must transfer the texture through a mailbox first
+ RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
+ m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
+ m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer);
+ m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
+ m_context->bindTexture(GL_TEXTURE_2D, boundTexture);
+ m_context->flush();
+
+ bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint();
+
+ if (!context->makeContextCurrent())
return false;
+ Platform3DObject sourceTexture = context->createTexture();
+
+ context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
Ken Russell (switch to Gerrit) 2014/03/12 21:23:38 There are only two callers of DrawingBuffer::copyT
+ context->bindTexture(GL_TEXTURE_2D, sourceTexture);
+
+ context->waitSyncPoint(bufferMailbox->mailbox.syncPoint);
+ context->consumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
+
bool unpackPremultiplyAlphaNeeded = false;
bool unpackUnpremultiplyAlphaNeeded = false;
if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlpha)
@@ -351,7 +371,12 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false);
context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false);
context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false);
+
+ context->bindTexture(GL_TEXTURE_2D, boundTexture);
Ken Russell (switch to Gerrit) 2014/03/12 21:23:38 Again, this can bind NULL in order to delete sourc
+ context->deleteTexture(sourceTexture);
+
context->flush();
+ m_context->waitSyncPoint(context->insertSyncPoint());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698