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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 // Return 0 if it's not immutable. | 255 // Return 0 if it's not immutable. |
256 GLint GetImmutableLevels() const; | 256 GLint GetImmutableLevels() const; |
257 | 257 |
258 // Get the cleared rectangle for a particular level. Returns an empty | 258 // Get the cleared rectangle for a particular level. Returns an empty |
259 // rectangle if level does not exist. | 259 // rectangle if level does not exist. |
260 gfx::Rect GetLevelClearedRect(GLenum target, GLint level) const; | 260 gfx::Rect GetLevelClearedRect(GLenum target, GLint level) const; |
261 | 261 |
262 // Whether a particular level/face is cleared. | 262 // Whether a particular level/face is cleared. |
263 bool IsLevelCleared(GLenum target, GLint level) const; | 263 bool IsLevelCleared(GLenum target, GLint level) const; |
| 264 |
| 265 // Only meaningful when the format is DEPTH_STENCIL. |
| 266 // Whether a particular part is cleared. |
| 267 bool IsLevelCleared(GLenum target, GLint level, GLenum attachment) const; |
| 268 |
264 // Whether a particular level/face is partially cleared. | 269 // Whether a particular level/face is partially cleared. |
265 bool IsLevelPartiallyCleared(GLenum target, GLint level) const; | 270 bool IsLevelPartiallyCleared(GLenum target, GLint level) const; |
266 | 271 |
267 // Whether the texture has been defined | 272 // Whether the texture has been defined |
268 bool IsDefined() const { | 273 bool IsDefined() const { |
269 return estimated_size() > 0; | 274 return estimated_size() > 0; |
270 } | 275 } |
271 | 276 |
272 // Initialize TEXTURE_MAX_ANISOTROPY to 1 if we haven't done so yet. | 277 // Initialize TEXTURE_MAX_ANISOTROPY to 1 if we haven't done so yet. |
273 void InitTextureMaxAnisotropyIfNeeded(GLenum target); | 278 void InitTextureMaxAnisotropyIfNeeded(GLenum target); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 393 } |
389 | 394 |
390 // Marks a |rect| of a particular level as cleared. | 395 // Marks a |rect| of a particular level as cleared. |
391 void SetLevelClearedRect(GLenum target, | 396 void SetLevelClearedRect(GLenum target, |
392 GLint level, | 397 GLint level, |
393 const gfx::Rect& cleared_rect); | 398 const gfx::Rect& cleared_rect); |
394 | 399 |
395 // Marks a particular level as cleared or uncleared. | 400 // Marks a particular level as cleared or uncleared. |
396 void SetLevelCleared(GLenum target, GLint level, bool cleared); | 401 void SetLevelCleared(GLenum target, GLint level, bool cleared); |
397 | 402 |
| 403 // Only meaningful when the format is DEPTH_STENCIL. |
| 404 // Marks a particular part as cleared or uncleared. |
| 405 void SetLevelCleared(GLenum target, |
| 406 GLint level, |
| 407 GLenum attachment, |
| 408 bool cleared); |
| 409 |
398 // Updates the cleared flag for this texture by inspecting all the mips. | 410 // Updates the cleared flag for this texture by inspecting all the mips. |
399 void UpdateCleared(); | 411 void UpdateCleared(); |
400 | 412 |
401 // Clears any renderable uncleared levels. | 413 // Clears any renderable uncleared levels. |
402 // Returns false if a GL error was generated. | 414 // Returns false if a GL error was generated. |
403 bool ClearRenderableLevels(GLES2Decoder* decoder); | 415 bool ClearRenderableLevels(GLES2Decoder* decoder); |
404 | 416 |
405 // Clears the level. | 417 // Clears the level. |
406 // Returns false if a GL error was generated. | 418 // Returns false if a GL error was generated. |
407 bool ClearLevel(GLES2Decoder* decoder, GLenum target, GLint level); | 419 bool ClearLevel(GLES2Decoder* decoder, GLenum target, GLint level); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // The id of the texture that we are responsible for deleting. Normally, this | 558 // The id of the texture that we are responsible for deleting. Normally, this |
547 // is the same as |service_id_|, unless a GLStreamTextureImage with its own | 559 // is the same as |service_id_|, unless a GLStreamTextureImage with its own |
548 // service id is bound. In that case the GLStreamTextureImage service id is | 560 // service id is bound. In that case the GLStreamTextureImage service id is |
549 // stored in |service_id_| and overrides the owned service id for all purposes | 561 // stored in |service_id_| and overrides the owned service id for all purposes |
550 // except deleting the texture name. | 562 // except deleting the texture name. |
551 GLuint owned_service_id_; | 563 GLuint owned_service_id_; |
552 | 564 |
553 // Whether all renderable mips of this texture have been cleared. | 565 // Whether all renderable mips of this texture have been cleared. |
554 bool cleared_; | 566 bool cleared_; |
555 | 567 |
| 568 // Only meaningful when format is DEPTH_STENCIL. |
| 569 // Whether the depth part of the texture have been cleared. |
| 570 bool depth_cleared_; |
| 571 // Whether the stencil part of the texture have been cleared. |
| 572 bool stencil_cleared_ ; |
| 573 |
556 int num_uncleared_mips_; | 574 int num_uncleared_mips_; |
557 int num_npot_faces_; | 575 int num_npot_faces_; |
558 | 576 |
559 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. | 577 // The target. 0 if unset, otherwise GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP. |
560 // Or GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3). | 578 // Or GL_TEXTURE_2D_ARRAY or GL_TEXTURE_3D (for GLES3). |
561 GLenum target_; | 579 GLenum target_; |
562 | 580 |
563 // Texture parameters. | 581 // Texture parameters. |
564 SamplerState sampler_state_; | 582 SamplerState sampler_state_; |
565 GLenum usage_; | 583 GLenum usage_; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 // Sets |rect| of mip as cleared. | 859 // Sets |rect| of mip as cleared. |
842 void SetLevelClearedRect(TextureRef* ref, | 860 void SetLevelClearedRect(TextureRef* ref, |
843 GLenum target, | 861 GLenum target, |
844 GLint level, | 862 GLint level, |
845 const gfx::Rect& cleared_rect); | 863 const gfx::Rect& cleared_rect); |
846 | 864 |
847 // Sets a mip as cleared. | 865 // Sets a mip as cleared. |
848 void SetLevelCleared(TextureRef* ref, GLenum target, | 866 void SetLevelCleared(TextureRef* ref, GLenum target, |
849 GLint level, bool cleared); | 867 GLint level, bool cleared); |
850 | 868 |
| 869 // Only meaningful when the internal format is DEPTH_STENCIL. |
| 870 // Sets the particular part of the texture as cleared or uncleared. |
| 871 void SetLevelCleared(TextureRef* ref, GLenum target, |
| 872 GLint level, GLenum attachment, bool cleared); |
| 873 |
851 // Sets a texture parameter of a Texture | 874 // Sets a texture parameter of a Texture |
852 // Returns GL_NO_ERROR on success. Otherwise the error to generate. | 875 // Returns GL_NO_ERROR on success. Otherwise the error to generate. |
853 // TODO(gman): Expand to SetParameteriv,fv | 876 // TODO(gman): Expand to SetParameteriv,fv |
854 void SetParameteri( | 877 void SetParameteri( |
855 const char* function_name, ErrorState* error_state, | 878 const char* function_name, ErrorState* error_state, |
856 TextureRef* ref, GLenum pname, GLint param); | 879 TextureRef* ref, GLenum pname, GLint param); |
857 void SetParameterf( | 880 void SetParameterf( |
858 const char* function_name, ErrorState* error_state, | 881 const char* function_name, ErrorState* error_state, |
859 TextureRef* ref, GLenum pname, GLfloat param); | 882 TextureRef* ref, GLenum pname, GLfloat param); |
860 | 883 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 private: | 1217 private: |
1195 DecoderTextureState* texture_state_; | 1218 DecoderTextureState* texture_state_; |
1196 base::TimeTicks begin_time_; | 1219 base::TimeTicks begin_time_; |
1197 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1220 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
1198 }; | 1221 }; |
1199 | 1222 |
1200 } // namespace gles2 | 1223 } // namespace gles2 |
1201 } // namespace gpu | 1224 } // namespace gpu |
1202 | 1225 |
1203 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1226 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |