| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } else { | 301 } else { |
| 302 m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailb
ox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.inter
nalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); | 302 m_gl->CopyTextureCHROMIUM(m_colorBuffer.textureId, frontColorBufferMailb
ox->textureInfo.textureId, frontColorBufferMailbox->textureInfo.parameters.inter
nalColorFormat, GL_UNSIGNED_BYTE, GL_FALSE, GL_FALSE, GL_FALSE); |
| 303 } | 303 } |
| 304 | 304 |
| 305 restoreFramebufferBindings(); | 305 restoreFramebufferBindings(); |
| 306 m_contentsChanged = false; | 306 m_contentsChanged = false; |
| 307 | 307 |
| 308 m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.text
ureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferM
ailbox->mailbox.name); | 308 m_gl->ProduceTextureDirectCHROMIUM(frontColorBufferMailbox->textureInfo.text
ureId, frontColorBufferMailbox->textureInfo.parameters.target, frontColorBufferM
ailbox->mailbox.name); |
| 309 const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); | 309 const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); |
| 310 m_gl->Flush(); | 310 m_gl->Flush(); |
| 311 frontColorBufferMailbox->mailbox.validSyncToken = m_context->genSyncTokenCHR
OMIUM(fenceSync, frontColorBufferMailbox->mailbox.syncToken); | 311 m_gl->GenSyncTokenCHROMIUM(fenceSync, frontColorBufferMailbox->mailbox.syncT
oken); |
| 312 frontColorBufferMailbox->mailbox.validSyncToken = true; |
| 312 frontColorBufferMailbox->mailbox.allowOverlay = frontColorBufferMailbox->tex
tureInfo.imageId != 0; | 313 frontColorBufferMailbox->mailbox.allowOverlay = frontColorBufferMailbox->tex
tureInfo.imageId != 0; |
| 313 frontColorBufferMailbox->mailbox.textureTarget = frontColorBufferMailbox->te
xtureInfo.parameters.target; | 314 frontColorBufferMailbox->mailbox.textureTarget = frontColorBufferMailbox->te
xtureInfo.parameters.target; |
| 314 frontColorBufferMailbox->mailbox.textureSize = WebSize(m_size.width(), m_siz
e.height()); | 315 frontColorBufferMailbox->mailbox.textureSize = WebSize(m_size.width(), m_siz
e.height()); |
| 315 setBufferClearNeeded(true); | 316 setBufferClearNeeded(true); |
| 316 | 317 |
| 317 // set m_parentDrawingBuffer to make sure 'this' stays alive as long as it h
as live mailboxes | 318 // set m_parentDrawingBuffer to make sure 'this' stays alive as long as it h
as live mailboxes |
| 318 ASSERT(!frontColorBufferMailbox->m_parentDrawingBuffer); | 319 ASSERT(!frontColorBufferMailbox->m_parentDrawingBuffer); |
| 319 frontColorBufferMailbox->m_parentDrawingBuffer = this; | 320 frontColorBufferMailbox->m_parentDrawingBuffer = this; |
| 320 *outMailbox = frontColorBufferMailbox->mailbox; | 321 *outMailbox = frontColorBufferMailbox->mailbox; |
| 321 m_frontColorBuffer = { frontColorBufferMailbox->textureInfo, frontColorBuffe
rMailbox->mailbox }; | 322 m_frontColorBuffer = { frontColorBufferMailbox->textureInfo, frontColorBuffe
rMailbox->mailbox }; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 textureId = m_frontColorBuffer.texInfo.textureId; | 526 textureId = m_frontColorBuffer.texInfo.textureId; |
| 526 mailbox = m_frontColorBuffer.mailbox; | 527 mailbox = m_frontColorBuffer.mailbox; |
| 527 target = m_frontColorBuffer.texInfo.parameters.target; | 528 target = m_frontColorBuffer.texInfo.parameters.target; |
| 528 } else { | 529 } else { |
| 529 textureId = m_colorBuffer.textureId; | 530 textureId = m_colorBuffer.textureId; |
| 530 target = m_colorBuffer.parameters.target; | 531 target = m_colorBuffer.parameters.target; |
| 531 m_gl->GenMailboxCHROMIUM(mailbox.name); | 532 m_gl->GenMailboxCHROMIUM(mailbox.name); |
| 532 m_gl->ProduceTextureDirectCHROMIUM(textureId, target, mailbox.name); | 533 m_gl->ProduceTextureDirectCHROMIUM(textureId, target, mailbox.name); |
| 533 const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); | 534 const GLuint64 fenceSync = m_gl->InsertFenceSyncCHROMIUM(); |
| 534 m_gl->Flush(); | 535 m_gl->Flush(); |
| 535 mailbox.validSyncToken = m_context->genSyncTokenCHROMIUM(fenceSync, mail
box.syncToken); | 536 m_gl->GenSyncTokenCHROMIUM(fenceSync, mailbox.syncToken); |
| 537 mailbox.validSyncToken = true; |
| 536 } | 538 } |
| 537 | 539 |
| 538 if (mailbox.validSyncToken) | 540 if (mailbox.validSyncToken) |
| 539 gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); | 541 gl->WaitSyncTokenCHROMIUM(mailbox.syncToken); |
| 540 Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(target,
mailbox.name); | 542 Platform3DObject sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(target,
mailbox.name); |
| 541 | 543 |
| 542 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; | 544 GLboolean unpackPremultiplyAlphaNeeded = GL_FALSE; |
| 543 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; | 545 GLboolean unpackUnpremultiplyAlphaNeeded = GL_FALSE; |
| 544 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr
emultiplyAlpha) | 546 if (m_actualAttributes.alpha && m_actualAttributes.premultipliedAlpha && !pr
emultiplyAlpha) |
| 545 unpackUnpremultiplyAlphaNeeded = GL_TRUE; | 547 unpackUnpremultiplyAlphaNeeded = GL_TRUE; |
| 546 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha
&& premultiplyAlpha) | 548 else if (m_actualAttributes.alpha && !m_actualAttributes.premultipliedAlpha
&& premultiplyAlpha) |
| 547 unpackPremultiplyAlphaNeeded = GL_TRUE; | 549 unpackPremultiplyAlphaNeeded = GL_TRUE; |
| 548 | 550 |
| 549 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, fl
ipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); | 551 gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType, fl
ipY, unpackPremultiplyAlphaNeeded, unpackUnpremultiplyAlphaNeeded); |
| 550 | 552 |
| 551 context->deleteTexture(sourceTexture); | 553 context->deleteTexture(sourceTexture); |
| 552 | 554 |
| 553 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); | 555 const GLuint64 fenceSync = gl->InsertFenceSyncCHROMIUM(); |
| 554 | 556 |
| 555 gl->Flush(); | 557 gl->Flush(); |
| 556 GLbyte syncToken[24]; | 558 GLbyte syncToken[24]; |
| 557 if (context->genSyncTokenCHROMIUM(fenceSync, syncToken)) | 559 gl->GenSyncTokenCHROMIUM(fenceSync, syncToken); |
| 558 m_gl->WaitSyncTokenCHROMIUM(syncToken); | 560 m_gl->WaitSyncTokenCHROMIUM(syncToken); |
| 559 | 561 |
| 560 return true; | 562 return true; |
| 561 } | 563 } |
| 562 | 564 |
| 563 Platform3DObject DrawingBuffer::framebuffer() const | 565 Platform3DObject DrawingBuffer::framebuffer() const |
| 564 { | 566 { |
| 565 return m_fbo; | 567 return m_fbo; |
| 566 } | 568 } |
| 567 | 569 |
| 568 WebLayer* DrawingBuffer::platformLayer() | 570 WebLayer* DrawingBuffer::platformLayer() |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 | 1038 |
| 1037 if (m_antiAliasingMode == MSAAImplicitResolve) | 1039 if (m_antiAliasingMode == MSAAImplicitResolve) |
| 1038 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); | 1040 m_gl->FramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACH
MENT0, target, m_colorBuffer.textureId, 0, m_sampleCount); |
| 1039 else | 1041 else |
| 1040 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); | 1042 m_gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
m_colorBuffer.textureId, 0); |
| 1041 | 1043 |
| 1042 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); | 1044 m_gl->BindTexture(GL_TEXTURE_2D, m_texture2DBinding); |
| 1043 } | 1045 } |
| 1044 | 1046 |
| 1045 } // namespace blink | 1047 } // namespace blink |
| OLD | NEW |