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

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

Issue 1154053002: gpu: Use a rectangle to keep track of the cleared area of each texture level. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: v2 Created 5 years, 7 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_definition.cc
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc
index d4c474b627744305168da3c0f4a85a1846a0cbc1..8b57411ce6a5e132a320f1b23c2c4d6c28132af3 100644
--- a/gpu/command_buffer/service/texture_definition.cc
+++ b/gpu/command_buffer/service/texture_definition.cc
@@ -284,8 +284,7 @@ TextureDefinition::LevelInfo::LevelInfo()
depth(0),
border(0),
format(0),
- type(0),
- cleared(false) {
+ type(0) {
}
TextureDefinition::LevelInfo::LevelInfo(GLenum target,
@@ -296,7 +295,7 @@ TextureDefinition::LevelInfo::LevelInfo(GLenum target,
GLint border,
GLenum format,
GLenum type,
- bool cleared)
+ const gfx::Rect& cleared_rect)
: target(target),
internal_format(internal_format),
width(width),
@@ -305,7 +304,8 @@ TextureDefinition::LevelInfo::LevelInfo(GLenum target,
border(border),
format(format),
type(type),
- cleared(cleared) {}
+ cleared_rect(cleared_rect) {
+}
TextureDefinition::LevelInfo::~LevelInfo() {}
@@ -352,7 +352,7 @@ TextureDefinition::TextureDefinition(
const Texture::LevelInfo& level = first_face.level_infos[0];
level_info_ = LevelInfo(level.target, level.internal_format, level.width,
level.height, level.depth, level.border, level.format,
- level.type, level.cleared);
+ level.type, level.cleared_rect);
}
TextureDefinition::~TextureDefinition() {
@@ -391,7 +391,7 @@ void TextureDefinition::UpdateTextureInternal(Texture* texture) const {
level_info_.internal_format, level_info_.width,
level_info_.height, level_info_.depth,
level_info_.border, level_info_.format,
- level_info_.type, level_info_.cleared);
+ level_info_.type, level_info_.cleared_rect);
}
if (image_buffer_.get()) {
@@ -458,7 +458,8 @@ bool TextureDefinition::Matches(const Texture* texture) const {
}
bool TextureDefinition::SafeToRenderFrom() const {
- return level_info_.cleared;
+ return level_info_.cleared_rect.Contains(
+ gfx::Rect(level_info_.width, level_info_.height));
}
} // namespace gles2

Powered by Google App Engine
This is Rietveld 408576698