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

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: Fixed issue Ken described. Created 6 years, 9 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 // Contexts may be in a different share group. We must transfer the texture through a mailbox first
337 RefPtr<MailboxInfo> bufferMailbox = adoptRef(new MailboxInfo());
338 m_context->genMailboxCHROMIUM(bufferMailbox->mailbox.name);
339 m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer);
340 m_context->produceTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name );
341 m_context->flush();
342
343 bufferMailbox->mailbox.syncPoint = m_context->insertSyncPoint();
333 344
334 if (!context->makeContextCurrent()) 345 if (!context->makeContextCurrent())
335 return false; 346 return false;
336 347
337 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(internalFormat, destType, l evel)) 348 Platform3DObject sourceTexture = context->createTexture();
338 return false; 349
350 // TODO(bajones): Should be able to change the texture bindings here without reverting but
351 // something else in the system is depending on it. Failing to revert causes WebGL
352 // tests to fail. We should find out why and fix it.
353 GLint boundTexture = 0;
354 context->getIntegerv(GL_TEXTURE_BINDING_2D, &boundTexture);
355 context->bindTexture(GL_TEXTURE_2D, sourceTexture);
356 context->waitSyncPoint(bufferMailbox->mailbox.syncPoint);
357 context->consumeTextureCHROMIUM(GL_TEXTURE_2D, bufferMailbox->mailbox.name);
339 358
340 bool unpackPremultiplyAlphaNeeded = false; 359 bool unpackPremultiplyAlphaNeeded = false;
341 bool unpackUnpremultiplyAlphaNeeded = false; 360 bool unpackUnpremultiplyAlphaNeeded = false;
342 if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlp ha) 361 if (m_attributes.alpha && m_attributes.premultipliedAlpha && !premultiplyAlp ha)
343 unpackUnpremultiplyAlphaNeeded = true; 362 unpackUnpremultiplyAlphaNeeded = true;
344 else if (m_attributes.alpha && !m_attributes.premultipliedAlpha && premultip lyAlpha) 363 else if (m_attributes.alpha && !m_attributes.premultipliedAlpha && premultip lyAlpha)
345 unpackPremultiplyAlphaNeeded = true; 364 unpackPremultiplyAlphaNeeded = true;
346 365
347 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpackUnpremu ltiplyAlphaNeeded); 366 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, unpackUnpremu ltiplyAlphaNeeded);
348 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackPremultip lyAlphaNeeded); 367 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, unpackPremultip lyAlphaNeeded);
349 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, flipY); 368 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, flipY);
350 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType); 369 context->copyTextureCHROMIUM(GL_TEXTURE_2D, sourceTexture, texture, level, i nternalFormat, destType);
351 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false); 370 context->pixelStorei(GC3D_UNPACK_FLIP_Y_CHROMIUM, false);
352 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false); 371 context->pixelStorei(GC3D_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM, false);
353 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false); 372 context->pixelStorei(GC3D_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM, false);
373
374 context->bindTexture(GL_TEXTURE_2D, boundTexture);
375 context->deleteTexture(sourceTexture);
376
354 context->flush(); 377 context->flush();
378 m_context->waitSyncPoint(context->insertSyncPoint());
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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 } 920 }
897 } 921 }
898 922
899 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment) 923 void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in ternalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLint unpackAlignment)
900 { 924 {
901 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8); 925 ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
902 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0); 926 m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0);
903 } 927 }
904 928
905 } // namespace WebCore 929 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698