Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_SCHEDULER_TEXTURE_UPLOADER_H_ | 5 #ifndef CC_SCHEDULER_TEXTURE_UPLOADER_H_ |
| 6 #define CC_SCHEDULER_TEXTURE_UPLOADER_H_ | 6 #define CC_SCHEDULER_TEXTURE_UPLOADER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 #include "cc/base/scoped_ptr_deque.h" | 13 #include "cc/base/scoped_ptr_deque.h" |
| 14 #include "third_party/khronos/GLES2/gl2.h" | 14 #include "third_party/khronos/GLES2/gl2.h" |
| 15 | 15 |
| 16 namespace WebKit { class WebGraphicsContext3D; } | 16 namespace WebKit { class WebGraphicsContext3D; } |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Rect; | 19 class Rect; |
| 20 class Size; | 20 class Size; |
| 21 class Vector2d; | 21 class Vector2d; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace cc { | 24 namespace cc { |
| 25 | 25 |
| 26 class CC_EXPORT TextureUploader { | 26 class CC_EXPORT TextureUploader { |
|
reveman
2013/09/05 16:24:17
Do we need support for this in the old uploader? C
kaanb
2013/09/06 02:05:54
Raster-on-demand still uses this class. Otherwise
| |
| 27 public: | 27 public: |
| 28 static scoped_ptr<TextureUploader> Create( | 28 static scoped_ptr<TextureUploader> Create( |
| 29 WebKit::WebGraphicsContext3D* context, | 29 WebKit::WebGraphicsContext3D* context, |
| 30 bool use_map_tex_sub_image, | 30 bool use_map_tex_sub_image, |
| 31 bool use_shallow_flush) { | 31 bool use_shallow_flush, |
| 32 bool use_16_bit_textures) { | |
| 32 return make_scoped_ptr( | 33 return make_scoped_ptr( |
| 33 new TextureUploader(context, use_map_tex_sub_image, use_shallow_flush)); | 34 new TextureUploader(context, |
| 35 use_map_tex_sub_image, | |
| 36 use_shallow_flush, | |
| 37 use_16_bit_textures)); | |
| 34 } | 38 } |
| 35 ~TextureUploader(); | 39 ~TextureUploader(); |
| 36 | 40 |
| 37 size_t NumBlockingUploads(); | 41 size_t NumBlockingUploads(); |
| 38 void MarkPendingUploadsAsNonBlocking(); | 42 void MarkPendingUploadsAsNonBlocking(); |
| 39 double EstimatedTexturesPerSecond(); | 43 double EstimatedTexturesPerSecond(); |
| 40 | 44 |
| 41 // Let content_rect be a rectangle, and let content_rect be a sub-rectangle of | 45 // Let content_rect be a rectangle, and let content_rect be a sub-rectangle of |
| 42 // content_rect, expressed in the same coordinate system as content_rect. Let | 46 // content_rect, expressed in the same coordinate system as content_rect. Let |
| 43 // image be a buffer for content_rect. This function will copy the region | 47 // image be a buffer for content_rect. This function will copy the region |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 unsigned query_id_; | 84 unsigned query_id_; |
| 81 unsigned value_; | 85 unsigned value_; |
| 82 bool has_value_; | 86 bool has_value_; |
| 83 bool is_non_blocking_; | 87 bool is_non_blocking_; |
| 84 | 88 |
| 85 DISALLOW_COPY_AND_ASSIGN(Query); | 89 DISALLOW_COPY_AND_ASSIGN(Query); |
| 86 }; | 90 }; |
| 87 | 91 |
| 88 TextureUploader(WebKit::WebGraphicsContext3D* context, | 92 TextureUploader(WebKit::WebGraphicsContext3D* context, |
| 89 bool use_map_tex_sub_image, | 93 bool use_map_tex_sub_image, |
| 90 bool use_shallow_flush); | 94 bool use_shallow_flush, |
| 95 bool use_16_bit_textures); | |
| 91 | 96 |
| 92 void BeginQuery(); | 97 void BeginQuery(); |
| 93 void EndQuery(); | 98 void EndQuery(); |
| 94 void ProcessQueries(); | 99 void ProcessQueries(); |
| 95 | 100 |
| 96 void UploadWithTexSubImage(const uint8* image, | 101 void UploadWithTexSubImage(const uint8* image, |
| 97 gfx::Rect image_rect, | 102 gfx::Rect image_rect, |
| 98 gfx::Rect source_rect, | 103 gfx::Rect source_rect, |
| 99 gfx::Vector2d dest_offset, | 104 gfx::Vector2d dest_offset, |
| 100 GLenum format); | 105 GLenum format); |
| 101 void UploadWithMapTexSubImage(const uint8* image, | 106 void UploadWithMapTexSubImage(const uint8* image, |
| 102 gfx::Rect image_rect, | 107 gfx::Rect image_rect, |
| 103 gfx::Rect source_rect, | 108 gfx::Rect source_rect, |
| 104 gfx::Vector2d dest_offset, | 109 gfx::Vector2d dest_offset, |
| 105 GLenum format); | 110 GLenum format); |
| 106 | 111 |
| 107 WebKit::WebGraphicsContext3D* context_; | 112 WebKit::WebGraphicsContext3D* context_; |
| 108 ScopedPtrDeque<Query> pending_queries_; | 113 ScopedPtrDeque<Query> pending_queries_; |
| 109 ScopedPtrDeque<Query> available_queries_; | 114 ScopedPtrDeque<Query> available_queries_; |
| 110 std::multiset<double> textures_per_second_history_; | 115 std::multiset<double> textures_per_second_history_; |
| 111 size_t num_blocking_texture_uploads_; | 116 size_t num_blocking_texture_uploads_; |
| 112 | 117 |
| 113 bool use_map_tex_sub_image_; | 118 bool use_map_tex_sub_image_; |
| 114 size_t sub_image_size_; | 119 size_t sub_image_size_; |
| 115 scoped_ptr<uint8[]> sub_image_; | 120 scoped_ptr<uint8[]> sub_image_; |
| 116 | 121 |
| 117 bool use_shallow_flush_; | 122 bool use_shallow_flush_; |
| 118 size_t num_texture_uploads_since_last_flush_; | 123 size_t num_texture_uploads_since_last_flush_; |
| 124 bool use_16_bit_textures_; | |
| 119 | 125 |
| 120 DISALLOW_COPY_AND_ASSIGN(TextureUploader); | 126 DISALLOW_COPY_AND_ASSIGN(TextureUploader); |
| 121 }; | 127 }; |
| 122 | 128 |
| 123 } // namespace cc | 129 } // namespace cc |
| 124 | 130 |
| 125 #endif // CC_SCHEDULER_TEXTURE_UPLOADER_H_ | 131 #endif // CC_SCHEDULER_TEXTURE_UPLOADER_H_ |
| OLD | NEW |