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

Unified Diff: cc/resources/resource_provider.cc

Issue 2775723002: Enable RGBA_4444 in GpuRasterBufferProvider (Closed)
Patch Set: comment Created 3 years, 9 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/test/layer_tree_pixel_resource_test.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 e7d309db8a964fa061bd76ef29ba3d21fcd78886..9d06c6d7449e910f454999d83b488e20787b1a22 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -486,7 +486,7 @@ ResourceProvider::~ResourceProvider() {
gl->Finish();
}
-bool ResourceProvider::IsResourceFormatSupported(ResourceFormat format) const {
+bool ResourceProvider::IsTextureFormatSupported(ResourceFormat format) const {
gpu::Capabilities caps;
if (compositor_context_provider_)
caps = compositor_context_provider_->ContextCapabilities();
@@ -505,13 +505,41 @@ bool ResourceProvider::IsResourceFormatSupported(ResourceFormat format) const {
case RED_8:
return caps.texture_rg;
case LUMINANCE_F16:
+ case RGBA_F16:
return caps.texture_half_float_linear;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
+bool ResourceProvider::IsRenderBufferFormatSupported(
+ ResourceFormat format) const {
+ gpu::Capabilities caps;
+ if (compositor_context_provider_)
+ caps = compositor_context_provider_->ContextCapabilities();
+
+ switch (format) {
+ case RGBA_4444:
+ case RGBA_8888:
+ case RGB_565:
+ return true;
+ case BGRA_8888:
+ return caps.render_buffer_format_bgra8888;
case RGBA_F16:
// TODO(ccameron): This will always return false on pixel tests, which
// makes it un-test-able until we upgrade Mesa.
// https://crbug.com/687720
return caps.texture_half_float_linear &&
caps.color_buffer_half_float_rgba;
+ case LUMINANCE_8:
+ case ALPHA_8:
+ case RED_8:
+ case ETC1:
+ case LUMINANCE_F16:
+ // We don't currently render into these formats. If we need to render into
+ // these eventually, we should expand this logic.
+ return false;
}
NOTREACHED();
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/test/layer_tree_pixel_resource_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698