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

Unified Diff: cc/resources/resource_provider.cc

Issue 21159007: cc: Adding support for RGBA_4444 tile textures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to 4_4_4_4 textures in RP Created 7 years, 4 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
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 11eaab07a287c4d3282aa24e8a17c9dda2da8ef9..e788aa8a80b9ab07122c4d2f0e1499cde40f8537 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());
@@ -1039,6 +1049,7 @@ void ResourceProvider::ReleasePixelBuffer(ResourceId id) {
}
uint8_t* ResourceProvider::MapPixelBuffer(ResourceId id) {
+ LOG(ERROR) << "KAANB: MapPixelBuffer!!!!!!!!!!!!!!!!!!!!!!!!";
DCHECK(thread_checker_.CalledOnValidThread());
ResourceMap::iterator it = resources_.find(id);
CHECK(it != resources_.end());
@@ -1173,6 +1184,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 */
@@ -1181,7 +1194,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,
@@ -1191,7 +1204,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);
@@ -1314,6 +1327,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,
@@ -1321,7 +1336,7 @@ void ResourceProvider::LazyAllocate(Resource* resource) {
size.height(),
0,
format,
- GL_UNSIGNED_BYTE,
+ texture_data_type,
NULL));
}
}

Powered by Google App Engine
This is Rietveld 408576698