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 #include "base/bits.h" | 6 #include "base/bits.h" |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
9 #include "gpu/command_buffer/service/feature_info.h" | 9 #include "gpu/command_buffer/service/feature_info.h" |
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 GLuint old_service_id = info->service_id(); | 961 GLuint old_service_id = info->service_id(); |
962 bool immutable = info->IsImmutable(); | 962 bool immutable = info->IsImmutable(); |
963 | 963 |
964 GLuint new_service_id = 0; | 964 GLuint new_service_id = 0; |
965 glGenTextures(1, &new_service_id); | 965 glGenTextures(1, &new_service_id); |
966 info->SetServiceId(new_service_id); | 966 info->SetServiceId(new_service_id); |
967 info->SetImmutable(false); | 967 info->SetImmutable(false); |
968 | 968 |
969 return new TextureDefinition(info->target(), | 969 return new TextureDefinition(info->target(), |
970 old_service_id, | 970 old_service_id, |
| 971 info->min_filter(), |
| 972 info->mag_filter(), |
| 973 info->wrap_s(), |
| 974 info->wrap_t(), |
| 975 info->usage(), |
971 immutable, | 976 immutable, |
972 level_infos); | 977 level_infos); |
973 } | 978 } |
974 | 979 |
975 bool TextureManager::Restore(TextureInfo* info, | 980 bool TextureManager::Restore(TextureInfo* info, |
976 TextureDefinition* definition) { | 981 TextureDefinition* definition) { |
977 DCHECK(info->owned_); | 982 DCHECK(info->owned_); |
978 | 983 |
979 scoped_ptr<TextureDefinition> scoped_definition(definition); | 984 scoped_ptr<TextureDefinition> scoped_definition(definition); |
980 | 985 |
(...skipping 26 matching lines...) Expand all Loading... |
1007 level_info.format, | 1012 level_info.format, |
1008 level_info.type, | 1013 level_info.type, |
1009 level_info.cleared); | 1014 level_info.cleared); |
1010 } | 1015 } |
1011 } | 1016 } |
1012 | 1017 |
1013 GLuint old_service_id = info->service_id(); | 1018 GLuint old_service_id = info->service_id(); |
1014 glDeleteTextures(1, &old_service_id); | 1019 glDeleteTextures(1, &old_service_id); |
1015 info->SetServiceId(definition->ReleaseServiceId()); | 1020 info->SetServiceId(definition->ReleaseServiceId()); |
1016 info->SetImmutable(definition->immutable()); | 1021 info->SetImmutable(definition->immutable()); |
| 1022 SetParameter(info, GL_TEXTURE_MIN_FILTER, definition->min_filter()); |
| 1023 SetParameter(info, GL_TEXTURE_MAG_FILTER, definition->mag_filter()); |
| 1024 SetParameter(info, GL_TEXTURE_WRAP_S, definition->wrap_s()); |
| 1025 SetParameter(info, GL_TEXTURE_WRAP_T, definition->wrap_t()); |
| 1026 SetParameter(info, GL_TEXTURE_USAGE_ANGLE, definition->usage()); |
1017 | 1027 |
1018 return true; | 1028 return true; |
1019 } | 1029 } |
1020 | 1030 |
1021 bool TextureManager::SetParameter( | 1031 bool TextureManager::SetParameter( |
1022 TextureManager::TextureInfo* info, GLenum pname, GLint param) { | 1032 TextureManager::TextureInfo* info, GLenum pname, GLint param) { |
1023 DCHECK(info); | 1033 DCHECK(info); |
1024 if (!info->CanRender(feature_info_)) { | 1034 if (!info->CanRender(feature_info_)) { |
1025 DCHECK_NE(0, num_unrenderable_textures_); | 1035 DCHECK_NE(0, num_unrenderable_textures_); |
1026 --num_unrenderable_textures_; | 1036 --num_unrenderable_textures_; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 void TextureManager::AddToSignature( | 1171 void TextureManager::AddToSignature( |
1162 TextureInfo* info, | 1172 TextureInfo* info, |
1163 GLenum target, | 1173 GLenum target, |
1164 GLint level, | 1174 GLint level, |
1165 std::string* signature) const { | 1175 std::string* signature) const { |
1166 info->AddToSignature(feature_info_.get(), target, level, signature); | 1176 info->AddToSignature(feature_info_.get(), target, level, signature); |
1167 } | 1177 } |
1168 | 1178 |
1169 } // namespace gles2 | 1179 } // namespace gles2 |
1170 } // namespace gpu | 1180 } // namespace gpu |
OLD | NEW |