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 gfx::AsyncPixelTransferState* AsyncTransferState() { |
| 180 DCHECK(service_id_ != 0); |
| 181 if (!async_transfer_state_) |
| 182 async_transfer_state_ = |
| 183 gfx::AsyncPixelTransferDelegate::Get()-> |
| 184 CreatePixelTransferState(service_id_); |
| 185 return async_transfer_state_.get(); |
| 186 } |
| 187 |
178 void SetImmutable(bool immutable) { | 188 void SetImmutable(bool immutable) { |
179 immutable_ = immutable; | 189 immutable_ = immutable; |
180 } | 190 } |
181 | 191 |
182 bool IsImmutable() { | 192 bool IsImmutable() { |
183 return immutable_; | 193 return immutable_; |
184 } | 194 } |
185 | 195 |
186 // Whether a particular level/face is cleared. | 196 // Whether a particular level/face is cleared. |
187 bool IsLevelCleared(GLenum target, GLint level); | 197 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. | 340 // The number of framebuffers this texture is attached to. |
331 int framebuffer_attachment_count_; | 341 int framebuffer_attachment_count_; |
332 | 342 |
333 // Whether the associated context group owns this texture and should delete | 343 // Whether the associated context group owns this texture and should delete |
334 // it. | 344 // it. |
335 bool owned_; | 345 bool owned_; |
336 | 346 |
337 // Whether this is a special streaming texture. | 347 // Whether this is a special streaming texture. |
338 bool stream_texture_; | 348 bool stream_texture_; |
339 | 349 |
| 350 // State to facilitate async transfers on this texture. |
| 351 scoped_refptr<gfx::AsyncPixelTransferState> async_transfer_state_; |
| 352 |
340 // Whether the texture is immutable and no further changes to the format | 353 // Whether the texture is immutable and no further changes to the format |
341 // or dimensions of the texture object can be made. | 354 // or dimensions of the texture object can be made. |
342 bool immutable_; | 355 bool immutable_; |
343 | 356 |
344 // Size in bytes this texture is assumed to take in memory. | 357 // Size in bytes this texture is assumed to take in memory. |
345 uint32 estimated_size_; | 358 uint32 estimated_size_; |
346 | 359 |
347 DISALLOW_COPY_AND_ASSIGN(TextureInfo); | 360 DISALLOW_COPY_AND_ASSIGN(TextureInfo); |
348 }; | 361 }; |
349 | 362 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // The default textures for each target (texture name = 0) | 579 // The default textures for each target (texture name = 0) |
567 TextureInfo::Ref default_textures_[kNumDefaultTextures]; | 580 TextureInfo::Ref default_textures_[kNumDefaultTextures]; |
568 | 581 |
569 DISALLOW_COPY_AND_ASSIGN(TextureManager); | 582 DISALLOW_COPY_AND_ASSIGN(TextureManager); |
570 }; | 583 }; |
571 | 584 |
572 } // namespace gles2 | 585 } // namespace gles2 |
573 } // namespace gpu | 586 } // namespace gpu |
574 | 587 |
575 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 588 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |