Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: gpu/command_buffer/service/texture_manager.cc

Issue 14095009: Android: Fix up video to work with mailboxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 scoped_ptr<TextureDefinition> definition(
985 old_service_id, 987 new TextureDefinition(texture->target(),
986 texture->min_filter(), 988 old_service_id,
987 texture->mag_filter(), 989 texture->min_filter(),
988 texture->wrap_s(), 990 texture->mag_filter(),
989 texture->wrap_t(), 991 texture->wrap_s(),
990 texture->usage(), 992 texture->wrap_t(),
991 immutable, 993 texture->usage(),
992 level_infos); 994 immutable,
995 level_infos));
996
997 if (stream_texture)
998 definition->SetStreamTexture();
999
1000 return definition.release();
993 } 1001 }
994 1002
995 bool TextureManager::Restore( 1003 bool TextureManager::Restore(
996 const char* function_name, 1004 const char* function_name,
997 GLES2Decoder* decoder, 1005 GLES2Decoder* decoder,
998 Texture* texture, 1006 Texture* texture,
999 TextureDefinition* definition) { 1007 TextureDefinition* definition) {
1000 DCHECK(texture->owned_); 1008 DCHECK(texture->owned_);
1001 1009
1002 scoped_ptr<TextureDefinition> scoped_definition(definition); 1010 scoped_ptr<TextureDefinition> scoped_definition(definition);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 level_info.type, 1044 level_info.type,
1037 level_info.cleared); 1045 level_info.cleared);
1038 } 1046 }
1039 } 1047 }
1040 1048
1041 GLuint old_service_id = texture->service_id(); 1049 GLuint old_service_id = texture->service_id();
1042 glDeleteTextures(1, &old_service_id); 1050 glDeleteTextures(1, &old_service_id);
1043 texture->SetServiceId(definition->ReleaseServiceId()); 1051 texture->SetServiceId(definition->ReleaseServiceId());
1044 glBindTexture(texture->target(), texture->service_id()); 1052 glBindTexture(texture->target(), texture->service_id());
1045 texture->SetImmutable(definition->immutable()); 1053 texture->SetImmutable(definition->immutable());
1054 texture->SetStreamTexture(definition->IsStreamTexture());
1046 SetParameter(function_name, decoder, texture, GL_TEXTURE_MIN_FILTER, 1055 SetParameter(function_name, decoder, texture, GL_TEXTURE_MIN_FILTER,
1047 definition->min_filter()); 1056 definition->min_filter());
1048 SetParameter(function_name, decoder, texture, GL_TEXTURE_MAG_FILTER, 1057 SetParameter(function_name, decoder, texture, GL_TEXTURE_MAG_FILTER,
1049 definition->mag_filter()); 1058 definition->mag_filter());
1050 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_S, 1059 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_S,
1051 definition->wrap_s()); 1060 definition->wrap_s());
1052 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_T, 1061 SetParameter(function_name, decoder, texture, GL_TEXTURE_WRAP_T,
1053 definition->wrap_t()); 1062 definition->wrap_t());
1054 if (feature_info_->validators()->texture_parameter.IsValid( 1063 if (feature_info_->validators()->texture_parameter.IsValid(
1055 GL_TEXTURE_USAGE_ANGLE)) { 1064 GL_TEXTURE_USAGE_ANGLE)) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 void TextureManager::AddToSignature( 1242 void TextureManager::AddToSignature(
1234 Texture* texture, 1243 Texture* texture,
1235 GLenum target, 1244 GLenum target,
1236 GLint level, 1245 GLint level,
1237 std::string* signature) const { 1246 std::string* signature) const {
1238 texture->AddToSignature(feature_info_.get(), target, level, signature); 1247 texture->AddToSignature(feature_info_.get(), target, level, signature);
1239 } 1248 }
1240 1249
1241 } // namespace gles2 1250 } // namespace gles2
1242 } // namespace gpu 1251 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698