Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: cc/scheduler/texture_uploader.h

Issue 27973002: cc: Adding ETC1 support to UIResourceBitmap and ResourceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments, added test, dcheck for compressed texture availability Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
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 {
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 return make_scoped_ptr( 32 bool use_compressed_texture_etc1) {
33 new TextureUploader(context, use_map_tex_sub_image, use_shallow_flush)); 33 return make_scoped_ptr(new TextureUploader(context,
34 use_map_tex_sub_image,
35 use_shallow_flush,
36 use_compressed_texture_etc1));
34 } 37 }
35 ~TextureUploader(); 38 ~TextureUploader();
36 39
37 size_t NumBlockingUploads(); 40 size_t NumBlockingUploads();
38 void MarkPendingUploadsAsNonBlocking(); 41 void MarkPendingUploadsAsNonBlocking();
39 double EstimatedTexturesPerSecond(); 42 double EstimatedTexturesPerSecond();
40 43
41 // Let content_rect be a rectangle, and let content_rect be a sub-rectangle of 44 // 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 45 // 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 46 // 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
80 unsigned query_id_; 83 unsigned query_id_;
81 unsigned value_; 84 unsigned value_;
82 bool has_value_; 85 bool has_value_;
83 bool is_non_blocking_; 86 bool is_non_blocking_;
84 87
85 DISALLOW_COPY_AND_ASSIGN(Query); 88 DISALLOW_COPY_AND_ASSIGN(Query);
86 }; 89 };
87 90
88 TextureUploader(WebKit::WebGraphicsContext3D* context, 91 TextureUploader(WebKit::WebGraphicsContext3D* context,
89 bool use_map_tex_sub_image, 92 bool use_map_tex_sub_image,
90 bool use_shallow_flush); 93 bool use_shallow_flush,
94 bool use_compressed_texture_etc1);
91 95
92 void BeginQuery(); 96 void BeginQuery();
93 void EndQuery(); 97 void EndQuery();
94 void ProcessQueries(); 98 void ProcessQueries();
95 99
96 void UploadWithTexSubImage(const uint8* image, 100 void UploadWithTexSubImage(const uint8* image,
97 gfx::Rect image_rect, 101 gfx::Rect image_rect,
98 gfx::Rect source_rect, 102 gfx::Rect source_rect,
99 gfx::Vector2d dest_offset, 103 gfx::Vector2d dest_offset,
100 ResourceFormat format); 104 ResourceFormat format);
101 void UploadWithMapTexSubImage(const uint8* image, 105 void UploadWithMapTexSubImage(const uint8* image,
102 gfx::Rect image_rect, 106 gfx::Rect image_rect,
103 gfx::Rect source_rect, 107 gfx::Rect source_rect,
104 gfx::Vector2d dest_offset, 108 gfx::Vector2d dest_offset,
105 ResourceFormat format); 109 ResourceFormat format);
110 void UploadWithTexSubImageETC1(const uint8* image,
111 gfx::Rect image_rect,
112 gfx::Rect source_rect,
113 gfx::Vector2d dest_offset,
114 ResourceFormat format);
106 115
107 WebKit::WebGraphicsContext3D* context_; 116 WebKit::WebGraphicsContext3D* context_;
108 ScopedPtrDeque<Query> pending_queries_; 117 ScopedPtrDeque<Query> pending_queries_;
109 ScopedPtrDeque<Query> available_queries_; 118 ScopedPtrDeque<Query> available_queries_;
110 std::multiset<double> textures_per_second_history_; 119 std::multiset<double> textures_per_second_history_;
111 size_t num_blocking_texture_uploads_; 120 size_t num_blocking_texture_uploads_;
112 121
113 bool use_map_tex_sub_image_; 122 bool use_map_tex_sub_image_;
114 size_t sub_image_size_; 123 size_t sub_image_size_;
115 scoped_ptr<uint8[]> sub_image_; 124 scoped_ptr<uint8[]> sub_image_;
116 125
117 bool use_shallow_flush_; 126 bool use_shallow_flush_;
118 size_t num_texture_uploads_since_last_flush_; 127 size_t num_texture_uploads_since_last_flush_;
119 128
129 bool use_compressed_texture_etc1_;
130
120 DISALLOW_COPY_AND_ASSIGN(TextureUploader); 131 DISALLOW_COPY_AND_ASSIGN(TextureUploader);
121 }; 132 };
122 133
123 } // namespace cc 134 } // namespace cc
124 135
125 #endif // CC_SCHEDULER_TEXTURE_UPLOADER_H_ 136 #endif // CC_SCHEDULER_TEXTURE_UPLOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698