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

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

Issue 2128753002: Add workaround for multisampling color masks for the command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp17_gmb_workaround
Patch Set: Created 4 years, 5 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 | « no previous file | 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 31f490d477213827a65bc62183fc2ed7fcffa736..af22b90661d72f6eebb69c718aab365cdcfdec1a 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2370,13 +2370,28 @@ ScopedResolvedFrameBufferBinder::ScopedResolvedFrameBufferBinder(
enforce_internal_framebuffer));
if (!resolve_and_bind_)
return;
-
- // TODO(erikchen): On old AMD GPUs on macOS, glColorMask doesn't work
- // correctly for multisampled renderbuffers and the alpha channel can be
- // overwritten. Add a workaround to clear the alpha channel before resolving.
- // https://crbug.com/602484.
ScopedGLErrorSuppressor suppressor(
"ScopedResolvedFrameBufferBinder::ctor", decoder_->GetErrorState());
+
+ // On old AMD GPUs on macOS, glColorMask doesn't work correctly for
+ // multisampled renderbuffers and the alpha channel can be overwritten. This
+ // workaround clears the alpha channel before resolving.
+ bool alpha_channel_needs_clear =
+ decoder_->should_use_native_gmb_for_backbuffer_ &&
+ !decoder_->offscreen_buffer_should_have_alpha_ &&
+ decoder_->ChromiumImageNeedsRGBEmulation() &&
+ decoder_->feature_info_->workarounds()
+ .disable_multisampling_color_mask_usage;
+ if (alpha_channel_needs_clear) {
+ glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,
+ decoder_->offscreen_target_frame_buffer_->id());
+ decoder_->state_.SetDeviceColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
+ decoder->state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false);
+ glClearColor(0, 0, 0, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ decoder_->RestoreClearState();
+ }
+
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT,
decoder_->offscreen_target_frame_buffer_->id());
GLuint targetid;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698