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

Unified Diff: cc/resources/resource_provider.cc

Issue 2242453002: Avoid planar YUV resources when one component EGL images are not supported (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Abstract out resource immutability. Created 4 years, 3 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/video_resource_updater.h » ('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 2ebeb8d37944913bcf16b76d7e0a3a218dbddf1d..a027db8814a34f7ab4e5c11d59c4f6963b370948 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -445,10 +445,15 @@ ResourceProvider::ResourceProvider(
use_texture_format_bgra_ = caps.texture_format_bgra8888;
use_texture_usage_hint_ = caps.texture_usage;
use_compressed_texture_etc1_ = caps.texture_format_etc1;
- yuv_resource_format_ = caps.texture_rg ? RED_8 : LUMINANCE_8;
- yuv_highbit_resource_format_ = yuv_resource_format_;
- if (caps.texture_half_float_linear)
- yuv_highbit_resource_format_ = LUMINANCE_F16;
+
+ if (caps.disable_one_component_textures) {
+ yuv_resource_format_ = yuv_highbit_resource_format_ = RGBA_8888;
+ } else {
+ yuv_resource_format_ = caps.texture_rg ? RED_8 : LUMINANCE_8;
+ yuv_highbit_resource_format_ =
+ caps.texture_half_float_linear ? LUMINANCE_F16 : yuv_resource_format_;
+ }
+
use_sync_query_ = caps.sync_query;
GLES2Interface* gl = ContextGL();
@@ -816,6 +821,16 @@ GLenum ResourceProvider::GetResourceTextureTarget(ResourceId id) {
return GetResource(id)->target;
}
+bool ResourceProvider::IsImmutable(ResourceId id) {
+ if (IsGpuResourceType(default_resource_type_)) {
+ return GetTextureHint(id) == TEXTURE_HINT_IMMUTABLE;
+ } else {
+ // Software resources are immutable; they cannot change format or be
+ // resized.
+ return true;
+ }
+}
+
ResourceProvider::TextureHint ResourceProvider::GetTextureHint(ResourceId id) {
return GetResource(id)->hint;
}
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/video_resource_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698