Chromium Code Reviews| 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,14 @@ |
| return stream_texture_; |
| } |
| + void SetImmutable(bool immutable) { |
| + immutable_ = immutable; |
|
greggman
2011/12/03 01:41:01
DCHECK(!immutable_) ?
|
| + } |
| + |
| + bool IsImmutable() { |
| + return immutable_; |
| + } |
| + |
| // Whether a particular level/face is cleared. |
| bool IsLevelCleared(GLenum target, GLint level); |
| @@ -239,7 +253,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 +296,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 +323,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 +363,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 +408,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); |