| OLD | NEW |
| 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 Loading... |
| 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 ,GL_TEXTURE_2D_ARRAY, |
| 6163 // GL_TEXTURE_CUBE_MAP, |
| 6167 // this change can not generate correct mipmap. | 6164 // this change can not generate correct mipmap. |
| 6168 glGenerateMipmapEXT(target); | 6165 glGenerateMipmapEXT(target); |
| 6169 } | 6166 } |
| 6167 } else { |
| 6168 glGenerateMipmapEXT(target); |
| 6170 } | 6169 } |
| 6171 | 6170 |
| 6172 if (texture_zero_level_set) { | 6171 if (texture_zero_level_set) { |
| 6173 // This may have some unwanted side effects, but we expect command buffer | 6172 // This may have some unwanted side effects, but we expect command buffer |
| 6174 // validation to prevent you from doing anything weird with the texture | 6173 // validation to prevent you from doing anything weird with the texture |
| 6175 // after this, like calling texSubImage2D sucessfully. | 6174 // after this, like calling texSubImage2D sucessfully. |
| 6176 glTexImage2D(target, 0, internal_format, 0, 0, 0, format, type, nullptr); | 6175 glTexImage2D(target, 0, internal_format, 0, 0, 0, format, type, nullptr); |
| 6177 } | 6176 } |
| 6178 | 6177 |
| 6179 if (workarounds().set_texture_filter_before_generating_mipmap) { | 6178 if (workarounds().set_texture_filter_before_generating_mipmap) { |
| (...skipping 12751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18931 } | 18930 } |
| 18932 | 18931 |
| 18933 // Include the auto-generated part of this file. We split this because it means | 18932 // 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 | 18933 // 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. | 18934 // instead of having to edit some template or the code generator. |
| 18936 #include "base/macros.h" | 18935 #include "base/macros.h" |
| 18937 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18936 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18938 | 18937 |
| 18939 } // namespace gles2 | 18938 } // namespace gles2 |
| 18940 } // namespace gpu | 18939 } // namespace gpu |
| OLD | NEW |