| 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 7ecd8d5f47bf07b2f1410eb945e5d1295423c7b6..964aa05990b4b356537e0930c4e3ec6350bdcb52 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -683,6 +683,7 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
|
| // backbuffer if no framebuffer is bound.
|
| // Check with all attached and enabled color attachments.
|
| bool BoundFramebufferHasColorAttachmentWithAlpha();
|
| + bool BoundFramebufferEmulatingRGB();
|
| bool BoundFramebufferHasDepthAttachment();
|
| bool BoundFramebufferHasStencilAttachment();
|
|
|
| @@ -4710,6 +4711,14 @@ bool GLES2DecoderImpl::BoundFramebufferHasColorAttachmentWithAlpha() {
|
| return BackBufferHasAlpha();
|
| }
|
|
|
| +bool GLES2DecoderImpl::BoundFramebufferEmulatingRGB() {
|
| + Framebuffer* framebuffer =
|
| + GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
|
| + if (framebuffer)
|
| + return framebuffer->EmulatingRGB();
|
| + return false;
|
| +}
|
| +
|
| bool GLES2DecoderImpl::BoundFramebufferHasDepthAttachment() {
|
| Framebuffer* framebuffer =
|
| GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
|
| @@ -4736,6 +4745,20 @@ bool GLES2DecoderImpl::BoundFramebufferHasStencilAttachment() {
|
| }
|
|
|
| void GLES2DecoderImpl::ApplyDirtyState() {
|
| + if (BoundFramebufferEmulatingRGB()) {
|
| + Framebuffer* framebuffer =
|
| + GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT);
|
| + if (framebuffer->HasUninitializedDrawBuffers()) {
|
| + glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
|
| + state_.SetDeviceColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
| + glClear(GL_COLOR_BUFFER_BIT);
|
| + glClearColor(state_.color_clear_red, state_.color_clear_green,
|
| + state_.color_clear_blue, state_.color_clear_alpha);
|
| + framebuffer->SetDrawBuffersAsInitialized();
|
| + framebuffer_state_.clear_state_dirty = true;
|
| + }
|
| + }
|
| +
|
| if (framebuffer_state_.clear_state_dirty) {
|
| bool have_alpha = BoundFramebufferHasColorAttachmentWithAlpha();
|
| state_.SetDeviceColorMask(state_.color_mask_red,
|
|
|