| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |    5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 
|    6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |    6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 
|    7  |    7  | 
|    8 #include <list> |    8 #include <list> | 
|    9 #include <string> |    9 #include <string> | 
|   10 #include <vector> |   10 #include <vector> | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  132  |  132  | 
|  133   void AttachToFramebuffer() { |  133   void AttachToFramebuffer() { | 
|  134     ++framebuffer_attachment_count_; |  134     ++framebuffer_attachment_count_; | 
|  135   } |  135   } | 
|  136  |  136  | 
|  137   void DetachFromFramebuffer() { |  137   void DetachFromFramebuffer() { | 
|  138     DCHECK_GT(framebuffer_attachment_count_, 0); |  138     DCHECK_GT(framebuffer_attachment_count_, 0); | 
|  139     --framebuffer_attachment_count_; |  139     --framebuffer_attachment_count_; | 
|  140   } |  140   } | 
|  141  |  141  | 
|  142   void SetStreamTexture(bool stream_texture) { |  142   bool IsStreamTexture() const { | 
|  143     stream_texture_ = stream_texture; |  | 
|  144   } |  | 
|  145  |  | 
|  146   bool IsStreamTexture() { |  | 
|  147     return stream_texture_; |  143     return stream_texture_; | 
|  148   } |  144   } | 
|  149  |  145  | 
|  150   gpu::AsyncPixelTransferState* GetAsyncTransferState() const { |  146   gpu::AsyncPixelTransferState* GetAsyncTransferState() const { | 
|  151     return async_transfer_state_.get(); |  147     return async_transfer_state_.get(); | 
|  152   } |  148   } | 
|  153   void SetAsyncTransferState(scoped_ptr<gpu::AsyncPixelTransferState> state) { |  149   void SetAsyncTransferState(scoped_ptr<gpu::AsyncPixelTransferState> state) { | 
|  154     async_transfer_state_ = state.Pass(); |  150     async_transfer_state_ = state.Pass(); | 
|  155   } |  151   } | 
|  156   bool AsyncTransferIsInProgress() { |  152   bool AsyncTransferIsInProgress() { | 
|  157     return async_transfer_state_ && |  153     return async_transfer_state_ && | 
|  158         async_transfer_state_->TransferIsInProgress(); |  154         async_transfer_state_->TransferIsInProgress(); | 
|  159   } |  155   } | 
|  160  |  156  | 
|  161   void SetImmutable(bool immutable) { |  157   void SetImmutable(bool immutable) { | 
|  162     immutable_ = immutable; |  158     immutable_ = immutable; | 
|  163   } |  159   } | 
|  164  |  160  | 
|  165   bool IsImmutable() { |  161   bool IsImmutable() const { | 
|  166     return immutable_; |  162     return immutable_; | 
|  167   } |  163   } | 
|  168  |  164  | 
|  169   // Whether a particular level/face is cleared. |  165   // Whether a particular level/face is cleared. | 
|  170   bool IsLevelCleared(GLenum target, GLint level) const; |  166   bool IsLevelCleared(GLenum target, GLint level) const; | 
|  171  |  167  | 
|  172   // Whether the texture has been defined |  168   // Whether the texture has been defined | 
|  173   bool IsDefined() { |  169   bool IsDefined() const { | 
|  174     return estimated_size() > 0; |  170     return estimated_size() > 0; | 
|  175   } |  171   } | 
|  176  |  172  | 
|  177  private: |  173  private: | 
|  178   friend class TextureManager; |  174   friend class TextureManager; | 
|  179   friend class TextureTestHelper; |  175   friend class TextureTestHelper; | 
|  180   friend class base::RefCounted<Texture>; |  176   friend class base::RefCounted<Texture>; | 
|  181  |  177  | 
|  182   ~Texture(); |  178   ~Texture(); | 
|  183  |  179  | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  225   // same format, all the same dimensions and all width = height. |  221   // same format, all the same dimensions and all width = height. | 
|  226   bool cube_complete() const { |  222   bool cube_complete() const { | 
|  227     return cube_complete_; |  223     return cube_complete_; | 
|  228   } |  224   } | 
|  229  |  225  | 
|  230   // Whether or not this texture is a non-power-of-two texture. |  226   // Whether or not this texture is a non-power-of-two texture. | 
|  231   bool npot() const { |  227   bool npot() const { | 
|  232     return npot_; |  228     return npot_; | 
|  233   } |  229   } | 
|  234  |  230  | 
 |  231   void SetStreamTexture(bool stream_texture) { | 
 |  232     stream_texture_ = stream_texture; | 
 |  233   } | 
 |  234  | 
|  235   // Marks a particular level as cleared or uncleared. |  235   // Marks a particular level as cleared or uncleared. | 
|  236   void SetLevelCleared(GLenum target, GLint level, bool cleared); |  236   void SetLevelCleared(GLenum target, GLint level, bool cleared); | 
|  237  |  237  | 
|  238   // Updates the cleared flag for this texture by inspecting all the mips. |  238   // Updates the cleared flag for this texture by inspecting all the mips. | 
|  239   void UpdateCleared(); |  239   void UpdateCleared(); | 
|  240  |  240  | 
|  241   // Clears any renderable uncleared levels. |  241   // Clears any renderable uncleared levels. | 
|  242   // Returns false if a GL error was generated. |  242   // Returns false if a GL error was generated. | 
|  243   bool ClearRenderableLevels(GLES2Decoder* decoder); |  243   bool ClearRenderableLevels(GLES2Decoder* decoder); | 
|  244  |  244  | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
|  268   bool CanRender(const FeatureInfo* feature_info) const; |  268   bool CanRender(const FeatureInfo* feature_info) const; | 
|  269  |  269  | 
|  270   // Returns true if mipmaps can be generated by GL. |  270   // Returns true if mipmaps can be generated by GL. | 
|  271   bool CanGenerateMipmaps(const FeatureInfo* feature_info) const; |  271   bool CanGenerateMipmaps(const FeatureInfo* feature_info) const; | 
|  272  |  272  | 
|  273   // Sets the Texture's target |  273   // Sets the Texture's target | 
|  274   // Parameters: |  274   // Parameters: | 
|  275   //   target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or |  275   //   target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP or | 
|  276   //           GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB |  276   //           GL_TEXTURE_EXTERNAL_OES or GL_TEXTURE_RECTANGLE_ARB | 
|  277   //   max_levels: The maximum levels this type of target can have. |  277   //   max_levels: The maximum levels this type of target can have. | 
|  278   void SetTarget(GLenum target, GLint max_levels); |  278   void SetTarget( | 
 |  279       const FeatureInfo* feature_info, GLenum target, GLint max_levels); | 
|  279  |  280  | 
|  280   // Update info about this texture. |  281   // Update info about this texture. | 
|  281   void Update(const FeatureInfo* feature_info); |  282   void Update(const FeatureInfo* feature_info); | 
|  282  |  283  | 
|  283   // Set the image for a particular level. |  284   // Set the image for a particular level. | 
|  284   void SetLevelImage( |  285   void SetLevelImage( | 
|  285       const FeatureInfo* feature_info, |  286       const FeatureInfo* feature_info, | 
|  286       GLenum target, |  287       GLenum target, | 
|  287       GLint level, |  288       GLint level, | 
|  288       gfx::GLImage* image); |  289       gfx::GLImage* image); | 
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  429   } |  430   } | 
|  430  |  431  | 
|  431   // Sets the Texture's target |  432   // Sets the Texture's target | 
|  432   // Parameters: |  433   // Parameters: | 
|  433   //   target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP |  434   //   target: GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP | 
|  434   //   max_levels: The maximum levels this type of target can have. |  435   //   max_levels: The maximum levels this type of target can have. | 
|  435   void SetTarget( |  436   void SetTarget( | 
|  436       Texture* texture, |  437       Texture* texture, | 
|  437       GLenum target); |  438       GLenum target); | 
|  438  |  439  | 
 |  440   // Marks a texture as a stream texture. | 
 |  441   void SetStreamTexture(Texture* texture, bool stream_texture); | 
 |  442  | 
|  439   // Set the info for a particular level in a TexureInfo. |  443   // Set the info for a particular level in a TexureInfo. | 
|  440   void SetLevelInfo( |  444   void SetLevelInfo( | 
|  441       Texture* texture, |  445       Texture* texture, | 
|  442       GLenum target, |  446       GLenum target, | 
|  443       GLint level, |  447       GLint level, | 
|  444       GLenum internal_format, |  448       GLenum internal_format, | 
|  445       GLsizei width, |  449       GLsizei width, | 
|  446       GLsizei height, |  450       GLsizei height, | 
|  447       GLsizei depth, |  451       GLsizei depth, | 
|  448       GLint border, |  452       GLint border, | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  610   // The default textures for each target (texture name = 0) |  614   // The default textures for each target (texture name = 0) | 
|  611   scoped_refptr<Texture> default_textures_[kNumDefaultTextures]; |  615   scoped_refptr<Texture> default_textures_[kNumDefaultTextures]; | 
|  612  |  616  | 
|  613   DISALLOW_COPY_AND_ASSIGN(TextureManager); |  617   DISALLOW_COPY_AND_ASSIGN(TextureManager); | 
|  614 }; |  618 }; | 
|  615  |  619  | 
|  616 }  // namespace gles2 |  620 }  // namespace gles2 | 
|  617 }  // namespace gpu |  621 }  // namespace gpu | 
|  618  |  622  | 
|  619 #endif  // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |  623 #endif  // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 
| OLD | NEW |