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

Unified Diff: cc/resources/resource_provider.cc

Issue 2674493003: Add compositor support for half-float RGBA buffers and textures (Closed)
Patch Set: Don't enable on non-ES3 yet Created 3 years, 10 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_format_utils.cc ('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 7bf636b1d271bc2212ba0450856dc04ceb12aca8..20945540784af870e841cec7cc708996364183e8 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -86,6 +86,9 @@ GLenum TextureToStorageFormat(ResourceFormat format) {
case BGRA_8888:
storage_format = GL_BGRA8_EXT;
break;
+ case RGBA_F16:
+ storage_format = GL_RGBA16F_EXT;
+ break;
case RGBA_4444:
case ALPHA_8:
case LUMINANCE_8:
@@ -103,6 +106,7 @@ GLenum TextureToStorageFormat(ResourceFormat format) {
bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) {
switch (format) {
case RGBA_8888:
+ case RGBA_F16:
return true;
case BGRA_8888:
return use_bgra;
@@ -126,6 +130,8 @@ GrPixelConfig ToGrPixelConfig(ResourceFormat format) {
return kBGRA_8888_GrPixelConfig;
case RGBA_4444:
return kRGBA_4444_GrPixelConfig;
+ case RGBA_F16:
+ return kRGBA_half_GrPixelConfig;
default:
break;
}
@@ -537,6 +543,11 @@ bool ResourceProvider::IsResourceFormatSupported(ResourceFormat format) const {
return caps.texture_rg;
case LUMINANCE_F16:
return caps.texture_half_float_linear;
+ 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_float;
}
NOTREACHED();
@@ -576,8 +587,8 @@ ResourceId ResourceProvider::CreateResource(
DCHECK(!size.IsEmpty());
switch (settings_.default_resource_type) {
case RESOURCE_TYPE_GPU_MEMORY_BUFFER:
- // GPU memory buffers don't support LUMINANCE_F16.
- if (format != LUMINANCE_F16) {
+ // GPU memory buffers don't support LUMINANCE_F16 or RGBA_F16 yet.
+ if (format != LUMINANCE_F16 && format != RGBA_F16) {
return CreateGLTexture(
size, hint, RESOURCE_TYPE_GPU_MEMORY_BUFFER, format,
gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, color_space);
« no previous file with comments | « cc/resources/resource_format_utils.cc ('k') | cc/resources/resource_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698