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

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

Issue 179973004: Share Group plumbing in Blink; Remove WebGL from default share group (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Changed nullptr to 0 Created 6 years, 10 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
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Context may be in a different share group. Must copy texture first
Ken Russell (switch to Gerrit) 2014/03/04 03:55:03 Please clarify the comment. Something like "Must t
340 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
341 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
Ken Russell (switch to Gerrit) 2014/03/04 03:55:03 There's an attempt elsewhere in the DrawingBuffer
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);
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();
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
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 } 918 }
895 } 919 }
896 920
897 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment) 921 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment)
898 { 922 {
899 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); 923 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
900 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0); 924 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0);
901 } 925 }
902 926
903 } // namespace WebCore 927 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698