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

Unified Diff: cc/resources/resource_provider.cc

Issue 499283002: gpu: support immutable texture on Linux Mesa driver and GLES3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CompleteHandlingOfGLESandBGRA. Apply CC Created 6 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
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index c936154d95c073d3e652a58f2cfdd46db945222f..067dc9849a05032e7bdff119c8522db244b3166e 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -81,11 +81,12 @@ GLenum TextureToStorageFormat(ResourceFormat format) {
return storage_format;
}
-bool IsFormatSupportedForStorage(ResourceFormat format) {
+bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) {
switch (format) {
case RGBA_8888:
- case BGRA_8888:
return true;
+ case BGRA_8888:
+ return use_bgra;
case RGBA_4444:
case ALPHA_8:
case LUMINANCE_8:
@@ -1239,6 +1240,7 @@ ResourceProvider::ResourceProvider(OutputSurface* output_surface,
next_child_(1),
default_resource_type_(InvalidType),
use_texture_storage_ext_(false),
+ use_texture_format_bgra_(false),
use_texture_usage_hint_(false),
use_compressed_texture_etc1_(false),
max_texture_size_(0),
@@ -1277,6 +1279,7 @@ void ResourceProvider::InitializeGL() {
bool use_bgra = caps.gpu.texture_format_bgra8888;
use_texture_storage_ext_ = caps.gpu.texture_storage;
+ use_texture_format_bgra_ = caps.gpu.texture_format_bgra8888;
use_texture_usage_hint_ = caps.gpu.texture_usage;
use_compressed_texture_etc1_ = caps.gpu.texture_format_etc1;
use_sync_query_ = caps.gpu.sync_query;
@@ -2099,7 +2102,8 @@ void ResourceProvider::LazyAllocate(Resource* resource) {
DCHECK_EQ(resource->target, static_cast<GLenum>(GL_TEXTURE_2D));
ResourceFormat format = resource->format;
GLC(gl, gl->BindTexture(GL_TEXTURE_2D, resource->gl_id));
- if (use_texture_storage_ext_ && IsFormatSupportedForStorage(format) &&
+ if (use_texture_storage_ext_ &&
+ IsFormatSupportedForStorage(format, use_texture_format_bgra_) &&
(resource->hint & TextureHintImmutable)) {
GLenum storage_format = TextureToStorageFormat(format);
GLC(gl,
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698