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

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

Issue 2318313004: emulate srgb format for generateMipmap (Closed)
Patch Set: addressed yunchao's feedback:update webgl2_conformance_expectation.py Created 4 years, 3 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 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 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

Powered by Google App Engine
This is Rietveld 408576698