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); | |
Ken Russell (switch to Gerrit)
2014/03/12 21:23:38
One of the two callers of this method is ImageBuff
| |
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->bindTexture(GL_TEXTURE_2D, boundTexture); | |
345 m_context->flush(); | |
346 | |
347 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint(); | |
333 | 348 |
334 if (!context->makeContextCurrent()) | 349 if (!context->makeContextCurrent()) |
335 return false; | 350 return false; |
336 | 351 |
337 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel)) | 352 Platform3DObject sourceTexture = context->createTexture(); |
338 return false; | 353 |
354 context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture); | |
Ken Russell (switch to Gerrit)
2014/03/12 21:23:38
There are only two callers of DrawingBuffer::copyT
| |
355 context->bindTexture(GL_TEXTURE_2D, sourceTexture); | |
356 | |
357 context->waitSyncPoint(bufferMailbox->mailbox.syncPoint); | |
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); | |
Ken Russell (switch to Gerrit)
2014/03/12 21:23:38
Again, this can bind NULL in order to delete sourc
| |
376 context->deleteTexture(sourceTexture); | |
377 | |
354 context->flush(); | 378 context->flush(); |
379 m_context->waitSyncPoint(context->insertSyncPoint()); | |
355 | 380 |
356 return true; | 381 return true; |
357 } | 382 } |
358 | 383 |
359 Platform3DObject DrawingBuffer::framebuffer() const | 384 Platform3DObject DrawingBuffer::framebuffer() const |
360 { | 385 { |
361 return m_fbo; | 386 return m_fbo; |
362 } | 387 } |
363 | 388 |
364 blink::WebLayer* DrawingBuffer::platformLayer() | 389 blink::WebLayer* DrawingBuffer::platformLayer() |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
896 } | 921 } |
897 } | 922 } |
898 | 923 |
899 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) |
900 { | 925 { |
901 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); | 926 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); |
902 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); |
903 } | 928 } |
904 | 929 |
905 } // namespace WebCore | 930 } // namespace WebCore |
OLD | NEW |