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

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

Issue 2537343008: Revert of Add command buffer support for EXT_sRGB_write_control (Closed)
Patch Set: Created 4 years 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
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 e8df82b84e455f46f6448c1187a15a9cf3c04e50..3c0f126881452c0bd00de777adffe0901a3d2aa6 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -707,7 +707,6 @@
// Workarounds
void OnFboChanged() const;
void OnUseFramebuffer() const;
- void UpdateFramebufferSRGB(Framebuffer* framebuffer);
error::ContextLostReason GetContextLostReasonFromResetStatus(
GLenum reset_status) const;
@@ -3459,7 +3458,6 @@
DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
DoBindFramebuffer(GL_FRAMEBUFFER, 0);
DoBindRenderbuffer(GL_RENDERBUFFER, 0);
- UpdateFramebufferSRGB(nullptr);
bool call_gl_clear = !surfaceless_ && !offscreen;
#if defined(OS_ANDROID)
@@ -4295,37 +4293,21 @@
Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
bool valid = CheckFramebufferValid(
framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name);
- if (!valid)
- return false;
-
- if (!features().chromium_framebuffer_multisample)
+ if (valid && !features().chromium_framebuffer_multisample)
OnUseFramebuffer();
-
- UpdateFramebufferSRGB(framebuffer);
- return true;
-}
-
-void GLES2DecoderImpl::UpdateFramebufferSRGB(Framebuffer* framebuffer) {
- // Manually set the value of FRAMEBUFFER_SRGB based on the state that was set
- // by the client.
- bool needs_enable_disable_framebuffer_srgb = false;
- bool enable_framebuffer_srgb = true;
- if (feature_info_->feature_flags().ext_srgb_write_control) {
- needs_enable_disable_framebuffer_srgb = true;
- enable_framebuffer_srgb &= state_.GetEnabled(GL_FRAMEBUFFER_SRGB);
- }
- // On desktop, enable FRAMEBUFFER_SRGB only if the framebuffer contains sRGB
- // attachments. In theory, we can just leave FRAMEBUFFER_SRGB enabled,
- // however,
- // many drivers behave incorrectly when no attachments are sRGB. When at
- // least one attachment is sRGB, then they behave correctly.
- if (feature_info_->feature_flags().desktop_srgb_support) {
- needs_enable_disable_framebuffer_srgb = true;
- // Assume that the default fbo does not have an sRGB image.
- enable_framebuffer_srgb &= framebuffer && framebuffer->HasSRGBAttachments();
- }
- if (needs_enable_disable_framebuffer_srgb)
+ if (valid && feature_info_->feature_flags().desktop_srgb_support) {
+ // If framebuffer contains sRGB images, then enable FRAMEBUFFER_SRGB.
+ // Otherwise, disable FRAMEBUFFER_SRGB. Assume default fbo does not have
+ // sRGB image.
+ // In theory, we can just leave FRAMEBUFFER_SRGB on. However, many drivers
+ // behave incorrectly when all images are linear encoding, they still apply
+ // the sRGB conversion, but when at least one image is sRGB, then they
+ // behave correctly.
+ bool enable_framebuffer_srgb =
+ framebuffer && framebuffer->HasSRGBAttachments();
state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb);
+ }
+ return valid;
}
bool GLES2DecoderImpl::CheckBoundReadFramebufferValid(
@@ -7435,11 +7417,6 @@
// DrawElements* for old desktop GL.
return;
}
- if (cap == GL_FRAMEBUFFER_SRGB) {
- // Enable and Disable GL_FRAMEBUFFER_SRGB is done manually in
- // CheckBoundDrawFramebufferValid.
- return;
- }
glDisable(cap);
}
}
@@ -7450,11 +7427,6 @@
feature_info_->feature_flags().emulate_primitive_restart_fixed_index) {
// Enable and Disable PRIMITIVE_RESTART only before and after
// DrawElements* for old desktop GL.
- return;
- }
- if (cap == GL_FRAMEBUFFER_SRGB) {
- // Enable and Disable GL_FRAMEBUFFER_SRGB is done manually in
- // CheckBoundDrawFramebufferValid.
return;
}
glEnable(cap);
« no previous file with comments | « gpu/command_buffer/service/feature_info_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698