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* GetAsyncTransferState() const { | |
180 return async_transfer_state_.get(); | |
181 } | |
182 void SetAsyncTransferState(gfx::AsyncPixelTransferState* state) { | |
183 async_transfer_state_ = state; | |
184 } | |
185 bool AsyncTransferIsInProgress() { | |
186 return async_transfer_state_ | |
greggman
2012/12/12 03:51:36
style: operators want to be at the end of the line
epennerAtGoogle
2012/12/12 04:49:49
Done.
| |
187 && async_transfer_state_->TransferIsInProgress(); | |
188 } | |
189 bool BindAsyncTransferToTexture(GLenum target) { | |
190 DCHECK(async_transfer_state_); | |
greggman
2012/12/12 03:51:36
It seems like this DCHECK is in conflict with the
epennerAtGoogle
2012/12/12 04:49:49
Done.
| |
191 if (async_transfer_state_) | |
192 return async_transfer_state_->BindAsyncTransferToTexture(target); | |
193 return false; | |
194 } | |
195 | |
178 void SetImmutable(bool immutable) { | 196 void SetImmutable(bool immutable) { |
179 immutable_ = immutable; | 197 immutable_ = immutable; |
180 } | 198 } |
181 | 199 |
182 bool IsImmutable() { | 200 bool IsImmutable() { |
183 return immutable_; | 201 return immutable_; |
184 } | 202 } |
185 | 203 |
186 // Whether a particular level/face is cleared. | 204 // Whether a particular level/face is cleared. |
187 bool IsLevelCleared(GLenum target, GLint level); | 205 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. | 348 // The number of framebuffers this texture is attached to. |
331 int framebuffer_attachment_count_; | 349 int framebuffer_attachment_count_; |
332 | 350 |
333 // Whether the associated context group owns this texture and should delete | 351 // Whether the associated context group owns this texture and should delete |
334 // it. | 352 // it. |
335 bool owned_; | 353 bool owned_; |
336 | 354 |
337 // Whether this is a special streaming texture. | 355 // Whether this is a special streaming texture. |
338 bool stream_texture_; | 356 bool stream_texture_; |
339 | 357 |
358 // State to facilitate async transfers on this texture. | |
359 scoped_refptr<gfx::AsyncPixelTransferState> async_transfer_state_; | |
360 | |
340 // Whether the texture is immutable and no further changes to the format | 361 // Whether the texture is immutable and no further changes to the format |
341 // or dimensions of the texture object can be made. | 362 // or dimensions of the texture object can be made. |
342 bool immutable_; | 363 bool immutable_; |
343 | 364 |
344 // Size in bytes this texture is assumed to take in memory. | 365 // Size in bytes this texture is assumed to take in memory. |
345 uint32 estimated_size_; | 366 uint32 estimated_size_; |
346 | 367 |
347 DISALLOW_COPY_AND_ASSIGN(TextureInfo); | 368 DISALLOW_COPY_AND_ASSIGN(TextureInfo); |
348 }; | 369 }; |
349 | 370 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 // The default textures for each target (texture name = 0) | 589 // The default textures for each target (texture name = 0) |
569 TextureInfo::Ref default_textures_[kNumDefaultTextures]; | 590 TextureInfo::Ref default_textures_[kNumDefaultTextures]; |
570 | 591 |
571 DISALLOW_COPY_AND_ASSIGN(TextureManager); | 592 DISALLOW_COPY_AND_ASSIGN(TextureManager); |
572 }; | 593 }; |
573 | 594 |
574 } // namespace gles2 | 595 } // namespace gles2 |
575 } // namespace gpu | 596 } // namespace gpu |
576 | 597 |
577 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 598 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
OLD | NEW |