Chromium Code Reviews| 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 15680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15691 } | 15691 } |
| 15692 } | 15692 } |
| 15693 | 15693 |
| 15694 GLenum compatibility_internal_format = internal_format; | 15694 GLenum compatibility_internal_format = internal_format; |
| 15695 const CompressedFormatInfo* format_info = | 15695 const CompressedFormatInfo* format_info = |
| 15696 GetCompressedFormatInfo(internal_format); | 15696 GetCompressedFormatInfo(internal_format); |
| 15697 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { | 15697 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { |
| 15698 compatibility_internal_format = format_info->decompressed_internal_format; | 15698 compatibility_internal_format = format_info->decompressed_internal_format; |
| 15699 } | 15699 } |
| 15700 | 15700 |
| 15701 GLint base_level = 0; | |
|
Zhenyao Mo
2016/08/25 18:06:55
You should just use texture->base_level(), and no
| |
| 15702 if (feature_info_->workarounds().reset_base_mipmap_level_before_texstorage) { | |
| 15703 glGetTexParameteriv(target, GL_TEXTURE_BASE_LEVEL, &base_level); | |
| 15704 if (base_level > 0) | |
| 15705 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, 0); | |
| 15706 } | |
| 15701 // TODO(zmo): We might need to emulate TexStorage using TexImage or | 15707 // TODO(zmo): We might need to emulate TexStorage using TexImage or |
| 15702 // CompressedTexImage on Mac OSX where we expose ES3 APIs when the underlying | 15708 // CompressedTexImage on Mac OSX where we expose ES3 APIs when the underlying |
| 15703 // driver is lower than 4.2 and ARB_texture_storage extension doesn't exist. | 15709 // driver is lower than 4.2 and ARB_texture_storage extension doesn't exist. |
| 15704 if (dimension == ContextState::k2D) { | 15710 if (dimension == ContextState::k2D) { |
| 15705 glTexStorage2DEXT(target, levels, compatibility_internal_format, width, | 15711 glTexStorage2DEXT(target, levels, compatibility_internal_format, width, |
| 15706 height); | 15712 height); |
| 15707 } else { | 15713 } else { |
| 15708 glTexStorage3D(target, levels, compatibility_internal_format, width, height, | 15714 glTexStorage3D(target, levels, compatibility_internal_format, width, height, |
| 15709 depth); | 15715 depth); |
| 15710 } | 15716 } |
| 15717 if (feature_info_->workarounds().reset_base_mipmap_level_before_texstorage && | |
| 15718 base_level > 0) | |
| 15719 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, base_level); | |
| 15711 | 15720 |
| 15712 { | 15721 { |
| 15713 GLsizei level_width = width; | 15722 GLsizei level_width = width; |
| 15714 GLsizei level_height = height; | 15723 GLsizei level_height = height; |
| 15715 GLsizei level_depth = depth; | 15724 GLsizei level_depth = depth; |
| 15716 GLenum adjusted_format = | 15725 GLenum adjusted_format = |
| 15717 feature_info_->IsES3Enabled() ? internal_format : format; | 15726 feature_info_->IsES3Enabled() ? internal_format : format; |
| 15718 for (int ii = 0; ii < levels; ++ii) { | 15727 for (int ii = 0; ii < levels; ++ii) { |
| 15719 if (target == GL_TEXTURE_CUBE_MAP) { | 15728 if (target == GL_TEXTURE_CUBE_MAP) { |
| 15720 for (int jj = 0; jj < 6; ++jj) { | 15729 for (int jj = 0; jj < 6; ++jj) { |
| (...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 17694 } | 17703 } |
| 17695 | 17704 |
| 17696 // Include the auto-generated part of this file. We split this because it means | 17705 // Include the auto-generated part of this file. We split this because it means |
| 17697 // we can easily edit the non-auto generated parts right here in this file | 17706 // we can easily edit the non-auto generated parts right here in this file |
| 17698 // instead of having to edit some template or the code generator. | 17707 // instead of having to edit some template or the code generator. |
| 17699 #include "base/macros.h" | 17708 #include "base/macros.h" |
| 17700 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17709 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 17701 | 17710 |
| 17702 } // namespace gles2 | 17711 } // namespace gles2 |
| 17703 } // namespace gpu | 17712 } // namespace gpu |
| OLD | NEW |