Chromium Code Reviews| 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 ae331e5a4a080d4cf275e8cb35d2caf30011a28a..cd2fb56c2e387210bcbaca64abeb5c275bcfe64b 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -1851,6 +1851,8 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient { |
| } |
| bool BackBufferHasAlpha() const { |
| + if (state_.emulating_rgb_with_rgba) |
| + return false; |
| if (back_buffer_draw_buffer_ == GL_NONE) |
| return false; |
| if (offscreen_target_frame_buffer_.get()) { |
| @@ -2753,9 +2755,11 @@ bool GLES2DecoderImpl::Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
| } else { |
| offscreen_target_samples_ = 1; |
| offscreen_target_color_format_ = |
| - attrib_parser.alpha_size > 0 || workarounds().disable_gl_rgb_format |
| - ? GL_RGBA |
| - : GL_RGB; |
| + (attrib_parser.alpha_size > 0) ? GL_RGBA : GL_RGB; |
| + if (workarounds().disable_gl_rgb_format) { |
|
bajones
2016/02/12 21:07:41
This branch and the one below are wrong, because t
halliwell
2016/02/12 22:52:56
Doh. Thank you.
|
| + offscreen_target_color_format_ = GL_RGBA; |
| + state_.emulating_rgb_with_rgba = true; |
|
Zhenyao Mo
2016/02/12 21:06:06
You should only set this if attrib_parser.alpha_si
halliwell
2016/02/12 22:52:56
And thank you :)
|
| + } |
| } |
| // ANGLE only supports packed depth/stencil formats, so use it if it is |
| @@ -2778,9 +2782,11 @@ bool GLES2DecoderImpl::Initialize(const scoped_refptr<gfx::GLSurface>& surface, |
| } |
| } else { |
| offscreen_target_color_format_ = |
| - attrib_parser.alpha_size > 0 || workarounds().disable_gl_rgb_format |
| - ? GL_RGBA |
| - : GL_RGB; |
| + (attrib_parser.alpha_size > 0) ? GL_RGBA : GL_RGB; |
| + if (workarounds().disable_gl_rgb_format) { |
|
bajones
2016/02/12 21:07:41
Ditto
halliwell
2016/02/12 22:52:56
Done.
|
| + offscreen_target_color_format_ = GL_RGBA; |
| + state_.emulating_rgb_with_rgba = true; |
|
Zhenyao Mo
2016/02/12 21:06:06
Same here.
halliwell
2016/02/12 22:52:56
Done.
|
| + } |
| // If depth is requested at all, use the packed depth stencil format if |
| // it's available, as some desktop GL drivers don't support any non-packed |
| @@ -6145,7 +6151,12 @@ void GLES2DecoderImpl::ClearUnclearedAttachments( |
| // We should always use alpha == 0 here, because 1) some draw buffers may |
| // have alpha and some may not; 2) we won't have the same situation as the |
| // back buffer where alpha channel exists but is not requested. |
| - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| + glClearColor(0.0f, 0.0f, 0.0f, |
|
Zhenyao Mo
2016/02/12 21:06:06
This is problematic, because we could have some at
halliwell
2016/02/12 22:52:56
Agreed. I updated this to check for the workaroun
|
| + (GLES2Util::GetChannelsForFormat( |
| + framebuffer->GetColorAttachmentFormat()) & |
| + 0x0008) != 0 |
| + ? 0.0f |
| + : 1.0f); |
| state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); |
| clear_bits |= GL_COLOR_BUFFER_BIT; |
| if (feature_info_->feature_flags().ext_draw_buffers || |