Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 03a2a4fdad2bf1a201aca6c4808f7735a2b640cb..05e57da481a7b96db931df5faac5d19367f54b07 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -39,6 +39,7 @@ |
#include "gpu/command_buffer/service/framebuffer_manager.h" |
#include "gpu/command_buffer/service/gl_stream_texture_image.h" |
#include "gpu/command_buffer/service/gl_utils.h" |
+#include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.h" |
#include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" |
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
#include "gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h" |
@@ -2173,6 +2174,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
TextureToIOSurfaceMap texture_to_io_surface_map_; |
#endif |
+ std::unique_ptr<ApplyFramebufferAttachmentCMAAINTELResourceManager> |
+ apply_framebuffer_attachment_cmaa_intel_; |
std::unique_ptr<CopyTextureCHROMIUMResourceManager> copy_texture_CHROMIUM_; |
std::unique_ptr<ClearFramebufferResourceManager> clear_framebuffer_blit_; |
@@ -4237,6 +4240,11 @@ void GLES2DecoderImpl::Destroy(bool have_context) { |
} |
ReleaseAllBackTextures(); |
if (have_context) { |
+ if (apply_framebuffer_attachment_cmaa_intel_.get()) { |
+ apply_framebuffer_attachment_cmaa_intel_->Destroy(); |
+ apply_framebuffer_attachment_cmaa_intel_.reset(); |
+ } |
+ |
if (copy_texture_CHROMIUM_.get()) { |
copy_texture_CHROMIUM_->Destroy(); |
copy_texture_CHROMIUM_.reset(); |
@@ -4308,6 +4316,7 @@ void GLES2DecoderImpl::Destroy(bool have_context) { |
// state_.current_program object. |
state_.current_program = NULL; |
+ apply_framebuffer_attachment_cmaa_intel_.reset(); |
copy_texture_CHROMIUM_.reset(); |
clear_framebuffer_blit_.reset(); |
@@ -15134,7 +15143,27 @@ void GLES2DecoderImpl::DoApplyScreenSpaceAntialiasingCHROMIUM() { |
// Apply CMAA(Conservative Morphological Anti-Aliasing) algorithm to the |
// color attachments of currently bound draw framebuffer. |
// Reference GL_INTEL_framebuffer_CMAA for details. |
- glApplyFramebufferAttachmentCMAAINTEL(); |
+ // Use platform version if available. |
+ if (!feature_info_->feature_flags() |
+ .use_chromium_screen_space_antialiasing_via_shaders) { |
+ glApplyFramebufferAttachmentCMAAINTEL(); |
+ } else { |
+ // Defer initializing the CopyTextureCHROMIUMResourceManager until it is |
+ // needed because it takes ??s of milliseconds to initialize. |
+ if (!apply_framebuffer_attachment_cmaa_intel_.get()) { |
+ LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER( |
+ "glApplyFramebufferAttachmentCMAAINTEL"); |
+ apply_framebuffer_attachment_cmaa_intel_.reset( |
+ new ApplyFramebufferAttachmentCMAAINTELResourceManager()); |
+ apply_framebuffer_attachment_cmaa_intel_->Initialize(this); |
+ RestoreCurrentFramebufferBindings(); |
+ if (LOCAL_PEEK_GL_ERROR("glApplyFramebufferAttachmentCMAAINTEL") != |
+ GL_NO_ERROR) |
+ return; |
+ } |
+ apply_framebuffer_attachment_cmaa_intel_ |
+ ->ApplyFramebufferAttachmentCMAAINTEL(this); |
+ } |
} |
void GLES2DecoderImpl::DoInsertEventMarkerEXT( |