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

Unified Diff: cc/scheduler/texture_uploader.cc

Issue 27973002: cc: Adding ETC1 support to UIResourceBitmap and ResourceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« cc/resources/ui_resource_bitmap.h ('K') | « cc/scheduler/texture_uploader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/texture_uploader.cc
diff --git a/cc/scheduler/texture_uploader.cc b/cc/scheduler/texture_uploader.cc
index cebc98689118949bb9081a33b215552133db0aa4..ae53e9fd0de2c3622e6e7695403ecf94998eb26e 100644
--- a/cc/scheduler/texture_uploader.cc
+++ b/cc/scheduler/texture_uploader.cc
@@ -186,6 +186,13 @@ void TextureUploader::UploadWithTexSubImage(const uint8* image,
return;
DCHECK(image);
+ // ETC1 textures take a separate path
kaanb 2013/10/18 16:54:49 I don't think you need this comment, the code is s
powei 2013/10/23 05:36:15 Done.
+ if (format == ETC1) {
+ UploadWithTexSubImageETC1(
+ image, image_rect, source_rect, dest_offset, format);
+ return;
+ }
+
// Offset from image-rect to source-rect.
gfx::Vector2d offset(source_rect.origin() - image_rect.origin());
@@ -239,6 +246,8 @@ void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
if (source_rect.IsEmpty())
return;
DCHECK(image);
+ // Compressed textures have no implementation of mapTexSubImage.
+ DCHECK_NE(format, ETC1);
kaanb 2013/10/18 16:54:49 nit: DCHECK_NE(ETC1, format);
powei 2013/10/23 05:36:15 Done.
// Offset from image-rect to source-rect.
gfx::Vector2d offset(source_rect.origin() - image_rect.origin());
@@ -285,6 +294,30 @@ void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
context_->unmapTexSubImage2DCHROMIUM(pixel_dest);
}
+void TextureUploader::UploadWithTexSubImageETC1(const uint8* image,
+ gfx::Rect image_rect,
+ gfx::Rect source_rect,
+ gfx::Vector2d dest_offset,
+ ResourceFormat format) {
+ TRACE_EVENT0("cc", "TextureUploader::UploadWithTexSubImageETC1");
+
+ // ETC1 does not support subimage uploads yet.
+ DCHECK(image_rect == source_rect);
+ DCHECK_EQ(dest_offset.x(), 0);
kaanb 2013/10/18 16:54:49 nit: the first parameter to DCHECK is the expected
powei 2013/10/23 05:36:15 Done.
+ DCHECK_EQ(dest_offset.y(), 0);
+
+ context_->compressedTexSubImage2D(
+ GL_TEXTURE_2D,
+ 0, /* level */
+ 0, /* x */
+ 0, /* y */
+ source_rect.width(),
+ source_rect.height(),
+ GLDataFormat(format),
+ Resource::ETC1SizeInBytes(source_rect.size()),
+ image);
+}
+
void TextureUploader::ProcessQueries() {
while (!pending_queries_.empty()) {
if (pending_queries_.front()->IsPending())
« cc/resources/ui_resource_bitmap.h ('K') | « cc/scheduler/texture_uploader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698