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

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

Issue 1700433002: Complete disable_gl_rgb_format workaround for Mali-400 GPU (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Logic fixes from PS1 review comments Created 4 years, 10 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 ae331e5a4a080d4cf275e8cb35d2caf30011a28a..55f34c3481fca1468cdd96638d4a5f1901d6fea1 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,12 @@ 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 (offscreen_target_color_format_ == GL_RGB &&
+ workarounds().disable_gl_rgb_format) {
+ offscreen_target_color_format_ = GL_RGBA;
+ state_.emulating_rgb_with_rgba = true;
+ }
}
// ANGLE only supports packed depth/stencil formats, so use it if it is
@@ -2778,9 +2783,12 @@ 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 (offscreen_target_color_format_ == GL_RGB &&
+ workarounds().disable_gl_rgb_format) {
+ offscreen_target_color_format_ = GL_RGBA;
+ state_.emulating_rgb_with_rgba = true;
+ }
// 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 +6153,15 @@ 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);
+ float clear_alpha = 0.0f;
+ if (workarounds().disable_gl_rgb_format &&
+ (GLES2Util::GetChannelsForFormat(
+ framebuffer->GetColorAttachment0Format()) &
+ 0x0008) == 0) {
+ clear_alpha = 1.0f;
+ }
+ glClearColor(0.0f, 0.0f, 0.0f, clear_alpha);
+
state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
clear_bits |= GL_COLOR_BUFFER_BIT;
if (feature_info_->feature_flags().ext_draw_buffers ||
« 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