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

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

Issue 2550203003: 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 4f93174e1a1c68ed35e465a914d6c639e59d9f89..289898a358cfa5a322251c1ae3c7bee18093f495 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4308,17 +4308,26 @@ bool GLES2DecoderImpl::CheckBoundDrawFramebufferValid(const char* func_name) {
}
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.
- bool enable_framebuffer_srgb =
- framebuffer && framebuffer->HasSRGBAttachments();
- state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb);
+ enable_framebuffer_srgb &= framebuffer && framebuffer->HasSRGBAttachments();
}
+ if (needs_enable_disable_framebuffer_srgb)
+ state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb);
}
bool GLES2DecoderImpl::CheckBoundReadFramebufferValid(
@@ -7433,6 +7442,11 @@ void GLES2DecoderImpl::DoDisable(GLenum cap) {
// 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);
}
}
@@ -7445,6 +7459,11 @@ void GLES2DecoderImpl::DoEnable(GLenum cap) {
// 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