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

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: 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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 ++num_unsafe_textures_; 932 ++num_unsafe_textures_;
933 } 933 }
934 } 934 }
935 935
936 TextureDefinition* TextureManager::Save(Texture* texture) { 936 TextureDefinition* TextureManager::Save(Texture* texture) {
937 DCHECK(texture->owned_); 937 DCHECK(texture->owned_);
938 938
939 if (texture->IsAttachedToFramebuffer()) 939 if (texture->IsAttachedToFramebuffer())
940 return NULL; 940 return NULL;
941 941
942 if (texture->target() == GL_TEXTURE_EXTERNAL_OES &&
943 !texture->IsStreamTexture())
944 return NULL;
945
942 TextureDefinition::LevelInfos level_infos(texture->level_infos_.size()); 946 TextureDefinition::LevelInfos level_infos(texture->level_infos_.size());
943 for (size_t face = 0; face < level_infos.size(); ++face) { 947 for (size_t face = 0; face < level_infos.size(); ++face) {
944 GLenum target = 948 GLenum target =
945 texture->target() == GL_TEXTURE_CUBE_MAP ? FaceIndexToGLTarget(face) 949 texture->target() == GL_TEXTURE_CUBE_MAP ? FaceIndexToGLTarget(face)
946 : texture->target(); 950 : texture->target();
947 for (GLint level = 0; level <= texture->max_level_set_; ++level) { 951 for (GLint level = 0; level <= texture->max_level_set_; ++level) {
948 const Texture::LevelInfo& level_info = 952 const Texture::LevelInfo& level_info =
949 texture->level_infos_[face][level]; 953 texture->level_infos_[face][level];
950 954
951 level_infos[face].push_back( 955 level_infos[face].push_back(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 1010
1007 if (texture->target() != definition->target()) 1011 if (texture->target() != definition->target())
1008 return false; 1012 return false;
1009 1013
1010 if (texture->level_infos_.size() < definition->level_infos().size()) 1014 if (texture->level_infos_.size() < definition->level_infos().size())
1011 return false; 1015 return false;
1012 1016
1013 if (texture->level_infos_[0].size() < definition->level_infos()[0].size()) 1017 if (texture->level_infos_[0].size() < definition->level_infos()[0].size())
1014 return false; 1018 return false;
1015 1019
1020 if (texture->target() == GL_TEXTURE_EXTERNAL_OES) {
1021 if (definition->wrap_t() != GL_CLAMP_TO_EDGE ||
1022 definition->wrap_s() != GL_CLAMP_TO_EDGE ||
1023 definition->min_filter() != GL_LINEAR) {
piman 2013/04/13 17:11:36 Is this needed? We checked texture->target() == de
no sievers 2013/04/15 17:33:44 True, removed. This validation does not add any va
1024 return false;
1025 }
1026 texture->SetStreamTexture(true);
1027 }
1028
1016 for (size_t face = 0; face < definition->level_infos().size(); ++face) { 1029 for (size_t face = 0; face < definition->level_infos().size(); ++face) {
1017 GLenum target = 1030 GLenum target =
1018 texture->target() == GL_TEXTURE_CUBE_MAP ? FaceIndexToGLTarget(face) 1031 texture->target() == GL_TEXTURE_CUBE_MAP ? FaceIndexToGLTarget(face)
1019 : texture->target(); 1032 : texture->target();
1020 GLint new_max_level = definition->level_infos()[face].size() - 1; 1033 GLint new_max_level = definition->level_infos()[face].size() - 1;
1021 for (GLint level = 0; 1034 for (GLint level = 0;
1022 level <= std::max(texture->max_level_set_, new_max_level); 1035 level <= std::max(texture->max_level_set_, new_max_level);
1023 ++level) { 1036 ++level) {
1024 const TextureDefinition::LevelInfo& level_info = 1037 const TextureDefinition::LevelInfo& level_info =
1025 level <= new_max_level ? definition->level_infos()[face][level] 1038 level <= new_max_level ? definition->level_infos()[face][level]
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 void TextureManager::AddToSignature( 1246 void TextureManager::AddToSignature(
1234 Texture* texture, 1247 Texture* texture,
1235 GLenum target, 1248 GLenum target,
1236 GLint level, 1249 GLint level,
1237 std::string* signature) const { 1250 std::string* signature) const {
1238 texture->AddToSignature(feature_info_.get(), target, level, signature); 1251 texture->AddToSignature(feature_info_.get(), target, level, signature);
1239 } 1252 }
1240 1253
1241 } // namespace gles2 1254 } // namespace gles2
1242 } // namespace gpu 1255 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698