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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2246823002: Disable FRAMEBUFFER_SRGB when restoring from a null context state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gl_tests on windows Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 4214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 if (valid && feature_info_->feature_flags().desktop_srgb_support) { 4225 if (valid && feature_info_->feature_flags().desktop_srgb_support) {
4226 // If framebuffer contains sRGB images, then enable FRAMEBUFFER_SRGB. 4226 // If framebuffer contains sRGB images, then enable FRAMEBUFFER_SRGB.
4227 // Otherwise, disable FRAMEBUFFER_SRGB. Assume default fbo does not have 4227 // Otherwise, disable FRAMEBUFFER_SRGB. Assume default fbo does not have
4228 // sRGB image. 4228 // sRGB image.
4229 // In theory, we can just leave FRAMEBUFFER_SRGB on. However, many drivers 4229 // In theory, we can just leave FRAMEBUFFER_SRGB on. However, many drivers
4230 // behave incorrectly when all images are linear encoding, they still apply 4230 // behave incorrectly when all images are linear encoding, they still apply
4231 // the sRGB conversion, but when at least one image is sRGB, then they 4231 // the sRGB conversion, but when at least one image is sRGB, then they
4232 // behave correctly. 4232 // behave correctly.
4233 bool enable_framebuffer_srgb = 4233 bool enable_framebuffer_srgb =
4234 framebuffer && framebuffer->HasSRGBAttachments(); 4234 framebuffer && framebuffer->HasSRGBAttachments();
4235 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); 4235 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb ?
4236 FRAMEBUFFER_SRGB_ENABLED : FRAMEBUFFER_SRGB_DISABLED);
4236 } 4237 }
4237 return valid; 4238 return valid;
4238 } 4239 }
4239 4240
4240 bool GLES2DecoderImpl::CheckBoundReadFramebufferValid( 4241 bool GLES2DecoderImpl::CheckBoundReadFramebufferValid(
4241 const char* func_name, GLenum gl_error) { 4242 const char* func_name, GLenum gl_error) {
4242 GLenum target = features().chromium_framebuffer_multisample ? 4243 GLenum target = features().chromium_framebuffer_multisample ?
4243 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; 4244 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER;
4244 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 4245 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
4245 bool valid = CheckFramebufferValid( 4246 bool valid = CheckFramebufferValid(
(...skipping 11 matching lines...) Expand all
4257 target = features().chromium_framebuffer_multisample ? 4258 target = features().chromium_framebuffer_multisample ?
4258 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; 4259 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER;
4259 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target); 4260 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target);
4260 valid = valid && CheckFramebufferValid( 4261 valid = valid && CheckFramebufferValid(
4261 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); 4262 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name);
4262 4263
4263 if (valid && feature_info_->feature_flags().desktop_srgb_support) { 4264 if (valid && feature_info_->feature_flags().desktop_srgb_support) {
4264 bool enable_framebuffer_srgb = 4265 bool enable_framebuffer_srgb =
4265 (draw_framebuffer && draw_framebuffer->HasSRGBAttachments()) || 4266 (draw_framebuffer && draw_framebuffer->HasSRGBAttachments()) ||
4266 (read_framebuffer && read_framebuffer->HasSRGBAttachments()); 4267 (read_framebuffer && read_framebuffer->HasSRGBAttachments());
4267 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); 4268 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb ?
4269 FRAMEBUFFER_SRGB_ENABLED : FRAMEBUFFER_SRGB_DISABLED);
4268 } 4270 }
4269 4271
4270 return valid; 4272 return valid;
4271 } 4273 }
4272 4274
4273 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat( 4275 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat(
4274 GLenum internalformat) { 4276 GLenum internalformat) {
4275 switch (internalformat) { 4277 switch (internalformat) {
4276 case GL_SRGB_EXT: 4278 case GL_SRGB_EXT:
4277 case GL_SRGB_ALPHA_EXT: 4279 case GL_SRGB_ALPHA_EXT:
(...skipping 13465 matching lines...) Expand 10 before | Expand all | Expand 10 after
17743 } 17745 }
17744 17746
17745 // Include the auto-generated part of this file. We split this because it means 17747 // Include the auto-generated part of this file. We split this because it means
17746 // we can easily edit the non-auto generated parts right here in this file 17748 // we can easily edit the non-auto generated parts right here in this file
17747 // instead of having to edit some template or the code generator. 17749 // instead of having to edit some template or the code generator.
17748 #include "base/macros.h" 17750 #include "base/macros.h"
17749 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17751 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17750 17752
17751 } // namespace gles2 17753 } // namespace gles2
17752 } // namespace gpu 17754 } // namespace gpu
OLDNEW
« gpu/command_buffer/service/context_state.h ('K') | « gpu/command_buffer/service/context_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698