Index: cc/resources/resource_provider.cc |
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc |
index 6d6ac9d839871002e9facb7e84546a56bd32be29..d78875755fd96de8753dc0ad81a53ca753c977d6 100644 |
--- a/cc/resources/resource_provider.cc |
+++ b/cc/resources/resource_provider.cc |
@@ -7,6 +7,10 @@ |
#include <algorithm> |
#include <limits> |
+#if defined(OS_ANDROID) |
+#include "base/android/sys_utils.h" |
+#endif |
+ |
#include "base/containers/hash_tables.h" |
#include "base/debug/alias.h" |
#include "base/stl_util.h" |
@@ -685,7 +689,13 @@ ResourceProvider::ResourceProvider(OutputSurface* output_surface, |
use_texture_usage_hint_(false), |
use_shallow_flush_(false), |
max_texture_size_(0), |
- best_texture_format_(0) {} |
+ best_texture_format_(0), |
+ use_16bit_textures_(false) { |
+#if defined(OS_ANDROID) |
+ if (base::android::SysUtils::IsLowEndDevice()) |
+ use_16bit_textures_ = true; |
+#endif |
+} |
void ResourceProvider::InitializeSoftware() { |
DCHECK(thread_checker_.CalledOnValidThread()); |
@@ -1175,6 +1185,8 @@ void ResourceProvider::BeginSetPixels(ResourceId id) { |
context3d->beginQueryEXT( |
GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM, |
resource->gl_upload_query_id); |
+ GLenum texture_data_type = use_16bit_textures_ |
+ ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_BYTE; |
if (allocate) { |
context3d->asyncTexImage2DCHROMIUM(GL_TEXTURE_2D, |
0, /* level */ |
@@ -1183,7 +1195,7 @@ void ResourceProvider::BeginSetPixels(ResourceId id) { |
resource->size.height(), |
0, /* border */ |
resource->format, |
- GL_UNSIGNED_BYTE, |
+ texture_data_type, |
NULL); |
} else { |
context3d->asyncTexSubImage2DCHROMIUM(GL_TEXTURE_2D, |
@@ -1193,7 +1205,7 @@ void ResourceProvider::BeginSetPixels(ResourceId id) { |
resource->size.width(), |
resource->size.height(), |
resource->format, |
- GL_UNSIGNED_BYTE, |
+ texture_data_type, |
NULL); |
} |
context3d->endQueryEXT(GL_ASYNC_PIXEL_TRANSFERS_COMPLETED_CHROMIUM); |
@@ -1316,6 +1328,8 @@ void ResourceProvider::LazyAllocate(Resource* resource) { |
size.width(), |
size.height())); |
} else { |
+ GLenum texture_data_type = use_16bit_textures_ |
+ ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_BYTE; |
GLC(context3d, context3d->texImage2D(GL_TEXTURE_2D, |
0, |
format, |
@@ -1323,7 +1337,7 @@ void ResourceProvider::LazyAllocate(Resource* resource) { |
size.height(), |
0, |
format, |
- GL_UNSIGNED_BYTE, |
+ texture_data_type, |
Sami
2013/08/08 10:11:01
This parameter only sets the format of the data th
kaanb
2013/08/08 17:25:05
See the comment on RGBA4_OES above.
|
NULL)); |
} |
} |