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 15710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15721 } | 15721 } |
15722 } | 15722 } |
15723 | 15723 |
15724 GLenum compatibility_internal_format = internal_format; | 15724 GLenum compatibility_internal_format = internal_format; |
15725 const CompressedFormatInfo* format_info = | 15725 const CompressedFormatInfo* format_info = |
15726 GetCompressedFormatInfo(internal_format); | 15726 GetCompressedFormatInfo(internal_format); |
15727 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { | 15727 if (format_info != nullptr && !format_info->support_check(*feature_info_)) { |
15728 compatibility_internal_format = format_info->decompressed_internal_format; | 15728 compatibility_internal_format = format_info->decompressed_internal_format; |
15729 } | 15729 } |
15730 | 15730 |
| 15731 if (feature_info_->workarounds().reset_base_mipmap_level_before_texstorage && |
| 15732 texture->base_level() > 0) |
| 15733 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, 0); |
| 15734 |
15731 // TODO(zmo): We might need to emulate TexStorage using TexImage or | 15735 // TODO(zmo): We might need to emulate TexStorage using TexImage or |
15732 // CompressedTexImage on Mac OSX where we expose ES3 APIs when the underlying | 15736 // CompressedTexImage on Mac OSX where we expose ES3 APIs when the underlying |
15733 // driver is lower than 4.2 and ARB_texture_storage extension doesn't exist. | 15737 // driver is lower than 4.2 and ARB_texture_storage extension doesn't exist. |
15734 if (dimension == ContextState::k2D) { | 15738 if (dimension == ContextState::k2D) { |
15735 glTexStorage2DEXT(target, levels, compatibility_internal_format, width, | 15739 glTexStorage2DEXT(target, levels, compatibility_internal_format, width, |
15736 height); | 15740 height); |
15737 } else { | 15741 } else { |
15738 glTexStorage3D(target, levels, compatibility_internal_format, width, height, | 15742 glTexStorage3D(target, levels, compatibility_internal_format, width, height, |
15739 depth); | 15743 depth); |
15740 } | 15744 } |
| 15745 if (feature_info_->workarounds().reset_base_mipmap_level_before_texstorage && |
| 15746 texture->base_level() > 0) |
| 15747 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); |
15741 | 15748 |
15742 { | 15749 { |
15743 GLsizei level_width = width; | 15750 GLsizei level_width = width; |
15744 GLsizei level_height = height; | 15751 GLsizei level_height = height; |
15745 GLsizei level_depth = depth; | 15752 GLsizei level_depth = depth; |
15746 GLenum adjusted_format = | 15753 GLenum adjusted_format = |
15747 feature_info_->IsES3Enabled() ? internal_format : format; | 15754 feature_info_->IsES3Enabled() ? internal_format : format; |
15748 for (int ii = 0; ii < levels; ++ii) { | 15755 for (int ii = 0; ii < levels; ++ii) { |
15749 if (target == GL_TEXTURE_CUBE_MAP) { | 15756 if (target == GL_TEXTURE_CUBE_MAP) { |
15750 for (int jj = 0; jj < 6; ++jj) { | 15757 for (int jj = 0; jj < 6; ++jj) { |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17727 } | 17734 } |
17728 | 17735 |
17729 // Include the auto-generated part of this file. We split this because it means | 17736 // Include the auto-generated part of this file. We split this because it means |
17730 // we can easily edit the non-auto generated parts right here in this file | 17737 // we can easily edit the non-auto generated parts right here in this file |
17731 // instead of having to edit some template or the code generator. | 17738 // instead of having to edit some template or the code generator. |
17732 #include "base/macros.h" | 17739 #include "base/macros.h" |
17733 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 17740 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
17734 | 17741 |
17735 } // namespace gles2 | 17742 } // namespace gles2 |
17736 } // namespace gpu | 17743 } // namespace gpu |
OLD | NEW |