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

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

Issue 2611403002: Fix a bug in drawBuffers optimization. (Closed)
Patch Set: update Created 3 years, 11 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.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 3c2f69440091f8020df96bec44979fa8f6892b18..5739660354ae36f4a2fb7454d04734c2476d03e5 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -1337,6 +1337,10 @@ class GLES2DecoderImpl : public GLES2Decoder, public ErrorStateClient {
// NONE through DrawBuffers, to be on the safe side. Return true.
bool ValidateAndAdjustDrawBuffers(const char* function_name);
+ // Filter out the draw buffers that have no images attached but are not NONE
+ // through DrawBuffers, to be on the safe side.
+ void AdjustDrawBuffers();
+
// Checks if all active uniform blocks in the current program are backed by
// a buffer of sufficient size.
// If not, generates an INVALID_OPERATION to avoid undefined behavior in
@@ -7287,6 +7291,7 @@ error::Error GLES2DecoderImpl::DoClear(GLbitfield mask) {
return error::kNoError;
}
}
+ AdjustDrawBuffers();
glClear(mask);
}
return error::kNoError;
@@ -8846,6 +8851,16 @@ bool GLES2DecoderImpl::ValidateAndAdjustDrawBuffers(const char* func_name) {
return true;
}
+void GLES2DecoderImpl::AdjustDrawBuffers() {
+ if (!SupportsDrawBuffers()) {
+ return;
+ }
+ Framebuffer* framebuffer = framebuffer_state_.bound_draw_framebuffer.get();
+ if (framebuffer) {
+ framebuffer->AdjustDrawBuffers();
+ }
+}
+
bool GLES2DecoderImpl::ValidateUniformBlockBackings(const char* func_name) {
DCHECK(feature_info_->IsWebGL2OrES3Context());
if (!state_.current_program.get())
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698