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

Unified Diff: ui/gl/gl_image_memory.cc

Issue 2920793005: gpu: support R16 GPUMemoryBuffer (Closed)
Patch Set: Add bug number to TODO. Created 3 years, 6 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 | « ui/gl/gl_image_io_surface.mm ('k') | ui/gl/gl_image_native_pixmap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_memory.cc
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc
index 20e694ff2fc322d622370749b3d97c5345492f67..170e3c6949939b0f1aacd1e5f27e39fa0332cc55 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -45,6 +45,7 @@ bool ValidFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::DXT5:
case gfx::BufferFormat::ETC1:
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::R_16:
case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444:
@@ -73,6 +74,7 @@ bool IsCompressedFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::ETC1:
return true;
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::R_16:
case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444:
@@ -107,6 +109,8 @@ GLenum TextureFormat(gfx::BufferFormat format) {
return GL_ETC1_RGB8_OES;
case gfx::BufferFormat::R_8:
return GL_RED;
+ case gfx::BufferFormat::R_16:
+ return GL_R16_EXT;
case gfx::BufferFormat::RG_88:
return GL_RG;
case gfx::BufferFormat::RGBA_4444:
@@ -142,6 +146,7 @@ GLenum DataFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::BGRA_8888:
case gfx::BufferFormat::RGBA_F16:
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::R_16:
case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::ATC:
case gfx::BufferFormat::ATCIA:
@@ -173,6 +178,8 @@ GLenum DataType(gfx::BufferFormat format) {
case gfx::BufferFormat::R_8:
case gfx::BufferFormat::RG_88:
return GL_UNSIGNED_BYTE;
+ case gfx::BufferFormat::R_16:
+ return GL_UNSIGNED_SHORT;
case gfx::BufferFormat::RGBA_F16:
return GL_HALF_FLOAT_OES;
case gfx::BufferFormat::ATC:
@@ -194,6 +201,7 @@ GLenum DataType(gfx::BufferFormat format) {
GLint DataRowLength(size_t stride, gfx::BufferFormat format) {
switch (format) {
case gfx::BufferFormat::RG_88:
+ case gfx::BufferFormat::R_16:
case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444:
return base::checked_cast<GLint>(stride) / 2;
@@ -319,6 +327,7 @@ std::unique_ptr<uint8_t[]> GLES2Data(const gfx::Size& size,
case gfx::BufferFormat::BGRA_8888:
case gfx::BufferFormat::RGBA_F16:
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::R_16:
case gfx::BufferFormat::RG_88: {
size_t gles2_data_stride =
RowSizeForBufferFormat(size.width(), format, 0);
« no previous file with comments | « ui/gl/gl_image_io_surface.mm ('k') | ui/gl/gl_image_native_pixmap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698