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 ed0fd10e5b1e6e1ae96fc5b0316d0be8b10290fb..5fcd3a32ea3df3aa86465814f46bcf6527f47432 100644 |
--- a/gpu/command_buffer/service/texture_manager.cc |
+++ b/gpu/command_buffer/service/texture_manager.cc |
@@ -54,7 +54,7 @@ struct TextureSignature { |
GLenum format_; |
GLenum type_; |
bool has_image_; |
- bool can_render_; |
+ bool texture_complete_; |
bool can_render_to_; |
bool npot_; |
@@ -84,7 +84,7 @@ struct TextureSignature { |
GLenum format, |
GLenum type, |
bool has_image, |
- bool can_render, |
+ bool texture_complete, |
bool can_render_to, |
bool npot) { |
memset(this, 0, sizeof(TextureSignature)); |
@@ -110,7 +110,7 @@ struct TextureSignature { |
format_ = format; |
type_ = type; |
has_image_ = has_image; |
- can_render_ = can_render; |
+ texture_complete_ = texture_complete; |
can_render_to_ = can_render_to; |
npot_ = npot; |
} |
@@ -328,7 +328,7 @@ Texture::Texture(GLuint service_id) |
base_level_(0), |
max_level_(1000), |
max_level_set_(-1), |
- texture_complete_(false), |
+ texture_2d_complete_(false), |
texture_mips_dirty_(false), |
texture_mips_complete_(false), |
cube_complete_(false), |
@@ -340,9 +340,8 @@ Texture::Texture(GLuint service_id) |
immutable_(false), |
has_images_(false), |
estimated_size_(0), |
- can_render_condition_(CAN_RENDER_ALWAYS), |
- texture_max_anisotropy_initialized_(false) { |
-} |
+ texture_completeness(TEXTURE_COMPLETE_ALWAYS), |
+ texture_max_anisotropy_initialized_(false) {} |
Texture::~Texture() { |
if (mailbox_manager_) |
@@ -422,29 +421,29 @@ Texture::FaceInfo::FaceInfo() |
Texture::FaceInfo::~FaceInfo() { |
} |
-Texture::CanRenderCondition Texture::GetCanRenderCondition() const { |
+Texture::TextureCompleteness Texture::GetTextureCompleteness() const { |
if (target_ == 0) |
- return CAN_RENDER_ALWAYS; |
+ return TEXTURE_COMPLETE_ALWAYS; |
if (target_ != GL_TEXTURE_EXTERNAL_OES) { |
if (face_infos_.empty()) { |
- return CAN_RENDER_NEVER; |
+ return TEXTURE_INCOMPLETE; |
} |
const Texture::LevelInfo& first_face = face_infos_[0].level_infos[0]; |
if (first_face.width == 0 || |
first_face.height == 0 || |
first_face.depth == 0) { |
- return CAN_RENDER_NEVER; |
+ return TEXTURE_INCOMPLETE; |
} |
} |
bool needs_mips = NeedsMips(); |
if (needs_mips) { |
- if (!texture_complete()) |
- return CAN_RENDER_NEVER; |
+ if (!texture_2d_complete()) |
+ return TEXTURE_INCOMPLETE; |
if (target_ == GL_TEXTURE_CUBE_MAP && !cube_complete()) |
- return CAN_RENDER_NEVER; |
+ return TEXTURE_INCOMPLETE; |
} |
bool is_npot_compatible = !needs_mips && |
@@ -453,21 +452,21 @@ Texture::CanRenderCondition Texture::GetCanRenderCondition() const { |
if (!is_npot_compatible) { |
if (target_ == GL_TEXTURE_RECTANGLE_ARB) |
- return CAN_RENDER_NEVER; |
+ return TEXTURE_INCOMPLETE; |
else if (npot()) |
- return CAN_RENDER_ONLY_IF_NPOT; |
+ return TEXTURE_COMPLETE_ONLY_IF_NPOT; |
} |
- return CAN_RENDER_ALWAYS; |
+ return TEXTURE_COMPLETE_ALWAYS; |
} |
-bool Texture::CanRender(const FeatureInfo* feature_info) const { |
- switch (can_render_condition_) { |
- case CAN_RENDER_ALWAYS: |
+bool Texture::IsTextureComplete(const FeatureInfo* feature_info) const { |
+ switch (texture_completeness) { |
+ case TEXTURE_COMPLETE_ALWAYS: |
return true; |
- case CAN_RENDER_NEVER: |
+ case TEXTURE_INCOMPLETE: |
return false; |
- case CAN_RENDER_ONLY_IF_NPOT: |
+ case TEXTURE_COMPLETE_ONLY_IF_NPOT: |
break; |
} |
return feature_info->feature_flags().npot_ok; |
@@ -490,31 +489,12 @@ void Texture::AddToSignature( |
const Texture::LevelInfo& info = |
face_infos_[face_index].level_infos[level]; |
- TextureSignature signature_data(target, |
- level, |
- min_filter_, |
- mag_filter_, |
- wrap_r_, |
- wrap_s_, |
- wrap_t_, |
- usage_, |
- info.internal_format, |
- compare_func_, |
- compare_mode_, |
- info.width, |
- info.height, |
- info.depth, |
- max_lod_, |
- min_lod_, |
- base_level_, |
- info.border, |
- max_level_, |
- info.format, |
- info.type, |
- info.image.get() != NULL, |
- CanRender(feature_info), |
- CanRenderTo(), |
- npot_); |
+ TextureSignature signature_data( |
+ target, level, min_filter_, mag_filter_, wrap_r_, wrap_s_, wrap_t_, |
+ usage_, info.internal_format, compare_func_, compare_mode_, info.width, |
+ info.height, info.depth, max_lod_, min_lod_, base_level_, info.border, |
+ max_level_, info.format, info.type, info.image.get() != NULL, |
+ IsTextureComplete(feature_info), CanRenderTo(), npot_); |
signature->append(TextureTag, sizeof(TextureTag)); |
signature->append(reinterpret_cast<const char*>(&signature_data), |
@@ -573,7 +553,7 @@ void Texture::SetTarget( |
immutable_ = true; |
} |
Update(feature_info); |
- UpdateCanRenderCondition(); |
+ UpdateTextureCompleteness(); |
} |
bool Texture::CanGenerateMipmaps( |
@@ -731,14 +711,14 @@ void Texture::UpdateMipCleared(LevelInfo* info, |
(*it)->manager()->UpdateUnclearedMips(delta); |
} |
-void Texture::UpdateCanRenderCondition() { |
- CanRenderCondition can_render_condition = GetCanRenderCondition(); |
- if (can_render_condition_ == can_render_condition) |
+void Texture::UpdateTextureCompleteness() { |
+ TextureCompleteness new_texture_completeness = GetTextureCompleteness(); |
+ if (texture_completeness == new_texture_completeness) |
return; |
for (RefSet::iterator it = refs_.begin(); it != refs_.end(); ++it) |
- (*it)->manager()->UpdateCanRenderCondition(can_render_condition_, |
- can_render_condition); |
- can_render_condition_ = can_render_condition; |
+ (*it)->manager()->UpdateTextureCompleteness(texture_completeness, |
+ new_texture_completeness); |
+ texture_completeness = new_texture_completeness; |
} |
void Texture::UpdateHasImages() { |
@@ -840,7 +820,7 @@ void Texture::SetLevelInfo(const FeatureInfo* feature_info, |
max_level_set_ = std::max(max_level_set_, level); |
Update(feature_info); |
UpdateCleared(); |
- UpdateCanRenderCondition(); |
+ UpdateTextureCompleteness(); |
UpdateHasImages(); |
if (IsAttachedToFramebuffer()) { |
// TODO(gman): If textures tracked which framebuffers they were attached to |
@@ -1017,7 +997,7 @@ GLenum Texture::SetParameteri( |
} |
Update(feature_info); |
UpdateCleared(); |
- UpdateCanRenderCondition(); |
+ UpdateTextureCompleteness(); |
return GL_NO_ERROR; |
} |
@@ -1063,7 +1043,7 @@ void Texture::Update(const FeatureInfo* feature_info) { |
npot_ = (target_ == GL_TEXTURE_EXTERNAL_OES) || (num_npot_faces_ > 0); |
if (face_infos_.empty()) { |
- texture_complete_ = false; |
+ texture_2d_complete_ = false; |
cube_complete_ = false; |
return; |
} |
@@ -1073,23 +1053,23 @@ void Texture::Update(const FeatureInfo* feature_info) { |
const Texture::LevelInfo& first_level = first_face.level_infos[0]; |
const GLsizei levels_needed = first_face.num_mip_levels; |
- texture_complete_ = |
+ texture_2d_complete_ = |
max_level_set_ >= (levels_needed - 1) && max_level_set_ >= 0; |
cube_complete_ = (face_infos_.size() == 6) && |
(first_level.width == first_level.height); |
if (first_level.width == 0 || first_level.height == 0) { |
- texture_complete_ = false; |
+ texture_2d_complete_ = false; |
} else if (first_level.type == GL_FLOAT && |
!feature_info->feature_flags().enable_texture_float_linear && |
(min_filter_ != GL_NEAREST_MIPMAP_NEAREST || |
mag_filter_ != GL_NEAREST)) { |
- texture_complete_ = false; |
+ texture_2d_complete_ = false; |
} else if (first_level.type == GL_HALF_FLOAT_OES && |
!feature_info->feature_flags().enable_texture_half_float_linear && |
(min_filter_ != GL_NEAREST_MIPMAP_NEAREST || |
mag_filter_ != GL_NEAREST)) { |
- texture_complete_ = false; |
+ texture_2d_complete_ = false; |
} |
if (cube_complete_ && texture_level0_dirty_) { |
@@ -1113,7 +1093,7 @@ void Texture::Update(const FeatureInfo* feature_info) { |
} |
cube_complete_ &= texture_level0_complete_; |
- if (texture_complete_ && texture_mips_dirty_) { |
+ if (texture_2d_complete_ && texture_mips_dirty_) { |
texture_mips_complete_ = true; |
for (size_t ii = 0; |
ii < face_infos_.size() && texture_mips_complete_; |
@@ -1138,7 +1118,7 @@ void Texture::Update(const FeatureInfo* feature_info) { |
} |
texture_mips_dirty_ = false; |
} |
- texture_complete_ &= texture_mips_complete_; |
+ texture_2d_complete_ &= texture_mips_complete_; |
} |
bool Texture::ClearRenderableLevels(GLES2Decoder* decoder) { |
@@ -1261,7 +1241,7 @@ void Texture::SetLevelImage( |
DCHECK_EQ(info.target, target); |
DCHECK_EQ(info.level, level); |
info.image = image; |
- UpdateCanRenderCondition(); |
+ UpdateTextureCompleteness(); |
UpdateHasImages(); |
} |
@@ -1633,7 +1613,7 @@ void TextureManager::StartTracking(TextureRef* ref) { |
num_uncleared_mips_ += texture->num_uncleared_mips(); |
if (!texture->SafeToRenderFrom()) |
++num_unsafe_textures_; |
- if (!texture->CanRender(feature_info_.get())) |
+ if (!texture->IsTextureComplete(feature_info_.get())) |
++num_unrenderable_textures_; |
if (texture->HasImages()) |
++num_images_; |
@@ -1654,7 +1634,7 @@ void TextureManager::StopTracking(TextureRef* ref) { |
DCHECK_NE(0, num_images_); |
--num_images_; |
} |
- if (!texture->CanRender(feature_info_.get())) { |
+ if (!texture->IsTextureComplete(feature_info_.get())) { |
DCHECK_NE(0, num_unrenderable_textures_); |
--num_unrenderable_textures_; |
} |
@@ -1736,17 +1716,17 @@ void TextureManager::UpdateUnclearedMips(int delta) { |
DCHECK_GE(num_uncleared_mips_, 0); |
} |
-void TextureManager::UpdateCanRenderCondition( |
- Texture::CanRenderCondition old_condition, |
- Texture::CanRenderCondition new_condition) { |
- if (old_condition == Texture::CAN_RENDER_NEVER || |
- (old_condition == Texture::CAN_RENDER_ONLY_IF_NPOT && |
+void TextureManager::UpdateTextureCompleteness( |
+ Texture::TextureCompleteness old_completeness, |
+ Texture::TextureCompleteness new_completeness) { |
+ if (old_completeness == Texture::TEXTURE_INCOMPLETE || |
+ (old_completeness == Texture::TEXTURE_COMPLETE_ONLY_IF_NPOT && |
!feature_info_->feature_flags().npot_ok)) { |
DCHECK_GT(num_unrenderable_textures_, 0); |
--num_unrenderable_textures_; |
} |
- if (new_condition == Texture::CAN_RENDER_NEVER || |
- (new_condition == Texture::CAN_RENDER_ONLY_IF_NPOT && |
+ if (new_completeness == Texture::TEXTURE_INCOMPLETE || |
+ (new_completeness == Texture::TEXTURE_COMPLETE_ONLY_IF_NPOT && |
!feature_info_->feature_flags().npot_ok)) |
++num_unrenderable_textures_; |
} |