Index: gpu/command_buffer/service/texture_manager.h |
=================================================================== |
--- gpu/command_buffer/service/texture_manager.h (revision 112643) |
+++ gpu/command_buffer/service/texture_manager.h (working copy) |
@@ -40,6 +40,7 @@ |
mag_filter_(GL_LINEAR), |
wrap_s_(GL_REPEAT), |
wrap_t_(GL_REPEAT), |
+ usage_(GL_NONE), |
max_level_set_(-1), |
texture_complete_(false), |
cube_complete_(false), |
@@ -47,7 +48,8 @@ |
has_been_bound_(false), |
framebuffer_attachment_count_(0), |
owned_(true), |
- stream_texture_(false) { |
+ stream_texture_(false), |
+ immutable_(false) { |
} |
GLenum min_filter() const { |
@@ -66,6 +68,10 @@ |
return wrap_t_; |
} |
+ GLenum usage() const { |
+ return usage_; |
+ } |
+ |
int num_uncleared_mips() const { |
return num_uncleared_mips_; |
} |
@@ -169,6 +175,15 @@ |
return stream_texture_; |
} |
+ void SetImmutable(bool immutable) { |
+ DCHECK(!immutable_); |
+ immutable_ = immutable; |
+ } |
+ |
+ bool IsImmutable() { |
+ return immutable_; |
+ } |
+ |
// Whether a particular level/face is cleared. |
bool IsLevelCleared(GLenum target, GLint level); |
@@ -239,7 +254,7 @@ |
const FeatureInfo* feature_info, GLenum pname, GLint param); |
// Makes each of the mip levels as though they were generated. |
- bool MarkMipmapsGenerated(const FeatureInfo* feature_info); |
+ bool MarkMipmapsGenerated(const FeatureInfo* feature_info, bool cleared); |
void MarkAsDeleted() { |
service_id_ = 0; |
@@ -282,6 +297,7 @@ |
GLenum mag_filter_; |
GLenum wrap_s_; |
GLenum wrap_t_; |
+ GLenum usage_; |
// The maximum level that has been set. |
GLint max_level_set_; |
@@ -308,6 +324,10 @@ |
// Whether this is a special streaming texture. |
bool stream_texture_; |
+ // Whether the texture is immutable and no further changes to the format |
+ // or dimensions of the texture object can be made. |
+ bool immutable_; |
+ |
DISALLOW_COPY_AND_ASSIGN(TextureInfo); |
}; |
@@ -344,6 +364,10 @@ |
} |
} |
+ // Returns the maxium number of levels a texture of the given size can have. |
+ static GLsizei ComputeMipMapCount( |
+ GLsizei width, GLsizei height, GLsizei depth); |
+ |
// Checks if a dimensions are valid for a given target. |
bool ValidForTarget( |
const FeatureInfo* feature_info, |
@@ -385,7 +409,8 @@ |
// Makes each of the mip levels as though they were generated. |
// Returns false if that's not allowed for the given texture. |
- bool MarkMipmapsGenerated(const FeatureInfo* feature_info, TextureInfo* info); |
+ bool MarkMipmapsGenerated(const FeatureInfo* feature_info, TextureInfo* info, |
+ bool cleared); |
// Clears any uncleared renderable levels. |
bool ClearRenderableLevels(GLES2Decoder* decoder, TextureInfo* info); |