Chromium Code Reviews| 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 8ae668f5d7615483b9a024a4df8a7122f2d5b8d8..8aef983b322ee579fa93849b9ff4e0de132e6756 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -6005,7 +6005,27 @@ void GLES2DecoderImpl::DoGenerateMipmap(GLenum target) { |
| } |
| } |
| - glGenerateMipmapEXT(target); |
| + tex->GetLevelType(target, 0, &type, &internal_format); |
| + bool enable_srgb = |
| + GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; |
| + if (!enable_srgb || !feature_info_->feature_flags().desktop_srgb_support || |
| + gl_version_info().IsAtLeastGL(4, 4)) { |
|
piman
2016/09/20 21:53:30
Is there any particular reason to cut-off at GL 4.
yizhou.jiang
2016/09/21 08:59:22
According to BlitFramebuffer and drawArrays api, w
piman
2016/09/21 23:45:32
It seems somewhat orthogonal - the behavior of glG
|
| + if (gl_version_info().IsAtLeastGL(4, 4)) { |
| + state_.EnableDisableFramebufferSRGB(enable_srgb); |
| + } |
| + glGenerateMipmapEXT(target); |
| + } else { |
| + if (target == GL_TEXTURE_2D) { |
| + state_.EnableDisableFramebufferSRGB(true); |
| + if (!InitializeSRGBConverter("generateMipmap")) { |
| + return; |
| + } |
| + srgb_converter_->SRGBGenerateMipmap(this, tex, target); |
| + } else { // TODO If the target is GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY, |
|
Ken Russell (switch to Gerrit)
2016/09/21 01:00:14
Should be TODO(yizhao.jiang) or TODO(yizhao). Also
yizhou.jiang
2016/09/21 08:59:22
Done.
|
| + // this change can not generate correct mipmap. |
| + glGenerateMipmapEXT(target); |
| + } |
| + } |
| if (texture_zero_level_set) { |
| // This may have some unwanted side effects, but we expect command buffer |