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

Unified Diff: ui/gl/gl_image_memory.cc

Issue 2786103003: Add half-float IOSurface GpuMemoryBuffer support (Closed)
Patch Set: Re-add software support 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
Index: ui/gl/gl_image_memory.cc
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc
index 43c82014d9076c206e89258b3d0de2ed0d466147..bb87fd66a008b184d395c06a41bf68b2bd950e28 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -52,6 +52,7 @@ bool ValidFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::BGRX_8888:
case gfx::BufferFormat::BGRA_8888:
+ case gfx::BufferFormat::RGBA_F16:
return true;
case gfx::BufferFormat::YVU_420:
case gfx::BufferFormat::YUV_420_BIPLANAR:
@@ -79,6 +80,7 @@ bool IsCompressedFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::BGRX_8888:
case gfx::BufferFormat::BGRA_8888:
+ case gfx::BufferFormat::RGBA_F16:
return false;
case gfx::BufferFormat::YVU_420:
case gfx::BufferFormat::YUV_420_BIPLANAR:
@@ -109,6 +111,7 @@ GLenum TextureFormat(gfx::BufferFormat format) {
return GL_RG;
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBA_8888:
+ case gfx::BufferFormat::RGBA_F16:
return GL_RGBA;
case gfx::BufferFormat::BGRA_8888:
return GL_BGRA_EXT;
@@ -137,6 +140,7 @@ GLenum DataFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::BGRA_8888:
+ case gfx::BufferFormat::RGBA_F16:
case gfx::BufferFormat::R_8:
case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::ATC:
@@ -169,6 +173,8 @@ GLenum DataType(gfx::BufferFormat format) {
case gfx::BufferFormat::R_8:
case gfx::BufferFormat::RG_88:
return GL_UNSIGNED_BYTE;
+ case gfx::BufferFormat::RGBA_F16:
+ return GL_HALF_FLOAT_OES;
case gfx::BufferFormat::ATC:
case gfx::BufferFormat::ATCIA:
case gfx::BufferFormat::DXT1:
@@ -196,6 +202,8 @@ GLint DataRowLength(size_t stride, gfx::BufferFormat format) {
case gfx::BufferFormat::BGRX_8888:
case gfx::BufferFormat::BGRA_8888:
return base::checked_cast<GLint>(stride) / 4;
+ case gfx::BufferFormat::RGBA_F16:
+ return base::checked_cast<GLint>(stride) / 8;
case gfx::BufferFormat::R_8:
return base::checked_cast<GLint>(stride);
case gfx::BufferFormat::ATC:
@@ -332,6 +340,7 @@ std::unique_ptr<uint8_t[]> GLES2Data(const gfx::Size& size,
case gfx::BufferFormat::DXT5:
case gfx::BufferFormat::ETC1:
return nullptr; // No data conversion needed
+ case gfx::BufferFormat::RGBA_F16:
case gfx::BufferFormat::YVU_420:
case gfx::BufferFormat::YUV_420_BIPLANAR:
case gfx::BufferFormat::UYVY_422:

Powered by Google App Engine
This is Rietveld 408576698