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

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 gpu_unittests 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 3379 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 // ES3 requires seamless cubemap. ES2 does not. 3390 // ES3 requires seamless cubemap. ES2 does not.
3391 // However, when ES2 is implemented on top of DX11, seamless cubemap is 3391 // However, when ES2 is implemented on top of DX11, seamless cubemap is
3392 // always enabled and there is no way to disable it. 3392 // always enabled and there is no way to disable it.
3393 // Therefore, it seems OK to also always enable it on top of Desktop GL for 3393 // Therefore, it seems OK to also always enable it on top of Desktop GL for
3394 // both ES2 and ES3 contexts. 3394 // both ES2 and ES3 contexts.
3395 if (!feature_info_->workarounds().disable_texture_cube_map_seamless && 3395 if (!feature_info_->workarounds().disable_texture_cube_map_seamless &&
3396 gl_version_info().IsAtLeastGL(3, 2)) { 3396 gl_version_info().IsAtLeastGL(3, 2)) {
3397 glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); 3397 glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
3398 } 3398 }
3399 3399
3400 if (feature_info_->feature_flags().desktop_srgb_support) {
3401 glDisable(GL_FRAMEBUFFER_SRGB);
3402 }
3403
3400 has_robustness_extension_ = 3404 has_robustness_extension_ =
3401 context->HasExtension("GL_ARB_robustness") || 3405 context->HasExtension("GL_ARB_robustness") ||
3402 context->HasExtension("GL_KHR_robustness") || 3406 context->HasExtension("GL_KHR_robustness") ||
3403 context->HasExtension("GL_EXT_robustness"); 3407 context->HasExtension("GL_EXT_robustness");
3404 3408
3405 if (!InitializeShaderTranslator()) { 3409 if (!InitializeShaderTranslator()) {
3406 return false; 3410 return false;
3407 } 3411 }
3408 3412
3409 GLint viewport_params[4] = { 0 }; 3413 GLint viewport_params[4] = { 0 };
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
4225 if (valid && feature_info_->feature_flags().desktop_srgb_support) { 4229 if (valid && feature_info_->feature_flags().desktop_srgb_support) {
4226 // If framebuffer contains sRGB images, then enable FRAMEBUFFER_SRGB. 4230 // If framebuffer contains sRGB images, then enable FRAMEBUFFER_SRGB.
4227 // Otherwise, disable FRAMEBUFFER_SRGB. Assume default fbo does not have 4231 // Otherwise, disable FRAMEBUFFER_SRGB. Assume default fbo does not have
4228 // sRGB image. 4232 // sRGB image.
4229 // In theory, we can just leave FRAMEBUFFER_SRGB on. However, many drivers 4233 // In theory, we can just leave FRAMEBUFFER_SRGB on. However, many drivers
4230 // behave incorrectly when all images are linear encoding, they still apply 4234 // 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 4235 // the sRGB conversion, but when at least one image is sRGB, then they
4232 // behave correctly. 4236 // behave correctly.
4233 bool enable_framebuffer_srgb = 4237 bool enable_framebuffer_srgb =
4234 framebuffer && framebuffer->HasSRGBAttachments(); 4238 framebuffer && framebuffer->HasSRGBAttachments();
4235 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); 4239 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb ?
4240 FRAMEBUFFER_SRGB_ENABLED : FRAMEBUFFER_SRGB_DISABLED);
4236 } 4241 }
4237 return valid; 4242 return valid;
4238 } 4243 }
4239 4244
4240 bool GLES2DecoderImpl::CheckBoundReadFramebufferValid( 4245 bool GLES2DecoderImpl::CheckBoundReadFramebufferValid(
4241 const char* func_name, GLenum gl_error) { 4246 const char* func_name, GLenum gl_error) {
4242 GLenum target = features().chromium_framebuffer_multisample ? 4247 GLenum target = features().chromium_framebuffer_multisample ?
4243 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; 4248 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER;
4244 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); 4249 Framebuffer* framebuffer = GetFramebufferInfoForTarget(target);
4245 bool valid = CheckFramebufferValid( 4250 bool valid = CheckFramebufferValid(
(...skipping 11 matching lines...) Expand all
4257 target = features().chromium_framebuffer_multisample ? 4262 target = features().chromium_framebuffer_multisample ?
4258 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER; 4263 GL_READ_FRAMEBUFFER : GL_FRAMEBUFFER;
4259 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target); 4264 Framebuffer* read_framebuffer = GetFramebufferInfoForTarget(target);
4260 valid = valid && CheckFramebufferValid( 4265 valid = valid && CheckFramebufferValid(
4261 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name); 4266 read_framebuffer, target, GL_INVALID_FRAMEBUFFER_OPERATION, func_name);
4262 4267
4263 if (valid && feature_info_->feature_flags().desktop_srgb_support) { 4268 if (valid && feature_info_->feature_flags().desktop_srgb_support) {
4264 bool enable_framebuffer_srgb = 4269 bool enable_framebuffer_srgb =
4265 (draw_framebuffer && draw_framebuffer->HasSRGBAttachments()) || 4270 (draw_framebuffer && draw_framebuffer->HasSRGBAttachments()) ||
4266 (read_framebuffer && read_framebuffer->HasSRGBAttachments()); 4271 (read_framebuffer && read_framebuffer->HasSRGBAttachments());
4267 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); 4272 state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb ?
4273 FRAMEBUFFER_SRGB_ENABLED : FRAMEBUFFER_SRGB_DISABLED);
4268 } 4274 }
4269 4275
4270 return valid; 4276 return valid;
4271 } 4277 }
4272 4278
4273 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat( 4279 GLint GLES2DecoderImpl::GetColorEncodingFromInternalFormat(
4274 GLenum internalformat) { 4280 GLenum internalformat) {
4275 switch (internalformat) { 4281 switch (internalformat) {
4276 case GL_SRGB_EXT: 4282 case GL_SRGB_EXT:
4277 case GL_SRGB_ALPHA_EXT: 4283 case GL_SRGB_ALPHA_EXT:
(...skipping 13465 matching lines...) Expand 10 before | Expand all | Expand 10 after
17743 } 17749 }
17744 17750
17745 // Include the auto-generated part of this file. We split this because it means 17751 // 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 17752 // 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. 17753 // instead of having to edit some template or the code generator.
17748 #include "base/macros.h" 17754 #include "base/macros.h"
17749 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 17755 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
17750 17756
17751 } // namespace gles2 17757 } // namespace gles2
17752 } // namespace gpu 17758 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698