| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 bool CanRenderTo() const { | 74 bool CanRenderTo() const { |
| 75 return !stream_texture_ && target_ != GL_TEXTURE_EXTERNAL_OES; | 75 return !stream_texture_ && target_ != GL_TEXTURE_EXTERNAL_OES; |
| 76 } | 76 } |
| 77 | 77 |
| 78 // The service side OpenGL id of the texture. | 78 // The service side OpenGL id of the texture. |
| 79 GLuint service_id() const { | 79 GLuint service_id() const { |
| 80 return service_id_; | 80 return service_id_; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void SetServiceId(GLuint service_id) { | 83 void SetServiceId(GLuint service_id) { |
| 84 DCHECK(service_id); |
| 84 service_id_ = service_id; | 85 service_id_ = service_id; |
| 85 } | 86 } |
| 86 | 87 |
| 87 // Returns the target this texure was first bound to or 0 if it has not | 88 // Returns the target this texure was first bound to or 0 if it has not |
| 88 // been bound. Once a texture is bound to a specific target it can never be | 89 // been bound. Once a texture is bound to a specific target it can never be |
| 89 // bound to a different target. | 90 // bound to a different target. |
| 90 GLenum target() const { | 91 GLenum target() const { |
| 91 return target_; | 92 return target_; |
| 92 } | 93 } |
| 93 | 94 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 117 GLint yoffset, | 118 GLint yoffset, |
| 118 GLsizei width, | 119 GLsizei width, |
| 119 GLsizei height, | 120 GLsizei height, |
| 120 GLenum format, | 121 GLenum format, |
| 121 GLenum type) const; | 122 GLenum type) const; |
| 122 | 123 |
| 123 bool IsValid() const { | 124 bool IsValid() const { |
| 124 return !!target(); | 125 return !!target(); |
| 125 } | 126 } |
| 126 | 127 |
| 127 void SetNotOwned() { | |
| 128 owned_ = false; | |
| 129 } | |
| 130 | |
| 131 bool IsAttachedToFramebuffer() const { | 128 bool IsAttachedToFramebuffer() const { |
| 132 return framebuffer_attachment_count_ != 0; | 129 return framebuffer_attachment_count_ != 0; |
| 133 } | 130 } |
| 134 | 131 |
| 135 void AttachToFramebuffer() { | 132 void AttachToFramebuffer() { |
| 136 ++framebuffer_attachment_count_; | 133 ++framebuffer_attachment_count_; |
| 137 } | 134 } |
| 138 | 135 |
| 139 void DetachFromFramebuffer() { | 136 void DetachFromFramebuffer() { |
| 140 DCHECK_GT(framebuffer_attachment_count_, 0); | 137 DCHECK_GT(framebuffer_attachment_count_, 0); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 358 |
| 362 // Whether or not this texture is non-power-of-two | 359 // Whether or not this texture is non-power-of-two |
| 363 bool npot_; | 360 bool npot_; |
| 364 | 361 |
| 365 // Whether this texture has ever been bound. | 362 // Whether this texture has ever been bound. |
| 366 bool has_been_bound_; | 363 bool has_been_bound_; |
| 367 | 364 |
| 368 // The number of framebuffers this texture is attached to. | 365 // The number of framebuffers this texture is attached to. |
| 369 int framebuffer_attachment_count_; | 366 int framebuffer_attachment_count_; |
| 370 | 367 |
| 371 // Whether the associated context group owns this texture and should delete | |
| 372 // it. | |
| 373 bool owned_; | |
| 374 | |
| 375 // Whether this is a special streaming texture. | 368 // Whether this is a special streaming texture. |
| 376 bool stream_texture_; | 369 bool stream_texture_; |
| 377 | 370 |
| 378 // Whether the texture is immutable and no further changes to the format | 371 // Whether the texture is immutable and no further changes to the format |
| 379 // or dimensions of the texture object can be made. | 372 // or dimensions of the texture object can be made. |
| 380 bool immutable_; | 373 bool immutable_; |
| 381 | 374 |
| 382 // Size in bytes this texture is assumed to take in memory. | 375 // Size in bytes this texture is assumed to take in memory. |
| 383 uint32 estimated_size_; | 376 uint32 estimated_size_; |
| 384 | 377 |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 | 702 |
| 710 ObserverList<DestructionObserver> destruction_observers_; | 703 ObserverList<DestructionObserver> destruction_observers_; |
| 711 | 704 |
| 712 DISALLOW_COPY_AND_ASSIGN(TextureManager); | 705 DISALLOW_COPY_AND_ASSIGN(TextureManager); |
| 713 }; | 706 }; |
| 714 | 707 |
| 715 } // namespace gles2 | 708 } // namespace gles2 |
| 716 } // namespace gpu | 709 } // namespace gpu |
| 717 | 710 |
| 718 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 711 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |