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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 0, | 968 0, |
969 0, | 969 0, |
970 GL_RGBA, | 970 GL_RGBA, |
971 GL_UNSIGNED_BYTE, | 971 GL_UNSIGNED_BYTE, |
972 true); | 972 true); |
973 } | 973 } |
974 } | 974 } |
975 | 975 |
976 GLuint old_service_id = texture->service_id(); | 976 GLuint old_service_id = texture->service_id(); |
977 bool immutable = texture->IsImmutable(); | 977 bool immutable = texture->IsImmutable(); |
| 978 bool stream_texture = texture->IsStreamTexture(); |
978 | 979 |
979 GLuint new_service_id = 0; | 980 GLuint new_service_id = 0; |
980 glGenTextures(1, &new_service_id); | 981 glGenTextures(1, &new_service_id); |
981 texture->SetServiceId(new_service_id); | 982 texture->SetServiceId(new_service_id); |
982 texture->SetImmutable(false); | 983 texture->SetImmutable(false); |
| 984 texture->SetStreamTexture(false); |
983 | 985 |
984 return new TextureDefinition(texture->target(), | 986 return new TextureDefinition(texture->target(), |
985 old_service_id, | 987 old_service_id, |
986 texture->min_filter(), | 988 texture->min_filter(), |
987 texture->mag_filter(), | 989 texture->mag_filter(), |
988 texture->wrap_s(), | 990 texture->wrap_s(), |
989 texture->wrap_t(), | 991 texture->wrap_t(), |
990 texture->usage(), | 992 texture->usage(), |
991 immutable, | 993 immutable, |
| 994 stream_texture, |
992 level_infos); | 995 level_infos); |
993 } | 996 } |
994 | 997 |
995 bool TextureManager::Restore( | 998 bool TextureManager::Restore( |
996 const char* function_name, | 999 const char* function_name, |
997 GLES2Decoder* decoder, | 1000 GLES2Decoder* decoder, |
998 Texture* texture, | 1001 Texture* texture, |
999 TextureDefinition* definition) { | 1002 TextureDefinition* definition) { |
1000 DCHECK(texture->owned_); | 1003 DCHECK(texture->owned_); |
1001 | 1004 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 level_info.type, | 1039 level_info.type, |
1037 level_info.cleared); | 1040 level_info.cleared); |
1038 } | 1041 } |
1039 } | 1042 } |
1040 | 1043 |
1041 GLuint old_service_id = texture->service_id(); | 1044 GLuint old_service_id = texture->service_id(); |
1042 glDeleteTextures(1, &old_service_id); | 1045 glDeleteTextures(1, &old_service_id); |
1043 texture->SetServiceId(definition->ReleaseServiceId()); | 1046 texture->SetServiceId(definition->ReleaseServiceId()); |
1044 glBindTexture(texture->target(), texture->service_id()); | 1047 glBindTexture(texture->target(), texture->service_id()); |
1045 texture->SetImmutable(definition->immutable()); | 1048 texture->SetImmutable(definition->immutable()); |
| 1049 texture->SetStreamTexture(definition->stream_texture()); |
1046 SetParameter(function_name, decoder, texture, GL_TEXTURE_MIN_FILTER, | 1050 SetParameter(function_name, decoder, texture, GL_TEXTURE_MIN_FILTER, |
1047 definition->min_filter()); | 1051 definition->min_filter()); |
1048 SetParameter(function_name, decoder, texture, GL_TEXTURE_MAG_FILTER, | 1052 SetParameter(function_name, decoder, texture, GL_TEXTURE_MAG_FILTER, |
1049 definition->mag_filter()); | 1053 definition->mag_filter()); |
1050 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_S, | 1054 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_S, |
1051 definition->wrap_s()); | 1055 definition->wrap_s()); |
1052 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_T, | 1056 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_T, |
1053 definition->wrap_t()); | 1057 definition->wrap_t()); |
1054 if (feature_info_->validators()->texture_parameter.IsValid( | 1058 if (feature_info_->validators()->texture_parameter.IsValid( |
1055 GL_TEXTURE_USAGE_ANGLE)) { | 1059 GL_TEXTURE_USAGE_ANGLE)) { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 void TextureManager::AddToSignature( | 1237 void TextureManager::AddToSignature( |
1234 Texture* texture, | 1238 Texture* texture, |
1235 GLenum target, | 1239 GLenum target, |
1236 GLint level, | 1240 GLint level, |
1237 std::string* signature) const { | 1241 std::string* signature) const { |
1238 texture->AddToSignature(feature_info_.get(), target, level, signature); | 1242 texture->AddToSignature(feature_info_.get(), target, level, signature); |
1239 } | 1243 } |
1240 | 1244 |
1241 } // namespace gles2 | 1245 } // namespace gles2 |
1242 } // namespace gpu | 1246 } // namespace gpu |
OLD | NEW |