Chromium Code Reviews| 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..c0ad49ceb1a955282ebf7bab47a0158ed64ebcd8 100644 |
| --- a/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| +++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp |
| @@ -329,14 +329,33 @@ 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)) |
| + // 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->flush(); |
| + |
| + bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); |
| + |
| + if (!context->makeContextCurrent()) |
| return false; |
| + Platform3DObject sourceTexture = context->createTexture(); |
| + |
| + // TODO: Should be able to change the texture bindings here without reverting but |
|
Ken Russell (switch to Gerrit)
2014/03/13 19:35:54
TODO(bajones)
|
| + // something else in the system is depending on it. Failing to revert causes WebGL |
| + // tests to fail. We should find out why and fix it. |
|
Ken Russell (switch to Gerrit)
2014/03/13 19:35:54
The reason this was failing is probably that an ad
|
| + GLint boundTexture = 0; |
| + context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture); |
| + 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 +370,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); |
|
dshwang
2014/03/14 21:47:54
If changing context->bindTexture(GL_TEXTURE_2D, te
|
| + context->deleteTexture(sourceTexture); |
| + |
| context->flush(); |
| + m_context->waitSyncPoint(context->insertSyncPoint()); |
|
dshwang
2014/03/14 21:47:54
before this line, looks like m_context->makeContex
|
| return true; |
| } |