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

Side by Side Diff: Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 310623004: Making use of bindless variants mailbox produce/consume. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | public/platform/WebGraphicsContext3D.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 448 }
449 m_context->flush(); 449 m_context->flush();
450 } 450 }
451 451
452 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel)) 452 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel))
453 return false; 453 return false;
454 454
455 // Contexts may be in a different share group. We must transfer the texture through a mailbox first 455 // Contexts may be in a different share group. We must transfer the texture through a mailbox first
456 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo()); 456 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
457 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name); 457 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
458 m_context->bindTexture(GL_TEXTURE_2D, textureId); 458 m_context->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, bufferMail box->mailbox.name);
459 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name );
460 m_context->flush(); 459 m_context->flush();
461 460
462 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); 461 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint();
463 462
464 if (!context->makeContextCurrent()) 463 if (!context->makeContextCurrent())
465 return false; 464 return false;
466 465
467 Platform3DObject sourceTexture = context->createTexture();
468
469 // TODO(bajones): Should be able to change the texture bindings here without reverting but
470 // something else in the system is depending on it. Failing to revert causes WebGL
471 // tests to fail. We should find out why and fix it.
472 GLint boundTexture = 0;
473 context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
474 context->bindTexture(GL_TEXTURE_2D, sourceTexture);
475 context->waitSyncPoint(bufferMailbox->mailbox.syncPoint); 466 context->waitSyncPoint(bufferMailbox->mailbox.syncPoint);
476 context->consumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name); 467 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL _TEXTURE_2D, bufferMailbox->mailbox.name);
477 468
478 bool unpackPremultiplyAlphaNeeded = false; 469 bool unpackPremultiplyAlphaNeeded = false;
479 bool unpackUnpremultiplyAlphaNeeded = false; 470 bool unpackUnpremultiplyAlphaNeeded = false;
480 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr emultiplyAlpha) 471 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr emultiplyAlpha)
481 unpackUnpremultiplyAlphaNeeded = true; 472 unpackUnpremultiplyAlphaNeeded = true;
482 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha && premultiplyAlpha) 473 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha && premultiplyAlpha)
483 unpackPremultiplyAlphaNeeded = true; 474 unpackPremultiplyAlphaNeeded = true;
484 475
485 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpackUnpremu ltiplyAlphaNeeded); 476 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpackUnpremu ltiplyAlphaNeeded);
486 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackPremultip lyAlphaNeeded); 477 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackPremultip lyAlphaNeeded);
487 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, flipY); 478 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, flipY);
488 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType); 479 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType);
489 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); 480 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false);
490 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); 481 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false);
491 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); 482 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false);
492 483
493 context->bindTexture(GL_TEXTURE_2D, boundTexture);
494 context->deleteTexture(sourceTexture); 484 context->deleteTexture(sourceTexture);
495 485
496 context->flush(); 486 context->flush();
497 m_context->waitSyncPoint(context->insertSyncPoint()); 487 m_context->waitSyncPoint(context->insertSyncPoint());
498 488
499 return true; 489 return true;
500 } 490 }
501 491
502 Platform3DObject DrawingBuffer::framebuffer() const 492 Platform3DObject DrawingBuffer::framebuffer() const
503 { 493 {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) 1063 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
1074 { 1064 {
1075 if (info->imageId) { 1065 if (info->imageId) {
1076 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); 1066 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
1077 m_context->destroyImageCHROMIUM(info->imageId); 1067 m_context->destroyImageCHROMIUM(info->imageId);
1078 info->imageId = 0; 1068 info->imageId = 0;
1079 } 1069 }
1080 } 1070 }
1081 1071
1082 } // namespace WebCore 1072 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/graphics/ImageBuffer.cpp ('k') | public/platform/WebGraphicsContext3D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698