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

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

Issue 1301923002: Add GL_CHROMIUM_screen_space_antialiasing to support alternative AA (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add empty implementation Created 5 years, 3 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
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | public/platform/WebGraphicsContext3D.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 , m_discardFramebufferSupported(discardFramebufferSupported) 147 , m_discardFramebufferSupported(discardFramebufferSupported)
148 , m_fbo(0) 148 , m_fbo(0)
149 , m_depthStencilBuffer(0) 149 , m_depthStencilBuffer(0)
150 , m_depthBuffer(0) 150 , m_depthBuffer(0)
151 , m_stencilBuffer(0) 151 , m_stencilBuffer(0)
152 , m_multisampleFBO(0) 152 , m_multisampleFBO(0)
153 , m_multisampleColorBuffer(0) 153 , m_multisampleColorBuffer(0)
154 , m_contentsChanged(true) 154 , m_contentsChanged(true)
155 , m_contentsChangeCommitted(false) 155 , m_contentsChangeCommitted(false)
156 , m_bufferClearNeeded(false) 156 , m_bufferClearNeeded(false)
157 , m_multisampleMode(None) 157 , m_antiAliasingMode(None)
158 , m_internalColorFormat(0) 158 , m_internalColorFormat(0)
159 , m_colorFormat(0) 159 , m_colorFormat(0)
160 , m_internalRenderbufferFormat(0) 160 , m_internalRenderbufferFormat(0)
161 , m_maxTextureSize(0) 161 , m_maxTextureSize(0)
162 , m_sampleCount(0) 162 , m_sampleCount(0)
163 , m_packAlignment(4) 163 , m_packAlignment(4)
164 , m_destructionInProgress(false) 164 , m_destructionInProgress(false)
165 , m_isHidden(false) 165 , m_isHidden(false)
166 , m_filterQuality(kLow_SkFilterQuality) 166 , m_filterQuality(kLow_SkFilterQuality)
167 { 167 {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // 2. The compositor begins the frame. 242 // 2. The compositor begins the frame.
243 // 3. Javascript makes a context lost using WEBGL_lose_context extension . 243 // 3. Javascript makes a context lost using WEBGL_lose_context extension .
244 // 4. Here. 244 // 4. Here.
245 return false; 245 return false;
246 } 246 }
247 ASSERT(!m_isHidden); 247 ASSERT(!m_isHidden);
248 if (!m_contentsChanged) 248 if (!m_contentsChanged)
249 return false; 249 return false;
250 250
251 // Resolve the multisampled buffer into m_colorBuffer texture. 251 // Resolve the multisampled buffer into m_colorBuffer texture.
252 if (m_multisampleMode != None) 252 if (m_antiAliasingMode != None)
253 commit(); 253 commit();
254 254
255 if (bitmap) { 255 if (bitmap) {
256 bitmap->setSize(size()); 256 bitmap->setSize(size());
257 257
258 unsigned char* pixels = bitmap->pixels(); 258 unsigned char* pixels = bitmap->pixels();
259 bool needPremultiply = m_actualAttributes.alpha && !m_actualAttributes.p remultipliedAlpha; 259 bool needPremultiply = m_actualAttributes.alpha && !m_actualAttributes.p remultipliedAlpha;
260 WebGLImageConversion::AlphaOp op = needPremultiply ? WebGLImageConversio n::AlphaDoPremultiply : WebGLImageConversion::AlphaDoNothing; 260 WebGLImageConversion::AlphaOp op = needPremultiply ? WebGLImageConversio n::AlphaDoPremultiply : WebGLImageConversion::AlphaDoNothing;
261 if (pixels) 261 if (pixels)
262 readBackFramebuffer(pixels, size().width(), size().height(), Readbac kSkia, op); 262 readBackFramebuffer(pixels, size().width(), size().height(), Readbac kSkia, op);
(...skipping 18 matching lines...) Expand all
281 frontColorBufferMailbox = createNewMailbox(newTexture); 281 frontColorBufferMailbox = createNewMailbox(newTexture);
282 } 282 }
283 283
284 if (m_preserveDrawingBuffer == Discard) { 284 if (m_preserveDrawingBuffer == Discard) {
285 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer); 285 std::swap(frontColorBufferMailbox->textureInfo, m_colorBuffer);
286 // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a 286 // It appears safe to overwrite the context's framebuffer binding in the Discard case since there will always be a
287 // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding. 287 // WebGLRenderingContext::clearIfComposited() call made before the next draw call which restores the framebuffer binding.
288 // If this stops being true at some point, we should track the current f ramebuffer binding in the DrawingBuffer and restore 288 // If this stops being true at some point, we should track the current f ramebuffer binding in the DrawingBuffer and restore
289 // it after attaching the new back buffer here. 289 // it after attaching the new back buffer here.
290 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); 290 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
291 if (m_multisampleMode == ImplicitResolve) 291 if (m_antiAliasingMode == MSAAImplicitResolve)
292 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COL OR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); 292 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COL OR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount);
293 else 293 else
294 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D, m_colorBuffer.textureId, 0); 294 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 , GL_TEXTURE_2D, m_colorBuffer.textureId, 0);
295 295
296 if (m_discardFramebufferSupported) { 296 if (m_discardFramebufferSupported) {
297 // Explicitly discard framebuffer to save GPU memory bandwidth for t ile-based GPU arch. 297 // Explicitly discard framebuffer to save GPU memory bandwidth for t ile-based GPU arch.
298 const WGC3Denum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_AT TACHMENT, GL_STENCIL_ATTACHMENT}; 298 const WGC3Denum attachments[3] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_AT TACHMENT, GL_STENCIL_ATTACHMENT};
299 m_context->discardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments); 299 m_context->discardFramebufferEXT(GL_FRAMEBUFFER, 3, attachments);
300 } 300 }
301 } else { 301 } else {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 m_internalRenderbufferFormat = GL_RGBA8_OES; 423 m_internalRenderbufferFormat = GL_RGBA8_OES;
424 } else { 424 } else {
425 m_internalColorFormat = GL_RGB; 425 m_internalColorFormat = GL_RGB;
426 m_colorFormat = GL_RGB; 426 m_colorFormat = GL_RGB;
427 m_internalRenderbufferFormat = GL_RGB8_OES; 427 m_internalRenderbufferFormat = GL_RGB8_OES;
428 } 428 }
429 429
430 m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize); 430 m_context->getIntegerv(GL_MAX_TEXTURE_SIZE, &m_maxTextureSize);
431 431
432 int maxSampleCount = 0; 432 int maxSampleCount = 0;
433 m_multisampleMode = None; 433 m_antiAliasingMode = None;
434 if (m_requestedAttributes.antialias && m_multisampleExtensionSupported) { 434 if (m_requestedAttributes.antialias && m_multisampleExtensionSupported) {
435 m_context->getIntegerv(GL_MAX_SAMPLES_ANGLE, &maxSampleCount); 435 m_context->getIntegerv(GL_MAX_SAMPLES_ANGLE, &maxSampleCount);
436 m_multisampleMode = ExplicitResolve; 436 m_antiAliasingMode = MSAAExplicitResolve;
437 if (m_extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_t exture")) 437 if (m_extensionsUtil->supportsExtension("GL_EXT_multisampled_render_to_t exture")) {
438 m_multisampleMode = ImplicitResolve; 438 m_antiAliasingMode = MSAAImplicitResolve;
439 } else if (m_extensionsUtil->supportsExtension("GL_CHROMIUM_screen_space _antialiasing")) {
440 m_antiAliasingMode = ScreenSpaceAntialiasing;
441 }
439 } 442 }
440 m_sampleCount = std::min(4, maxSampleCount); 443 m_sampleCount = std::min(4, maxSampleCount);
441 444
442 m_fbo = m_context->createFramebuffer(); 445 m_fbo = m_context->createFramebuffer();
443 446
444 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); 447 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
445 m_colorBuffer.textureId = createColorTexture(); 448 m_colorBuffer.textureId = createColorTexture();
446 if (m_multisampleMode == ImplicitResolve) 449 if (m_antiAliasingMode == MSAAImplicitResolve)
447 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); 450 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount);
448 else 451 else
449 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_colorBuffer.textureId, 0); 452 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_colorBuffer.textureId, 0);
450 createSecondaryBuffers(); 453 createSecondaryBuffers();
451 // We first try to initialize everything with the requested attributes. 454 // We first try to initialize everything with the requested attributes.
452 if (!reset(size)) 455 if (!reset(size))
453 return false; 456 return false;
454 // If that succeeds, we then see what we actually got and update our actual attributes to reflect that. 457 // If that succeeds, we then see what we actually got and update our actual attributes to reflect that.
455 m_actualAttributes = m_requestedAttributes; 458 m_actualAttributes = m_requestedAttributes;
456 if (m_requestedAttributes.alpha) { 459 if (m_requestedAttributes.alpha) {
(...skipping 18 matching lines...) Expand all
475 return false; 478 return false;
476 } 479 }
477 480
478 return true; 481 return true;
479 } 482 }
480 483
481 bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platfor m3DObject texture, GLenum internalFormat, 484 bool DrawingBuffer::copyToPlatformTexture(WebGraphicsContext3D* context, Platfor m3DObject texture, GLenum internalFormat,
482 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawi ngBuffer sourceBuffer) 485 GLenum destType, GLint level, bool premultiplyAlpha, bool flipY, SourceDrawi ngBuffer sourceBuffer)
483 { 486 {
484 if (m_contentsChanged) { 487 if (m_contentsChanged) {
485 if (m_multisampleMode != None) { 488 if (m_antiAliasingMode != None) {
486 commit(); 489 commit();
487 restoreFramebufferBindings(); 490 restoreFramebufferBindings();
488 } 491 }
489 m_context->flush(); 492 m_context->flush();
490 } 493 }
491 494
492 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalForm at, destType, level)) 495 if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(GL_TEXTURE_2D, internalForm at, destType, level))
493 return false; 496 return false;
494 497
495 // Contexts may be in a different share group. We must transfer the texture through a mailbox first 498 // Contexts may be in a different share group. We must transfer the texture through a mailbox first
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 616 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
614 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ; 617 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE) ;
615 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ; 618 m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE) ;
616 619
617 return offscreenColorTexture; 620 return offscreenColorTexture;
618 } 621 }
619 622
620 void DrawingBuffer::createSecondaryBuffers() 623 void DrawingBuffer::createSecondaryBuffers()
621 { 624 {
622 // create a multisample FBO 625 // create a multisample FBO
623 if (m_multisampleMode == ExplicitResolve) { 626 if (m_antiAliasingMode == MSAAExplicitResolve) {
624 m_multisampleFBO = m_context->createFramebuffer(); 627 m_multisampleFBO = m_context->createFramebuffer();
625 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); 628 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
626 m_multisampleColorBuffer = m_context->createRenderbuffer(); 629 m_multisampleColorBuffer = m_context->createRenderbuffer();
627 } 630 }
628 } 631 }
629 632
630 bool DrawingBuffer::resizeFramebuffer(const IntSize& size) 633 bool DrawingBuffer::resizeFramebuffer(const IntSize& size)
631 { 634 {
632 // resize regular FBO 635 // resize regular FBO
633 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); 636 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
634 637
635 m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer.textureId); 638 m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer.textureId);
636 639
637 allocateTextureMemory(&m_colorBuffer, size); 640 allocateTextureMemory(&m_colorBuffer, size);
638 641
639 if (m_multisampleMode == ImplicitResolve) 642 if (m_antiAliasingMode == MSAAImplicitResolve)
640 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); 643 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount);
641 else 644 else
642 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_colorBuffer.textureId, 0); 645 m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL _TEXTURE_2D, m_colorBuffer.textureId, 0);
643 646
644 m_context->bindTexture(GL_TEXTURE_2D, 0); 647 m_context->bindTexture(GL_TEXTURE_2D, 0);
645 648
646 if (m_multisampleMode != ExplicitResolve) 649 if (m_antiAliasingMode != MSAAExplicitResolve)
647 resizeDepthStencil(size); 650 resizeDepthStencil(size);
648 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMP LETE) 651 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMP LETE)
649 return false; 652 return false;
650 653
651 return true; 654 return true;
652 } 655 }
653 656
654 bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size) 657 bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size)
655 { 658 {
656 if (m_multisampleMode == ExplicitResolve) { 659 if (m_antiAliasingMode == MSAAExplicitResolve) {
657 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO); 660 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_multisampleFBO);
658 661
659 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer); 662 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_multisampleColorBuffer);
660 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sam pleCount, m_internalRenderbufferFormat, size.width(), size.height()); 663 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m_sam pleCount, m_internalRenderbufferFormat, size.width(), size.height());
661 664
662 if (m_context->getError() == GL_OUT_OF_MEMORY) 665 if (m_context->getError() == GL_OUT_OF_MEMORY)
663 return false; 666 return false;
664 667
665 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer); 668 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
666 resizeDepthStencil(size); 669 resizeDepthStencil(size);
667 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_ COMPLETE) 670 if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_ COMPLETE)
668 return false; 671 return false;
669 } 672 }
670 673
671 return true; 674 return true;
672 } 675 }
673 676
674 void DrawingBuffer::resizeDepthStencil(const IntSize& size) 677 void DrawingBuffer::resizeDepthStencil(const IntSize& size)
675 { 678 {
676 if (!m_requestedAttributes.depth && !m_requestedAttributes.stencil) 679 if (!m_requestedAttributes.depth && !m_requestedAttributes.stencil)
677 return; 680 return;
678 681
679 if (m_packedDepthStencilExtensionSupported) { 682 if (m_packedDepthStencilExtensionSupported) {
680 if (!m_depthStencilBuffer) 683 if (!m_depthStencilBuffer)
681 m_depthStencilBuffer = m_context->createRenderbuffer(); 684 m_depthStencilBuffer = m_context->createRenderbuffer();
682 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer); 685 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthStencilBuffer);
683 if (m_multisampleMode == ImplicitResolve) 686 if (m_antiAliasingMode == MSAAImplicitResolve)
684 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_samp leCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 687 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_samp leCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
685 else if (m_multisampleMode == ExplicitResolve) 688 else if (m_antiAliasingMode == MSAAExplicitResolve)
686 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m _sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height()); 689 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFER, m _sampleCount, GL_DEPTH24_STENCIL8_OES, size.width(), size.height());
687 else 690 else
688 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_ OES, size.width(), size.height()); 691 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_ OES, size.width(), size.height());
689 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT , GL_RENDERBUFFER, m_depthStencilBuffer); 692 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT , GL_RENDERBUFFER, m_depthStencilBuffer);
690 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer); 693 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilBuffer);
691 } else { 694 } else {
692 if (m_requestedAttributes.depth) { 695 if (m_requestedAttributes.depth) {
693 if (!m_depthBuffer) 696 if (!m_depthBuffer)
694 m_depthBuffer = m_context->createRenderbuffer(); 697 m_depthBuffer = m_context->createRenderbuffer();
695 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); 698 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer);
696 if (m_multisampleMode == ImplicitResolve) 699 if (m_antiAliasingMode == MSAAImplicitResolve)
697 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); 700 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
698 else if (m_multisampleMode == ExplicitResolve) 701 else if (m_antiAliasingMode == MSAAExplicitResolve)
699 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height()); 702 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_DEPTH_COMPONENT16, size.width(), size.height());
700 else 703 else
701 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONE NT16, size.width(), size.height()); 704 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONE NT16, size.width(), size.height());
702 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHME NT, GL_RENDERBUFFER, m_depthBuffer); 705 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHME NT, GL_RENDERBUFFER, m_depthBuffer);
703 } 706 }
704 if (m_requestedAttributes.stencil) { 707 if (m_requestedAttributes.stencil) {
705 if (!m_stencilBuffer) 708 if (!m_stencilBuffer)
706 m_stencilBuffer = m_context->createRenderbuffer(); 709 m_stencilBuffer = m_context->createRenderbuffer();
707 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer); 710 m_context->bindRenderbuffer(GL_RENDERBUFFER, m_stencilBuffer);
708 if (m_multisampleMode == ImplicitResolve) 711 if (m_antiAliasingMode == MSAAImplicitResolve)
709 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_STENCIL_INDEX8, size.width(), size.height()); 712 m_context->renderbufferStorageMultisampleEXT(GL_RENDERBUFFER, m_ sampleCount, GL_STENCIL_INDEX8, size.width(), size.height());
710 else if (m_multisampleMode == ExplicitResolve) 713 else if (m_antiAliasingMode == MSAAExplicitResolve)
711 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_STENCIL_INDEX8, size.width(), size.height()); 714 m_context->renderbufferStorageMultisampleCHROMIUM(GL_RENDERBUFFE R, m_sampleCount, GL_STENCIL_INDEX8, size.width(), size.height());
712 else 715 else
713 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX 8, size.width(), size.height()); 716 m_context->renderbufferStorage(GL_RENDERBUFFER, GL_STENCIL_INDEX 8, size.width(), size.height());
714 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACH MENT, GL_RENDERBUFFER, m_stencilBuffer); 717 m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACH MENT, GL_RENDERBUFFER, m_stencilBuffer);
715 } 718 }
716 } 719 }
717 m_context->bindRenderbuffer(GL_RENDERBUFFER, 0); 720 m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
718 } 721 }
719 722
720 723
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 int width = m_size.width(); 811 int width = m_size.width();
809 int height = m_size.height(); 812 int height = m_size.height();
810 // Use NEAREST, because there is no scale performed during the blit. 813 // Use NEAREST, because there is no scale performed during the blit.
811 m_context->blitFramebufferCHROMIUM(0, 0, width, height, 0, 0, width, hei ght, GL_COLOR_BUFFER_BIT, GL_NEAREST); 814 m_context->blitFramebufferCHROMIUM(0, 0, width, height, 0, 0, width, hei ght, GL_COLOR_BUFFER_BIT, GL_NEAREST);
812 815
813 if (m_scissorEnabled) 816 if (m_scissorEnabled)
814 m_context->enable(GL_SCISSOR_TEST); 817 m_context->enable(GL_SCISSOR_TEST);
815 } 818 }
816 819
817 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); 820 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo);
821 if (m_antiAliasingMode == ScreenSpaceAntialiasing) {
822 m_context->applyScreenSpaceAntialiasingCHROMIUM();
823 }
818 m_contentsChangeCommitted = true; 824 m_contentsChangeCommitted = true;
819 } 825 }
820 826
821 void DrawingBuffer::restoreFramebufferBindings() 827 void DrawingBuffer::restoreFramebufferBindings()
822 { 828 {
823 if (m_drawFramebufferBinding && m_readFramebufferBinding) { 829 if (m_drawFramebufferBinding && m_readFramebufferBinding) {
824 if (m_drawFramebufferBinding == m_readFramebufferBinding) { 830 if (m_drawFramebufferBinding == m_readFramebufferBinding) {
825 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_readFramebufferBinding) ; 831 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_readFramebufferBinding) ;
826 } else { 832 } else {
827 m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBin ding); 833 m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBin ding);
828 m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBin ding); 834 m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBin ding);
829 } 835 }
830 return; 836 return;
831 } 837 }
832 if (!m_drawFramebufferBinding && !m_readFramebufferBinding) { 838 if (!m_drawFramebufferBinding && !m_readFramebufferBinding) {
833 bind(GL_FRAMEBUFFER); 839 bind(GL_FRAMEBUFFER);
834 return; 840 return;
835 } 841 }
836 if (!m_drawFramebufferBinding) { 842 if (!m_drawFramebufferBinding) {
837 bind(GL_DRAW_FRAMEBUFFER); 843 bind(GL_DRAW_FRAMEBUFFER);
838 m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding ); 844 m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBinding );
839 } else { 845 } else {
840 bind(GL_READ_FRAMEBUFFER); 846 bind(GL_READ_FRAMEBUFFER);
841 m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBinding ); 847 m_context->bindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebufferBinding );
842 } 848 }
843 } 849 }
844 850
845 bool DrawingBuffer::multisample() const 851 bool DrawingBuffer::multisample() const
846 { 852 {
847 return m_multisampleMode != None; 853 return m_antiAliasingMode != None;
848 } 854 }
849 855
850 void DrawingBuffer::bind(GLenum target) 856 void DrawingBuffer::bind(GLenum target)
851 { 857 {
852 if (target != GL_READ_FRAMEBUFFER) 858 if (target != GL_READ_FRAMEBUFFER)
853 m_context->bindFramebuffer(target, m_multisampleFBO ? m_multisampleFBO : m_fbo); 859 m_context->bindFramebuffer(target, m_multisampleFBO ? m_multisampleFBO : m_fbo);
854 else 860 else
855 m_context->bindFramebuffer(target, m_fbo); 861 m_context->bindFramebuffer(target, m_fbo);
856 } 862 }
857 863
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) 1017 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
1012 { 1018 {
1013 if (info->imageId) { 1019 if (info->imageId) {
1014 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); 1020 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
1015 m_context->destroyImageCHROMIUM(info->imageId); 1021 m_context->destroyImageCHROMIUM(info->imageId);
1016 info->imageId = 0; 1022 info->imageId = 0;
1017 } 1023 }
1018 } 1024 }
1019 1025
1020 } // namespace blink 1026 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | public/platform/WebGraphicsContext3D.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698