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.h

Issue 633773002: Optimized Texture::Update() function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Recalculate texture/cube complete on dirty flag, added face structure Created 6 years, 2 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.h
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index df00607c4774b4e1043f1f58eb9f24c9be38366c..9ec7e10047a44f3bf85c260fce703cc2a99cb8d4 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -208,6 +208,14 @@ class GPU_EXPORT Texture {
uint32 estimated_size;
};
+ struct FaceInfo {
+ FaceInfo();
+ ~FaceInfo();
+
+ GLsizei num_mip_levels;
+ std::vector<LevelInfo> level_infos;
+ };
+
// Set the info for a particular level.
void SetLevelInfo(
const FeatureInfo* feature_info,
@@ -276,6 +284,31 @@ class GPU_EXPORT Texture {
// Returns true if mipmaps can be generated by GL.
bool CanGenerateMipmaps(const FeatureInfo* feature_info) const;
+ // Returns true if any of the texture dimensions are not a power of two.
+ static bool TextureIsNPOT(GLsizei width, GLsizei height, GLsizei depth);
+
+ // Returns true if texture face is complete relative to the first face.
+ static bool TextureFaceComplete(const Texture::LevelInfo& first_face,
+ size_t face_index,
+ GLenum target,
+ GLenum internal_format,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type);
+
+ // Returns true if texture mip level is complete relative to first level.
+ static bool TextureMipComplete(const Texture::LevelInfo& level0_face,
+ GLenum target,
+ GLint level,
+ GLenum internal_format,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLenum type);
+
// Sets the Texture's target
// Parameters:
// target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or
@@ -327,7 +360,7 @@ class GPU_EXPORT Texture {
MailboxManager* mailbox_manager_;
// Info about each face and level of texture.
- std::vector<std::vector<LevelInfo> > level_infos_;
+ std::vector<FaceInfo> face_infos_;
// The texture refs that point to this Texture.
typedef std::set<TextureRef*> RefSet;
@@ -344,6 +377,7 @@ class GPU_EXPORT Texture {
bool cleared_;
int num_uncleared_mips_;
+ int num_npot_faces_;
// The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP.
GLenum target_;
@@ -362,9 +396,15 @@ class GPU_EXPORT Texture {
// Whether or not this texture is "texture complete"
bool texture_complete_;
+ // Whether mip levels have changed and should be reverified.
+ bool texture_mips_dirty_;
+
// Whether or not this texture is "cube complete"
bool cube_complete_;
+ // Whether any level 0 faces have changed and should be reverified.
+ bool texture_level0_dirty_;
+
// Whether or not this texture is non-power-of-two
bool npot_;

Powered by Google App Engine
This is Rietveld 408576698