Chromium Code Reviews| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 if (m_contentsChanged) { | 322 if (m_contentsChanged) { |
| 323 if (m_multisampleMode != None) { | 323 if (m_multisampleMode != None) { |
| 324 commit(); | 324 commit(); |
| 325 if (!m_framebufferBinding) | 325 if (!m_framebufferBinding) |
| 326 bind(); | 326 bind(); |
| 327 else | 327 else |
| 328 restoreFramebufferBinding(); | 328 restoreFramebufferBinding(); |
| 329 } | 329 } |
| 330 m_context->flush(); | 330 m_context->flush(); |
| 331 } | 331 } |
| 332 Platform3DObject sourceTexture = m_colorBuffer; | 332 |
| 333 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel)) | |
| 334 return false; | |
| 335 | |
| 336 GLint boundTexture = 0; | |
| 337 m_context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture); | |
| 338 | |
| 339 // Contexts may be in a different share group. We must transfer the texture through a mailbox first | |
| 340 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo()); | |
| 341 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name); | |
| 342 m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer); | |
| 343 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name ); | |
| 344 m_context->flush(); | |
| 345 | |
| 346 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); | |
| 347 m_context->waitSyncPoint(bufferMailbox->mailbox.syncPoint); | |
|
piman
2014/03/11 00:02:24
This is essentially a noop. You insert a sync poin
| |
| 348 | |
| 349 m_context->bindTexture(GL_TEXTURE_2D, boundTexture); | |
| 333 | 350 |
| 334 if (!context->makeContextCurrent()) | 351 if (!context->makeContextCurrent()) |
| 335 return false; | 352 return false; |
| 336 | 353 |
| 337 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel)) | 354 Platform3DObject sourceTexture = context->createTexture(); |
| 338 return false; | 355 |
| 356 context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture); | |
| 357 context->bindTexture(GL_TEXTURE_2D, sourceTexture); | |
| 358 context->consumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name); | |
| 339 | 359 |
| 340 bool unpackPremultiplyAlphaNeeded = false; | 360 bool unpackPremultiplyAlphaNeeded = false; |
| 341 bool unpackUnpremultiplyAlphaNeeded = false; | 361 bool unpackUnpremultiplyAlphaNeeded = false; |
| 342 if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlp ha) | 362 if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlp ha) |
| 343 unpackUnpremultiplyAlphaNeeded = true; | 363 unpackUnpremultiplyAlphaNeeded = true; |
| 344 else if (m_attributes.alpha && !m_attributes.premultipliedAlpha && premultip lyAlpha) | 364 else if (m_attributes.alpha && !m_attributes.premultipliedAlpha && premultip lyAlpha) |
| 345 unpackPremultiplyAlphaNeeded = true; | 365 unpackPremultiplyAlphaNeeded = true; |
| 346 | 366 |
| 347 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpackUnpremu ltiplyAlphaNeeded); | 367 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpackUnpremu ltiplyAlphaNeeded); |
| 348 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackPremultip lyAlphaNeeded); | 368 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackPremultip lyAlphaNeeded); |
| 349 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, flipY); | 369 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, flipY); |
| 350 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType); | 370 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType); |
| 351 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); | 371 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); |
| 352 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); | 372 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); |
| 353 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); | 373 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); |
| 374 | |
| 375 context->bindTexture(GL_TEXTURE_2D, boundTexture); | |
| 376 context->deleteTexture(sourceTexture); | |
| 377 | |
| 354 context->flush(); | 378 context->flush(); |
|
piman
2014/03/11 00:02:24
If you wanted to be thorough, you would want to in
| |
| 355 | 379 |
| 356 return true; | 380 return true; |
| 357 } | 381 } |
| 358 | 382 |
| 359 Platform3DObject DrawingBuffer::framebuffer() const | 383 Platform3DObject DrawingBuffer::framebuffer() const |
| 360 { | 384 { |
| 361 return m_fbo; | 385 return m_fbo; |
| 362 } | 386 } |
| 363 | 387 |
| 364 blink::WebLayer* DrawingBuffer::platformLayer() | 388 blink::WebLayer* DrawingBuffer::platformLayer() |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 897 } | 921 } |
| 898 } | 922 } |
| 899 | 923 |
| 900 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment) | 924 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment) |
| 901 { | 925 { |
| 902 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); | 926 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); |
| 903 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0); | 927 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0); |
| 904 } | 928 } |
| 905 | 929 |
| 906 } // namespace WebCore | 930 } // namespace WebCore |
| OLD | NEW |