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

Unified Diff: cc/resources/texture_uploader.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « cc/resources/scoped_resource_unittest.cc ('k') | cc/resources/tile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/texture_uploader.cc
diff --git a/cc/resources/texture_uploader.cc b/cc/resources/texture_uploader.cc
index 601fa8fbff89de41c26075cf1be5d97dff61fdd3..3d0f68163c955969364e1abc519a1dd4a7304f1f 100644
--- a/cc/resources/texture_uploader.cc
+++ b/cc/resources/texture_uploader.cc
@@ -146,7 +146,14 @@ void TextureUploader::Upload(const uint8* image,
if (is_full_upload)
BeginQuery();
- UploadWithMapTexSubImage(image, image_rect, source_rect, dest_offset, format);
+ if (format == ETC1) {
+ // ETC1 does not support subimage uploads.
+ DCHECK(is_full_upload);
+ UploadWithTexImageETC1(image, size);
+ } else {
+ UploadWithMapTexSubImage(
+ image, image_rect, source_rect, dest_offset, format);
+ }
if (is_full_upload)
EndQuery();
@@ -284,6 +291,22 @@ void TextureUploader::UploadWithMapTexSubImage(const uint8* image,
gl_->UnmapTexSubImage2DCHROMIUM(pixel_dest);
}
+void TextureUploader::UploadWithTexImageETC1(const uint8* image,
+ const gfx::Size& size) {
+ TRACE_EVENT0("cc", "TextureUploader::UploadWithTexImageETC1");
+ DCHECK_EQ(0, size.width() % 4);
+ DCHECK_EQ(0, size.height() % 4);
+
+ gl_->CompressedTexImage2D(GL_TEXTURE_2D,
+ 0,
+ GLInternalFormat(ETC1),
+ size.width(),
+ size.height(),
+ 0,
+ Resource::MemorySizeBytes(size, ETC1),
+ image);
+}
+
void TextureUploader::ProcessQueries() {
while (!pending_queries_.empty()) {
if (pending_queries_.front()->IsPending())
« no previous file with comments | « cc/resources/scoped_resource_unittest.cc ('k') | cc/resources/tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698