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

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

Issue 2318313004: emulate srgb format for generateMipmap (Closed)
Patch Set: srgb-generateMipmap 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
« no previous file with comments | « AUTHORS ('k') | gpu/command_buffer/service/gles2_cmd_srgb_converter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..92dba54d30d331f33b73db979afb3c210fd10b6f 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -6005,7 +6005,22 @@ 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)) {
+ if (enable_srgb && gl_version_info().IsAtLeastGL(4, 4)) {
+ state_.EnableDisableFramebufferSRGB(enable_srgb);
qiankun 2016/09/20 06:11:09 Disable Framebuffer_SRGB if enable_srgb is false.
yizhou.jiang 2016/09/20 07:00:27 Done.
+ }
+ glGenerateMipmapEXT(target);
+ } else {
yunchao 2016/09/20 06:01:57 Please add a TODO. If the target is GL_TEXTURE_3D
yizhou.jiang 2016/09/20 07:00:27 Done.
+ state_.EnableDisableFramebufferSRGB(true);
+ if (!InitializeSRGBConverter("generateMipmap")) {
+ return;
+ }
+ srgb_converter_->SRGBGenerateMipmap(this, tex, target);
+ }
if (texture_zero_level_set) {
// This may have some unwanted side effects, but we expect command buffer
« no previous file with comments | « AUTHORS ('k') | gpu/command_buffer/service/gles2_cmd_srgb_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698