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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 return false; | 778 return false; |
779 } | 779 } |
780 | 780 |
781 // Can't generate mips for depth or stencil textures. | 781 // Can't generate mips for depth or stencil textures. |
782 const Texture::LevelInfo& base = face_infos_[0].level_infos[base_level_]; | 782 const Texture::LevelInfo& base = face_infos_[0].level_infos[base_level_]; |
783 uint32_t channels = GLES2Util::GetChannelsForFormat(base.format); | 783 uint32_t channels = GLES2Util::GetChannelsForFormat(base.format); |
784 if (channels & (GLES2Util::kDepth | GLES2Util::kStencil)) { | 784 if (channels & (GLES2Util::kDepth | GLES2Util::kStencil)) { |
785 return false; | 785 return false; |
786 } | 786 } |
787 | 787 |
788 if (!Texture::ColorRenderable(feature_info, base.internal_format, | 788 if (!feature_info->validators()->texture_unsized_internal_format.IsValid( |
789 immutable_) || | 789 base.internal_format)) { |
790 !Texture::TextureFilterable(feature_info, base.internal_format, base.type, | 790 if (!Texture::ColorRenderable(feature_info, base.internal_format, |
791 immutable_)) { | 791 immutable_) || |
792 return false; | 792 !Texture::TextureFilterable(feature_info, base.internal_format, |
| 793 base.type, immutable_)) { |
| 794 return false; |
| 795 } |
793 } | 796 } |
794 | 797 |
795 for (size_t ii = 0; ii < face_infos_.size(); ++ii) { | 798 for (size_t ii = 0; ii < face_infos_.size(); ++ii) { |
796 const LevelInfo& info = face_infos_[ii].level_infos[base_level_]; | 799 const LevelInfo& info = face_infos_[ii].level_infos[base_level_]; |
797 if ((info.target == 0) || | 800 if ((info.target == 0) || |
798 feature_info->validators()->compressed_texture_format.IsValid( | 801 feature_info->validators()->compressed_texture_format.IsValid( |
799 info.internal_format) || | 802 info.internal_format) || |
800 info.image.get()) { | 803 info.image.get()) { |
801 return false; | 804 return false; |
802 } | 805 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 } | 865 } |
863 return complete; | 866 return complete; |
864 } | 867 } |
865 | 868 |
866 // static | 869 // static |
867 bool Texture::ColorRenderable(const FeatureInfo* feature_info, | 870 bool Texture::ColorRenderable(const FeatureInfo* feature_info, |
868 GLenum internal_format, | 871 GLenum internal_format, |
869 bool immutable) { | 872 bool immutable) { |
870 if (feature_info->validators()->texture_unsized_internal_format.IsValid( | 873 if (feature_info->validators()->texture_unsized_internal_format.IsValid( |
871 internal_format)) { | 874 internal_format)) { |
872 return true; | 875 return internal_format == GL_RGBA || internal_format == GL_RGB || |
| 876 internal_format == GL_BGRA_EXT; |
873 } | 877 } |
874 | 878 |
875 return SizedFormatAvailable(feature_info, immutable, internal_format) && | 879 return SizedFormatAvailable(feature_info, immutable, internal_format) && |
876 feature_info->validators() | 880 feature_info->validators() |
877 ->texture_sized_color_renderable_internal_format.IsValid( | 881 ->texture_sized_color_renderable_internal_format.IsValid( |
878 internal_format); | 882 internal_format); |
879 } | 883 } |
880 | 884 |
881 // static | 885 // static |
882 bool Texture::TextureFilterable(const FeatureInfo* feature_info, | 886 bool Texture::TextureFilterable(const FeatureInfo* feature_info, |
(...skipping 2765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 uint32_t TextureManager::GetServiceIdGeneration() const { | 3652 uint32_t TextureManager::GetServiceIdGeneration() const { |
3649 return current_service_id_generation_; | 3653 return current_service_id_generation_; |
3650 } | 3654 } |
3651 | 3655 |
3652 void TextureManager::IncrementServiceIdGeneration() { | 3656 void TextureManager::IncrementServiceIdGeneration() { |
3653 current_service_id_generation_++; | 3657 current_service_id_generation_++; |
3654 } | 3658 } |
3655 | 3659 |
3656 } // namespace gles2 | 3660 } // namespace gles2 |
3657 } // namespace gpu | 3661 } // namespace gpu |
OLD | NEW |