Commit b21387e6 authored by bajones@chromium.org's avatar bajones@chromium.org

Making use of bindless variants mailbox produce/consume.

Blink side of https://codereview.chromium.org/299043003/

BUG=354697

Review URL: https://codereview.chromium.org/310623004

git-svn-id: svn://svn.chromium.org/blink/trunk@176042 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 562e7af5
...@@ -170,8 +170,7 @@ bool ImageBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, Pl ...@@ -170,8 +170,7 @@ bool ImageBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, Pl
// Contexts may be in a different share group. We must transfer the texture through a mailbox first // Contexts may be in a different share group. We must transfer the texture through a mailbox first
sharedContext->genMailboxCHROMIUM(mailbox->name); sharedContext->genMailboxCHROMIUM(mailbox->name);
sharedContext->bindTexture(GL_TEXTURE_2D, getBackingTexture()); sharedContext->produceTextureDirectCHROMIUM(getBackingTexture(), GL_TEXTURE_2D, mailbox->name);
sharedContext->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox->name);
sharedContext->flush(); sharedContext->flush();
mailbox->syncPoint = sharedContext->insertSyncPoint(); mailbox->syncPoint = sharedContext->insertSyncPoint();
...@@ -179,12 +178,8 @@ bool ImageBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, Pl ...@@ -179,12 +178,8 @@ bool ImageBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, Pl
if (!context->makeContextCurrent()) if (!context->makeContextCurrent())
return false; return false;
Platform3DObject sourceTexture = context->createTexture();
context->bindTexture(GL_TEXTURE_2D, sourceTexture);
context->waitSyncPoint(mailbox->syncPoint); context->waitSyncPoint(mailbox->syncPoint);
context->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox->name); Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox->name);
// The canvas is stored in a premultiplied format, so unpremultiply if necessary. // The canvas is stored in a premultiplied format, so unpremultiply if necessary.
context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyAlpha); context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, !premultiplyAlpha);
...@@ -196,7 +191,6 @@ bool ImageBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, Pl ...@@ -196,7 +191,6 @@ bool ImageBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, Pl
context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false);
context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false);
context->bindTexture(GL_TEXTURE_2D, 0);
context->deleteTexture(sourceTexture); context->deleteTexture(sourceTexture);
context->flush(); context->flush();
......
...@@ -455,8 +455,7 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, ...@@ -455,8 +455,7 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
// Contexts may be in a different share group. We must transfer the texture through a mailbox first // Contexts may be in a different share group. We must transfer the texture through a mailbox first
RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo()); RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name); m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
m_context->bindTexture(GL_TEXTURE_2D, textureId); m_context->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, bufferMailbox->mailbox.name);
m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
m_context->flush(); m_context->flush();
bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint();
...@@ -464,16 +463,8 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, ...@@ -464,16 +463,8 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
if (!context->makeContextCurrent()) if (!context->makeContextCurrent())
return false; return false;
Platform3DObject sourceTexture = context->createTexture();
// TODO(bajones): Should be able to change the texture bindings here without reverting but
// 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.
GLint boundTexture = 0;
context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
context->bindTexture(GL_TEXTURE_2D, sourceTexture);
context->waitSyncPoint(bufferMailbox->mailbox.syncPoint); context->waitSyncPoint(bufferMailbox->mailbox.syncPoint);
context->consumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name); Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
bool unpackPremultiplyAlphaNeeded = false; bool unpackPremultiplyAlphaNeeded = false;
bool unpackUnpremultiplyAlphaNeeded = false; bool unpackUnpremultiplyAlphaNeeded = false;
...@@ -490,7 +481,6 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context, ...@@ -490,7 +481,6 @@ bool DrawingBuffer::copyToPlatformTexture(blink::WebGraphicsContext3D* context,
context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false);
context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false);
context->bindTexture(GL_TEXTURE_2D, boundTexture);
context->deleteTexture(sourceTexture); context->deleteTexture(sourceTexture);
context->flush(); context->flush();
......
...@@ -422,7 +422,10 @@ public: ...@@ -422,7 +422,10 @@ public:
// GL_CHROMIUM_texture_mailbox // GL_CHROMIUM_texture_mailbox
virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { } virtual void genMailboxCHROMIUM(WGC3Dbyte* mailbox) { }
virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { } virtual void produceTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { }
virtual void produceTextureDirectCHROMIUM(WebGLId texture, WGC3Denum target, const WGC3Dbyte* mailbox) { }
virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { } virtual void consumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { }
virtual WebGLId createAndConsumeTextureCHROMIUM(WGC3Denum target, const WGC3Dbyte* mailbox) { return 0; }
// GL_EXT_debug_marker // GL_EXT_debug_marker
virtual void insertEventMarkerEXT(const WGC3Dchar* marker) { } virtual void insertEventMarkerEXT(const WGC3Dchar* marker) { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment