Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 315283002: Framebuffer clear() needs to consider the situation some draw buffers are disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 793606f951a86dcf5642eb26107a2f41db725984..7b87e09e55a7e47cec2376e99929dc9a49e16202 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3073,7 +3073,20 @@ bool GLES2DecoderImpl::CheckFramebufferValid(
glClearDepth(1.0f);
state_.SetDeviceDepthMask(GL_TRUE);
state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
+ bool reset_draw_buffer = false;
+ if ((backbuffer_needs_clear_bits_ | GL_COLOR_BUFFER_BIT) != 0 &&
+ group_->draw_buffer() == GL_NONE) {
+ reset_draw_buffer = true;
+ GLenum buf = GL_BACK;
+ if (GetBackbufferServiceId() != 0) // emulated backbuffer
+ buf = GL_COLOR_ATTACHMENT0;
+ glDrawBuffersARB(1, &buf);
+ }
glClear(backbuffer_needs_clear_bits_);
+ if (reset_draw_buffer) {
+ GLenum buf = GL_NONE;
+ glDrawBuffersARB(1, &buf);
+ }
backbuffer_needs_clear_bits_ = 0;
RestoreClearState();
}
@@ -5019,7 +5032,7 @@ void GLES2DecoderImpl::ClearUnclearedAttachments(
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, framebuffer->service_id());
}
GLbitfield clear_bits = 0;
- if (framebuffer->HasUnclearedAttachment(GL_COLOR_ATTACHMENT0)) {
+ if (framebuffer->HasUnclearedColorAttachments()) {
glClearColor(
0.0f, 0.0f, 0.0f,
(GLES2Util::GetChannelsForFormat(
@@ -5027,6 +5040,7 @@ void GLES2DecoderImpl::ClearUnclearedAttachments(
1.0f);
state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
clear_bits |= GL_COLOR_BUFFER_BIT;
+ framebuffer->PrepareDrawBuffersForClear();
}
if (framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT) ||
@@ -5046,6 +5060,9 @@ void GLES2DecoderImpl::ClearUnclearedAttachments(
state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
glClear(clear_bits);
+ if ((clear_bits | GL_COLOR_BUFFER_BIT) != 0)
+ framebuffer->RestoreDrawBuffersAfterClear();
+
framebuffer_manager()->MarkAttachmentsAsCleared(
framebuffer, renderbuffer_manager(), texture_manager());
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698