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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2548363002: Extend more runtime envs for generateMipmap srgb emulation (Closed)
Patch Set: modify syntax Created 4 years 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 6131 matching lines...) Expand 10 before | Expand all | Expand 10 after
6142 texture_zero_level_set = true; 6142 texture_zero_level_set = true;
6143 } 6143 }
6144 } 6144 }
6145 6145
6146 bool enable_srgb = 0; 6146 bool enable_srgb = 0;
6147 if (target == GL_TEXTURE_2D) { 6147 if (target == GL_TEXTURE_2D) {
6148 tex->GetLevelType(target, tex->base_level(), &type, &internal_format); 6148 tex->GetLevelType(target, tex->base_level(), &type, &internal_format);
6149 enable_srgb = 6149 enable_srgb =
6150 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB; 6150 GetColorEncodingFromInternalFormat(internal_format) == GL_SRGB;
6151 } 6151 }
6152 if (!enable_srgb || !feature_info_->feature_flags().desktop_srgb_support || 6152 if (enable_srgb && feature_info_->feature_flags().desktop_srgb_support) {
6153 !workarounds().decode_encode_srgb_for_generatemipmap) { 6153 state_.EnableDisableFramebufferSRGB(enable_srgb);
6154 if (feature_info_->feature_flags().desktop_srgb_support) { 6154 }
6155 state_.EnableDisableFramebufferSRGB(enable_srgb); 6155 if (enable_srgb && workarounds().decode_encode_srgb_for_generatemipmap) {
6156 }
6157 glGenerateMipmapEXT(target);
6158 } else {
6159 if (target == GL_TEXTURE_2D) { 6156 if (target == GL_TEXTURE_2D) {
6160 state_.EnableDisableFramebufferSRGB(true);
6161 if (!InitializeSRGBConverter("generateMipmap")) { 6157 if (!InitializeSRGBConverter("generateMipmap")) {
6162 return; 6158 return;
6163 } 6159 }
6164 srgb_converter_->GenerateMipmap(this, tex, target); 6160 srgb_converter_->GenerateMipmap(this, tex, target);
6165 } else { 6161 } else {
6166 // TODO(yizhou): If the target is GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY, 6162 // TODO(yizhou): If the target is GL_TEXTURE_3D or GL_TEXTURE_2D_ARRAY,
Zhenyao Mo 2016/12/07 22:50:38 Just noticed: what about CUBEMAP?
6167 // this change can not generate correct mipmap. 6163 // this change can not generate correct mipmap.
6168 glGenerateMipmapEXT(target); 6164 glGenerateMipmapEXT(target);
6169 } 6165 }
6166 } else {
6167 glGenerateMipmapEXT(target);
6170 } 6168 }
6171 6169
6172 if (texture_zero_level_set) { 6170 if (texture_zero_level_set) {
6173 // This may have some unwanted side effects, but we expect command buffer 6171 // This may have some unwanted side effects, but we expect command buffer
6174 // validation to prevent you from doing anything weird with the texture 6172 // validation to prevent you from doing anything weird with the texture
6175 // after this, like calling texSubImage2D sucessfully. 6173 // after this, like calling texSubImage2D sucessfully.
6176 glTexImage2D(target, 0, internal_format, 0, 0, 0, format, type, nullptr); 6174 glTexImage2D(target, 0, internal_format, 0, 0, 0, format, type, nullptr);
6177 } 6175 }
6178 6176
6179 if (workarounds().set_texture_filter_before_generating_mipmap) { 6177 if (workarounds().set_texture_filter_before_generating_mipmap) {
(...skipping 12751 matching lines...) Expand 10 before | Expand all | Expand 10 after
18931 } 18929 }
18932 18930
18933 // Include the auto-generated part of this file. We split this because it means 18931 // Include the auto-generated part of this file. We split this because it means
18934 // we can easily edit the non-auto generated parts right here in this file 18932 // we can easily edit the non-auto generated parts right here in this file
18935 // instead of having to edit some template or the code generator. 18933 // instead of having to edit some template or the code generator.
18936 #include "base/macros.h" 18934 #include "base/macros.h"
18937 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18935 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18938 18936
18939 } // namespace gles2 18937 } // namespace gles2
18940 } // namespace gpu 18938 } // namespace gpu
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/webgl2_conformance_expectations.py ('k') | gpu/command_buffer/service/gles2_cmd_srgb_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698