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

Unified Diff: ui/gl/gl_image_memory.cc

Issue 2376293003: gpu: support RG_88 GpuMemoryBuffer (Closed)
Patch Set: resolve hubbe's review Created 4 years, 2 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/test/gl_image_test_support.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 5b43f33cc98709203e83234942d85f5bda806fc7..0c38c9b836d961cf10486f3d015571094a9c8e5b 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -27,6 +27,7 @@ bool ValidInternalFormat(unsigned internalformat) {
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
case GL_ETC1_RGB8_OES:
case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_RGBA:
case GL_BGRA_EXT:
@@ -44,6 +45,7 @@ bool ValidFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::DXT5:
case gfx::BufferFormat::ETC1:
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBX_8888:
@@ -70,6 +72,7 @@ bool IsCompressedFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::ETC1:
return true;
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBX_8888:
@@ -102,6 +105,8 @@ GLenum TextureFormat(gfx::BufferFormat format) {
return GL_ETC1_RGB8_OES;
case gfx::BufferFormat::R_8:
return GL_RED;
+ case gfx::BufferFormat::RG_88:
+ return GL_RG;
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBA_8888:
return GL_RGBA;
@@ -133,6 +138,7 @@ GLenum DataFormat(gfx::BufferFormat format) {
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::BGRA_8888:
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::ATC:
case gfx::BufferFormat::ATCIA:
case gfx::BufferFormat::DXT1:
@@ -161,6 +167,7 @@ GLenum DataType(gfx::BufferFormat format) {
case gfx::BufferFormat::BGRX_8888:
case gfx::BufferFormat::BGRA_8888:
case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::RG_88:
return GL_UNSIGNED_BYTE;
case gfx::BufferFormat::ATC:
case gfx::BufferFormat::ATCIA:
@@ -180,6 +187,7 @@ GLenum DataType(gfx::BufferFormat format) {
GLint DataRowLength(size_t stride, gfx::BufferFormat format) {
switch (format) {
+ case gfx::BufferFormat::RG_88:
case gfx::BufferFormat::BGR_565:
case gfx::BufferFormat::RGBA_4444:
return base::checked_cast<GLint>(stride) / 2;
@@ -301,7 +309,8 @@ std::unique_ptr<uint8_t[]> GLES2Data(const gfx::Size& size,
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::RGBA_8888:
case gfx::BufferFormat::BGRA_8888:
- case gfx::BufferFormat::R_8: {
+ case gfx::BufferFormat::R_8:
+ case gfx::BufferFormat::RG_88: {
size_t gles2_data_stride =
RowSizeForBufferFormat(size.width(), format, 0);
if (stride == gles2_data_stride ||
« no previous file with comments | « ui/gl/gl_image_io_surface.mm ('k') | ui/gl/test/gl_image_test_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698