Chromium Code Reviews| Index: gpu/command_buffer/service/texture_manager.cc |
| diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc |
| index 9345bb871568fff1ca23c7e46211fa913537b325..d027e39e69d2fe31d4ceb38a4ec6cab97e1a198a 100644 |
| --- a/gpu/command_buffer/service/texture_manager.cc |
| +++ b/gpu/command_buffer/service/texture_manager.cc |
| @@ -529,11 +529,9 @@ void Texture::SetMailboxManager(MailboxManager* mailbox_manager) { |
| mailbox_manager_ = mailbox_manager; |
| } |
| -bool Texture::MarkMipmapsGenerated( |
| +void Texture::MarkMipmapsGenerated( |
| const FeatureInfo* feature_info) { |
| - if (!CanGenerateMipmaps(feature_info)) { |
| - return false; |
| - } |
| + DCHECK(CanGenerateMipmaps(feature_info)); |
| for (size_t ii = 0; ii < face_infos_.size(); ++ii) { |
| const Texture::FaceInfo& face_info = face_infos_[ii]; |
| const Texture::LevelInfo& level0_info = face_info.level_infos[base_level_]; |
| @@ -554,8 +552,6 @@ bool Texture::MarkMipmapsGenerated( |
| level0_info.type, gfx::Rect(width, height)); |
| } |
| } |
| - |
| - return true; |
| } |
| void Texture::SetTarget( |
| @@ -600,20 +596,35 @@ bool Texture::CanGenerateMipmaps( |
| return false; |
| } |
| - // TODO(gman): Check internal_format, format and type. |
| + if (feature_info->IsES3Enabled()) { |
|
piman
2016/01/20 23:03:51
nit: I think you should go through this code even
Zhenyao Mo
2016/01/20 23:25:38
Done.
|
| + bool valid_internal_format = false; |
| + if (feature_info->validators()->texture_unsized_internal_format.IsValid( |
| + base.internal_format)) { |
| + valid_internal_format = true; |
| + } else if (feature_info->validators()-> |
| + texture_sized_color_renderable_internal_format.IsValid( |
| + base.internal_format) && feature_info->validators()-> |
| + texture_sized_texture_filterable_internal_format.IsValid( |
| + base.internal_format)) { |
| + valid_internal_format = true; |
| + } |
| + if (!valid_internal_format) { |
| + return false; |
| + } |
| + } |
| + |
| for (size_t ii = 0; ii < face_infos_.size(); ++ii) { |
| const LevelInfo& info = face_infos_[ii].level_infos[base_level_]; |
| - if ((info.target == 0) || (info.width != base.width) || |
| - (info.height != base.height) || (info.depth != base.depth) || |
| - (info.format != base.format) || |
| - (info.internal_format != base.internal_format) || |
| - (info.type != base.type) || |
| + if ((info.target == 0) || |
| feature_info->validators()->compressed_texture_format.IsValid( |
| info.internal_format) || |
| info.image.get()) { |
| return false; |
| } |
| } |
| + if (face_infos_.size() == 6 && !cube_complete_) { |
| + return false; |
| + } |
| return true; |
| } |
| @@ -1112,7 +1123,8 @@ void Texture::Update(const FeatureInfo* feature_info) { |
| texture_complete_ = |
| max_level_set_ >= (levels_needed - 1) && max_level_set_ >= 0; |
| cube_complete_ = (face_infos_.size() == 6) && |
| - (first_level.width == first_level.height); |
| + (first_level.width == first_level.height) && |
| + (first_level.width > 0); |
| if (first_level.width == 0 || first_level.height == 0) { |
| texture_complete_ = false; |
| @@ -1695,13 +1707,12 @@ void TextureManager::SetParameterf( |
| } |
| } |
| -bool TextureManager::MarkMipmapsGenerated(TextureRef* ref) { |
| +void TextureManager::MarkMipmapsGenerated(TextureRef* ref) { |
| DCHECK(ref); |
| Texture* texture = ref->texture(); |
| texture->GetMemTracker()->TrackMemFree(texture->estimated_size()); |
| - bool result = texture->MarkMipmapsGenerated(feature_info_.get()); |
| + texture->MarkMipmapsGenerated(feature_info_.get()); |
| texture->GetMemTracker()->TrackMemAlloc(texture->estimated_size()); |
| - return result; |
| } |
| TextureRef* TextureManager::CreateTexture( |