Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc |
| index b9209835ff59f42a90c35ec838a81ccef0fb802b..ecab7f037b826307aa5b30770bb75710bd4bb693 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.cc |
| @@ -29,7 +29,6 @@ ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
| width_(0), |
| height_(0), |
| copy_to_framebuffer_shader_(0), |
| - copy_to_image_shader_(0), |
| edges0_shader_(0), |
| edges1_shader_(0), |
| edges_combine_shader_(0), |
| @@ -47,8 +46,7 @@ ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
| edges1_shader_result_texture_(0), |
| edges_combine_shader_result_texture_float4_slot1_(0), |
| process_and_apply_shader_result_texture_float4_slot1_(0), |
| - edges_combine_shader_result_texture_slot2_(0), |
| - copy_to_image_shader_outTexture_(0) {} |
| + edges_combine_shader_result_texture_slot2_(0) {} |
| ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
| ~ApplyFramebufferAttachmentCMAAINTELResourceManager() { |
| @@ -61,9 +59,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::Initialize( |
| is_gles31_compatible_ = |
| decoder->GetGLContext()->GetVersionInfo()->IsAtLeastGLES(3, 1); |
| - copy_to_image_shader_ = CreateProgram("", vert_str_, copy_frag_str_); |
| - copy_to_framebuffer_shader_ = |
| - CreateProgram("#define OUT_FBO 1\n", vert_str_, copy_frag_str_); |
| + copy_to_framebuffer_shader_ = CreateProgram("", vert_str_, copy_frag_str_); |
| // Check if RGBA8UI is supported as an FBO colour target with depth. |
| // If not supported, GLSL needs to convert the data to/from float so there is |
| @@ -190,8 +186,6 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::Initialize( |
| glGetUniformLocation(edges_combine_shader_, "g_resultTextureSlot2"); |
| process_and_apply_shader_result_texture_float4_slot1_ = glGetUniformLocation( |
| process_and_apply_shader_, "g_resultTextureFlt4Slot1"); |
| - copy_to_image_shader_outTexture_ = |
| - glGetUniformLocation(copy_to_image_shader_, "outTexture"); |
| initialized_ = true; |
| } |
| @@ -202,7 +196,6 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::Destroy() { |
| ReleaseTextures(); |
| - glDeleteProgram(copy_to_image_shader_); |
| glDeleteProgram(copy_to_framebuffer_shader_); |
| glDeleteProgram(process_and_apply_shader_); |
| glDeleteProgram(edges_combine_shader_); |
| @@ -224,6 +217,11 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
| if (!framebuffer) |
| return; |
| + glDisable(GL_SCISSOR_TEST); |
| + glDisable(GL_STENCIL_TEST); |
| + glDisable(GL_CULL_FACE); |
| + glDisable(GL_BLEND); |
|
dshwang
2016/09/02 15:00:21
These was in CopyTexture(), but ApplyCMAAEffectTex
|
| + |
| GLuint last_framebuffer = framebuffer->service_id(); |
| // Process each color attachment of the current draw framebuffer. |
| @@ -251,11 +249,13 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
| // Copy source_texture to rgba8_texture_ |
| if (do_copy) { |
| - CopyTexture(source_texture, rgba8_texture_, false); |
| + glBindFramebufferEXT(GL_FRAMEBUFFER, copy_framebuffer_); |
| + glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| + GL_TEXTURE_2D, rgba8_texture_, 0); |
| + CopyTexture(source_texture); |
| } |
| // CMAA Effect |
| - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, last_framebuffer); |
| if (do_copy) { |
| ApplyCMAAEffectTexture(rgba8_texture_, rgba8_texture_); |
| } else { |
| @@ -272,7 +272,7 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager:: |
| glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| GL_TEXTURE_2D, source_texture, 0); |
| - CopyTexture(rgba8_texture_, source_texture, true); |
| + CopyTexture(rgba8_texture_); |
| // Restore color attachments |
| glBindFramebufferEXT(GL_FRAMEBUFFER, copy_framebuffer_); |
| @@ -565,28 +565,15 @@ void ApplyFramebufferAttachmentCMAAINTELResourceManager::ReleaseTextures() { |
| } |
| void ApplyFramebufferAttachmentCMAAINTELResourceManager::CopyTexture( |
| - GLint source, |
| - GLint dest, |
| - bool via_fbo) { |
| + GLint source) { |
| glViewport(0, 0, width_, height_); |
| glActiveTexture(GL_TEXTURE0); |
| glBindTexture(GL_TEXTURE_2D, source); |
| - if (!via_fbo) { |
| - glUseProgram(copy_to_image_shader_); |
| - if (!is_gles31_compatible_) { |
| - glUniform1i(copy_to_image_shader_outTexture_, 0); |
| - } |
| - glBindImageTextureEXT(0, dest, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA8); |
| - } else { |
| - glDisable(GL_DEPTH_TEST); |
| - glDisable(GL_STENCIL_TEST); |
| - glDisable(GL_CULL_FACE); |
| - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
| - glDepthMask(GL_FALSE); |
| - glDisable(GL_BLEND); |
| - glUseProgram(copy_to_framebuffer_shader_); |
| - } |
| + glDisable(GL_DEPTH_TEST); |
| + glDepthMask(GL_FALSE); |
| + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
| + glUseProgram(copy_to_framebuffer_shader_); |
| glDrawArrays(GL_TRIANGLES, 0, 3); |
| glUseProgram(0); |
| @@ -1889,21 +1876,11 @@ const char |
| precision highp float; |
| layout(binding = 0) uniform highp sampler2D inTexture; |
| layout(location = 0) out vec4 outColor; |
| - \n#ifdef GL_ES\n |
| - layout(binding = 0, rgba8) restrict writeonly uniform highp |
| - image2D outTexture; |
| - \n#else\n |
| - layout(rgba8) restrict writeonly uniform highp image2D outTexture; |
| - \n#endif\n |
| void main() { |
| ivec2 screenPosI = ivec2( gl_FragCoord.xy ); |
| vec4 pixel = texelFetch(inTexture, screenPosI, 0); |
| - \n#ifdef OUT_FBO\n |
| outColor = pixel; |
| - \n#else\n |
| - imageStore(outTexture, screenPosI, pixel); |
|
dshwang
2016/09/02 15:00:21
simple fix is adding following line here.
outCol
|
| - \n#endif\n |
| } |
| ); |
| /* clang-format on */ |