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

Unified Diff: gpu/command_buffer/service/texture_manager.cc

Issue 1619453002: Revert of Check if internal_format is valid for GenerateMipmap(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
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 6c395a697e710f47d47d0bb4d14280953f8b0ac2..9345bb871568fff1ca23c7e46211fa913537b325 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -529,9 +529,11 @@
mailbox_manager_ = mailbox_manager;
}
-void Texture::MarkMipmapsGenerated(
+bool Texture::MarkMipmapsGenerated(
const FeatureInfo* feature_info) {
- DCHECK(CanGenerateMipmaps(feature_info));
+ if (!CanGenerateMipmaps(feature_info)) {
+ return false;
+ }
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_];
@@ -552,6 +554,8 @@
level0_info.type, gfx::Rect(width, height));
}
}
+
+ return true;
}
void Texture::SetTarget(
@@ -596,32 +600,19 @@
return false;
}
- 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;
- }
-
+ // TODO(gman): Check internal_format, format and type.
for (size_t ii = 0; ii < face_infos_.size(); ++ii) {
const LevelInfo& info = face_infos_[ii].level_infos[base_level_];
- if ((info.target == 0) ||
+ 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) ||
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;
}
@@ -1121,8 +1112,7 @@
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 > 0);
+ (first_level.width == first_level.height);
if (first_level.width == 0 || first_level.height == 0) {
texture_complete_ = false;
@@ -1705,12 +1695,13 @@
}
}
-void TextureManager::MarkMipmapsGenerated(TextureRef* ref) {
+bool TextureManager::MarkMipmapsGenerated(TextureRef* ref) {
DCHECK(ref);
Texture* texture = ref->texture();
texture->GetMemTracker()->TrackMemFree(texture->estimated_size());
- texture->MarkMipmapsGenerated(feature_info_.get());
+ bool result = texture->MarkMipmapsGenerated(feature_info_.get());
texture->GetMemTracker()->TrackMemAlloc(texture->estimated_size());
+ return result;
}
TextureRef* TextureManager::CreateTexture(
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698