Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "gpu/command_buffer/service/feature_info.h" | 14 #include "gpu/command_buffer/service/feature_info.h" |
| 15 #include "gpu/command_buffer/service/gl_utils.h" | 15 #include "gpu/command_buffer/service/gl_utils.h" |
| 16 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
| 17 #include "ui/gl/async_pixel_transfer_delegate.h" | |
| 17 #include "ui/gl/gl_image.h" | 18 #include "ui/gl/gl_image.h" |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 namespace gles2 { | 21 namespace gles2 { |
| 21 | 22 |
| 22 class GLES2Decoder; | 23 class GLES2Decoder; |
| 23 class Display; | 24 class Display; |
| 24 class TextureDefinition; | 25 class TextureDefinition; |
| 25 class MemoryTracker; | 26 class MemoryTracker; |
| 26 class MemoryTypeTracker; | 27 class MemoryTypeTracker; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 } | 169 } |
| 169 | 170 |
| 170 void SetStreamTexture(bool stream_texture) { | 171 void SetStreamTexture(bool stream_texture) { |
| 171 stream_texture_ = stream_texture; | 172 stream_texture_ = stream_texture; |
| 172 } | 173 } |
| 173 | 174 |
| 174 int IsStreamTexture() { | 175 int IsStreamTexture() { |
| 175 return stream_texture_; | 176 return stream_texture_; |
| 176 } | 177 } |
| 177 | 178 |
| 179 bool IsAsyncTransferTexture() { | |
| 180 return !!async_transfer_state_; | |
| 181 } | |
| 182 | |
| 183 bool AsyncTransferIsInProgress() { | |
| 184 return async_transfer_state_ | |
| 185 && async_transfer_state_->TransferIsInProgress(); | |
| 186 } | |
| 187 | |
| 188 void BindAsyncTransferTexture(GLenum target) { | |
| 189 DCHECK(async_transfer_state_); | |
| 190 if (async_transfer_state_) | |
| 191 async_transfer_state_->BindTexture(target); | |
| 192 } | |
| 193 | |
| 194 gfx::AsyncPixelTransferState* AsyncTransferState() { | |
| 195 DCHECK(service_id_ != 0); | |
| 196 if (!async_transfer_state_) | |
|
apatrick_chromium
2012/12/04 20:59:22
nit: chromium style is to use braces for body of i
epennerAtGoogle
2012/12/06 06:23:21
Done.
| |
| 197 async_transfer_state_ = | |
| 198 gfx::AsyncPixelTransferDelegate::Get()-> | |
| 199 CreatePixelTransferState(service_id_); | |
| 200 return async_transfer_state_.get(); | |
| 201 } | |
| 202 | |
| 178 void SetImmutable(bool immutable) { | 203 void SetImmutable(bool immutable) { |
| 179 immutable_ = immutable; | 204 immutable_ = immutable; |
| 180 } | 205 } |
| 181 | 206 |
| 182 bool IsImmutable() { | 207 bool IsImmutable() { |
| 183 return immutable_; | 208 return immutable_; |
| 184 } | 209 } |
| 185 | 210 |
| 186 // Whether a particular level/face is cleared. | 211 // Whether a particular level/face is cleared. |
| 187 bool IsLevelCleared(GLenum target, GLint level); | 212 bool IsLevelCleared(GLenum target, GLint level); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 // The number of framebuffers this texture is attached to. | 355 // The number of framebuffers this texture is attached to. |
| 331 int framebuffer_attachment_count_; | 356 int framebuffer_attachment_count_; |
| 332 | 357 |
| 333 // Whether the associated context group owns this texture and should delete | 358 // Whether the associated context group owns this texture and should delete |
| 334 // it. | 359 // it. |
| 335 bool owned_; | 360 bool owned_; |
| 336 | 361 |
| 337 // Whether this is a special streaming texture. | 362 // Whether this is a special streaming texture. |
| 338 bool stream_texture_; | 363 bool stream_texture_; |
| 339 | 364 |
| 365 // State to facilitate async transfers on this texture. | |
| 366 scoped_refptr<gfx::AsyncPixelTransferState> async_transfer_state_; | |
| 367 | |
| 340 // Whether the texture is immutable and no further changes to the format | 368 // Whether the texture is immutable and no further changes to the format |
| 341 // or dimensions of the texture object can be made. | 369 // or dimensions of the texture object can be made. |
| 342 bool immutable_; | 370 bool immutable_; |
| 343 | 371 |
| 344 // Size in bytes this texture is assumed to take in memory. | 372 // Size in bytes this texture is assumed to take in memory. |
| 345 uint32 estimated_size_; | 373 uint32 estimated_size_; |
| 346 | 374 |
| 347 DISALLOW_COPY_AND_ASSIGN(TextureInfo); | 375 DISALLOW_COPY_AND_ASSIGN(TextureInfo); |
| 348 }; | 376 }; |
| 349 | 377 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 // The default textures for each target (texture name = 0) | 594 // The default textures for each target (texture name = 0) |
| 567 TextureInfo::Ref default_textures_[kNumDefaultTextures]; | 595 TextureInfo::Ref default_textures_[kNumDefaultTextures]; |
| 568 | 596 |
| 569 DISALLOW_COPY_AND_ASSIGN(TextureManager); | 597 DISALLOW_COPY_AND_ASSIGN(TextureManager); |
| 570 }; | 598 }; |
| 571 | 599 |
| 572 } // namespace gles2 | 600 } // namespace gles2 |
| 573 } // namespace gpu | 601 } // namespace gpu |
| 574 | 602 |
| 575 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 603 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |