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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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_multisampleMode = 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_multisampleMode = ExplicitResolve; |
| 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_multisampleMode = ImplicitResolve; |
| 439 } | |
| 440 if (m_extensionsUtil->supportsExtension("GL_INTEL_framebuffer_CMAA")) { | |
|
bajones
2015/08/19 16:26:44
Nit: This should be an `else if`
Ken Russell (switch to Gerrit)
2015/08/19 17:56:18
Or does the Intel hardware supporting INTEL_frameb
| |
| 441 m_multisampleMode = INTELCMAAResolve; | |
|
piman
2015/08/19 16:36:51
drive-by nit: CMAA is not multisampling, maybe ren
Ken Russell (switch to Gerrit)
2015/08/19 17:56:18
I like Antoine's suggestion. Could you please make
| |
| 442 } | |
| 439 } | 443 } |
| 440 m_sampleCount = std::min(4, maxSampleCount); | 444 m_sampleCount = std::min(4, maxSampleCount); |
| 441 | 445 |
| 442 m_fbo = m_context->createFramebuffer(); | 446 m_fbo = m_context->createFramebuffer(); |
| 443 | 447 |
| 444 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 448 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 445 m_colorBuffer.textureId = createColorTexture(); | 449 m_colorBuffer.textureId = createColorTexture(); |
| 446 if (m_multisampleMode == ImplicitResolve) | 450 if (m_multisampleMode == ImplicitResolve) |
| 447 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); | 451 m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_A TTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount); |
| 448 else | 452 else |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 808 int width = m_size.width(); | 812 int width = m_size.width(); |
| 809 int height = m_size.height(); | 813 int height = m_size.height(); |
| 810 // Use NEAREST, because there is no scale performed during the blit. | 814 // 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); | 815 m_context->blitFramebufferCHROMIUM(0, 0, width, height, 0, 0, width, hei ght, GL_COLOR_BUFFER_BIT, GL_NEAREST); |
| 812 | 816 |
| 813 if (m_scissorEnabled) | 817 if (m_scissorEnabled) |
| 814 m_context->enable(GL_SCISSOR_TEST); | 818 m_context->enable(GL_SCISSOR_TEST); |
| 815 } | 819 } |
| 816 | 820 |
| 817 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); | 821 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo); |
| 822 if (m_multisampleMode == INTELCMAAResolve) { | |
| 823 // Apply CMAA(Conservative Morphological Anti-Aliasing) algorithm to the color buffer of m_fbo. | |
| 824 // Reference: https://software.intel.com/en-us/articles/conservative-mor phological-anti-aliasing-cmaa | |
| 825 m_context->applyFramebufferAttachmentCMAAINTEL(); | |
| 826 } | |
| 818 m_contentsChangeCommitted = true; | 827 m_contentsChangeCommitted = true; |
| 819 } | 828 } |
| 820 | 829 |
| 821 void DrawingBuffer::restoreFramebufferBindings() | 830 void DrawingBuffer::restoreFramebufferBindings() |
| 822 { | 831 { |
| 823 if (m_drawFramebufferBinding && m_readFramebufferBinding) { | 832 if (m_drawFramebufferBinding && m_readFramebufferBinding) { |
| 824 if (m_drawFramebufferBinding == m_readFramebufferBinding) { | 833 if (m_drawFramebufferBinding == m_readFramebufferBinding) { |
| 825 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_readFramebufferBinding) ; | 834 m_context->bindFramebuffer(GL_FRAMEBUFFER, m_readFramebufferBinding) ; |
| 826 } else { | 835 } else { |
| 827 m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBin ding); | 836 m_context->bindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebufferBin ding); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) | 1020 void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info) |
| 1012 { | 1021 { |
| 1013 if (info->imageId) { | 1022 if (info->imageId) { |
| 1014 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); | 1023 m_context->releaseTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId); |
| 1015 m_context->destroyImageCHROMIUM(info->imageId); | 1024 m_context->destroyImageCHROMIUM(info->imageId); |
| 1016 info->imageId = 0; | 1025 info->imageId = 0; |
| 1017 } | 1026 } |
| 1018 } | 1027 } |
| 1019 | 1028 |
| 1020 } // namespace blink | 1029 } // namespace blink |
| OLD | NEW |