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 c30d501ed0aec6d20eee1c50a3aba65c70d9d5a7..6771f974a1d77c8b4c139393b9cfa7e42bc3c0e7 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -6005,7 +6005,28 @@ 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 || |
+ workarounds().do_decoder_encoder_srgb_generatemipmap) { |
piman
2016/09/22 19:24:59
Did you mean !workarounds().do_decoder_encoder_srg
yizhou.jiang
2016/09/26 00:56:32
Done.
|
+ if (workarounds().do_decoder_encoder_srgb_generatemipmap) { |
piman
2016/09/22 19:24:59
This is probably incorrect too... Maybe the best w
yizhou.jiang
2016/09/26 00:56:32
Done.
|
+ 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(yizhou): If the target is GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY, |
+ // 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 |