OLD | NEW |
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 RefPtr<MailboxInfo> mailboxInfo; | 363 RefPtr<MailboxInfo> mailboxInfo; |
364 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | 364 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { |
365 if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { | 365 if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { |
366 mailboxInfo = m_textureMailboxes[i]; | 366 mailboxInfo = m_textureMailboxes[i]; |
367 break; | 367 break; |
368 } | 368 } |
369 } | 369 } |
370 ASSERT(mailboxInfo); | 370 ASSERT(mailboxInfo); |
371 | 371 |
372 if (mailboxInfo->mailbox.syncPoint) { | 372 if (mailboxInfo->mailbox.syncPoint || mailboxInfo->mailbox.validSyncToken) { |
373 m_context->waitSyncPoint(mailboxInfo->mailbox.syncPoint); | 373 m_context->waitSyncPoint(mailboxInfo->mailbox.syncPoint, |
| 374 mailboxInfo->mailbox.syncToken); |
374 mailboxInfo->mailbox.syncPoint = 0; | 375 mailboxInfo->mailbox.syncPoint = 0; |
| 376 mailboxInfo->mailbox.validSyncToken = false; |
375 } | 377 } |
376 | 378 |
377 if (mailboxInfo->size != m_size) { | 379 if (mailboxInfo->size != m_size) { |
378 m_context->bindTexture(GL_TEXTURE_2D, mailboxInfo->textureInfo.textureId
); | 380 m_context->bindTexture(GL_TEXTURE_2D, mailboxInfo->textureInfo.textureId
); |
379 allocateTextureMemory(&mailboxInfo->textureInfo, m_size); | 381 allocateTextureMemory(&mailboxInfo->textureInfo, m_size); |
380 mailboxInfo->size = m_size; | 382 mailboxInfo->size = m_size; |
381 } | 383 } |
382 | 384 |
383 return mailboxInfo.release(); | 385 return mailboxInfo.release(); |
384 } | 386 } |
385 | 387 |
386 PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::createNewMailbox(const Tex
tureInfo& info) | 388 PassRefPtr<DrawingBuffer::MailboxInfo> DrawingBuffer::createNewMailbox(const Tex
tureInfo& info) |
387 { | 389 { |
388 RefPtr<MailboxInfo> returnMailbox = adoptRef(new MailboxInfo()); | 390 RefPtr<MailboxInfo> returnMailbox = adoptRef(new MailboxInfo()); |
389 m_context->genMailboxCHROMIUM(returnMailbox->mailbox.name); | 391 m_context->genMailboxCHROMIUM(returnMailbox->mailbox.name); |
390 returnMailbox->textureInfo = info; | 392 returnMailbox->textureInfo = info; |
391 returnMailbox->size = m_size; | 393 returnMailbox->size = m_size; |
392 m_textureMailboxes.append(returnMailbox); | 394 m_textureMailboxes.append(returnMailbox); |
393 return returnMailbox.release(); | 395 return returnMailbox.release(); |
394 } | 396 } |
395 | 397 |
396 void DrawingBuffer::deleteMailbox(const WebExternalTextureMailbox& mailbox) | 398 void DrawingBuffer::deleteMailbox(const WebExternalTextureMailbox& mailbox) |
397 { | 399 { |
398 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { | 400 for (size_t i = 0; i < m_textureMailboxes.size(); i++) { |
399 if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { | 401 if (nameEquals(m_textureMailboxes[i]->mailbox, mailbox)) { |
400 if (mailbox.syncPoint) | 402 if (mailbox.syncPoint || mailbox.validSyncToken) |
401 m_context->waitSyncPoint(mailbox.syncPoint); | 403 m_context->waitSyncPoint(mailbox.syncPoint, mailbox.syncToken); |
402 | 404 |
403 deleteChromiumImageForTexture(&m_textureMailboxes[i]->textureInfo); | 405 deleteChromiumImageForTexture(&m_textureMailboxes[i]->textureInfo); |
404 | 406 |
405 m_context->deleteTexture(m_textureMailboxes[i]->textureInfo.textureI
d); | 407 m_context->deleteTexture(m_textureMailboxes[i]->textureInfo.textureI
d); |
406 m_textureMailboxes.remove(i); | 408 m_textureMailboxes.remove(i); |
407 return; | 409 return; |
408 } | 410 } |
409 } | 411 } |
410 ASSERT_NOT_REACHED(); | 412 ASSERT_NOT_REACHED(); |
411 } | 413 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 textureId = m_frontColorBuffer.texInfo.textureId; | 504 textureId = m_frontColorBuffer.texInfo.textureId; |
503 mailbox = m_frontColorBuffer.mailbox; | 505 mailbox = m_frontColorBuffer.mailbox; |
504 } else { | 506 } else { |
505 textureId = m_colorBuffer.textureId; | 507 textureId = m_colorBuffer.textureId; |
506 m_context->genMailboxCHROMIUM(mailbox.name); | 508 m_context->genMailboxCHROMIUM(mailbox.name); |
507 m_context->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, mailbo
x.name); | 509 m_context->produceTextureDirectCHROMIUM(textureId, GL_TEXTURE_2D, mailbo
x.name); |
508 m_context->flush(); | 510 m_context->flush(); |
509 mailbox.syncPoint = m_context->insertSyncPoint(); | 511 mailbox.syncPoint = m_context->insertSyncPoint(); |
510 } | 512 } |
511 | 513 |
512 context->waitSyncPoint(mailbox.syncPoint); | 514 context->waitSyncPoint(mailbox.syncPoint, mailbox.syncToken); |
513 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox.name); | 515 Platform3DObject sourceTexture = context->createAndConsumeTextureCHROMIUM(GL
_TEXTURE_2D, mailbox.name); |
514 | 516 |
515 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; | 517 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; |
516 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; | 518 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; |
517 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr
emultiplyAlpha) | 519 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr
emultiplyAlpha) |
518 unpackUnpremultiplyAlphaNeeded = GL_TRUE; | 520 unpackUnpremultiplyAlphaNeeded = GL_TRUE; |
519 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha
&& premultiplyAlpha) | 521 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha
&& premultiplyAlpha) |
520 unpackPremultiplyAlphaNeeded = GL_TRUE; | 522 unpackPremultiplyAlphaNeeded = GL_TRUE; |
521 | 523 |
522 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaN
eeded); | 524 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, internal
Format, destType, flipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaN
eeded); |
523 | 525 |
524 context->deleteTexture(sourceTexture); | 526 context->deleteTexture(sourceTexture); |
525 | 527 |
526 context->flush(); | 528 context->flush(); |
527 m_context->waitSyncPoint(context->insertSyncPoint()); | 529 m_context->waitSyncPoint(context->insertSyncPoint(), nullptr); |
528 | 530 |
529 return true; | 531 return true; |
530 } | 532 } |
531 | 533 |
532 Platform3DObject DrawingBuffer::framebuffer() const | 534 Platform3DObject DrawingBuffer::framebuffer() const |
533 { | 535 { |
534 return m_fbo; | 536 return m_fbo; |
535 } | 537 } |
536 | 538 |
537 WebLayer* DrawingBuffer::platformLayer() | 539 WebLayer* DrawingBuffer::platformLayer() |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 1019 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
1018 { | 1020 { |
1019 if (info->imageId) { | 1021 if (info->imageId) { |
1020 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 1022 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
1021 m_context->destroyImageCHROMIUM(info->imageId); | 1023 m_context->destroyImageCHROMIUM(info->imageId); |
1022 info->imageId = 0; | 1024 info->imageId = 0; |
1023 } | 1025 } |
1024 } | 1026 } |
1025 | 1027 |
1026 } // namespace blink | 1028 } // namespace blink |
OLD | NEW |