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

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

Issue 214733002: Fix the remaining issue of seperating WebGL from the default share group (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « no previous file | 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 2a94073d841986f585b0578d3be041b986e2b074..a38cb2b2cac0860b50ab7694fe8406265a334b56 100644
--- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -41,6 +41,7 @@
#include "public/platform/WebExternalBitmap.h"
#include "public/platform/WebExternalTextureLayer.h"
#include "public/platform/WebGraphicsContext3D.h"
+#include "public/platform/WebGraphicsContext3DProvider.h"
using namespace std;
@@ -411,9 +412,33 @@ void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer)
return;
Platform3DObject tex = imageBuffer->getBackingTexture();
if (tex) {
- m_context->copyTextureCHROMIUM(GL_TEXTURE_2D, m_frontColorBuffer,
- tex, 0, GL_RGBA, GL_UNSIGNED_BYTE);
+ RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
+ m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
+ m_context->bindTexture(GL_TEXTURE_2D, m_frontColorBuffer);
+ m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
m_context->flush();
+
+ bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint();
+ OwnPtr<blink::WebGraphicsContext3DProvider> provider =
+ adoptPtr(blink::Platform::current()->createSharedOffscreenGraphicsContext3DProvider());
+ if (!provider)
+ return;
+ blink::WebGraphicsContext3D* context = provider->context3d();
+ if (!context || !context->makeContextCurrent())
+ return;
+
+ Platform3DObject sourceTexture = context->createTexture();
+ 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);
+ context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture,
+ tex, 0, GL_RGBA, GL_UNSIGNED_BYTE);
+ context->bindTexture(GL_TEXTURE_2D, boundTexture);
+ context->deleteTexture(sourceTexture);
+ context->flush();
+ m_context->waitSyncPoint(context->insertSyncPoint());
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698