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

Unified Diff: ui/gl/gl_image_memory.cc

Issue 1708263002: gpu: Expose internal format R8 instead of RED. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ResourceProvider should use R8 too. Created 4 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
« ui/gl/gl_image_io_surface.mm ('K') | « ui/gl/gl_image_io_surface.mm ('k') | no next file » | 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 a29a388585fcd41406455446d0156f27deb0075d..f966f8572fa91c978aa1fd6c559457c8d8016bc0 100644
--- a/ui/gl/gl_image_memory.cc
+++ b/ui/gl/gl_image_memory.cc
@@ -26,7 +26,7 @@ bool ValidInternalFormat(unsigned internalformat) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
case GL_ETC1_RGB8_OES:
- case GL_RED:
+ case GL_R8:
case GL_RGB:
case GL_RGBA:
case GL_BGRA_EXT:
@@ -98,8 +98,16 @@ GLenum TextureFormat(BufferFormat format) {
return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
case BufferFormat::ETC1:
return GL_ETC1_RGB8_OES;
- case BufferFormat::R_8:
- return GL_RED;
+ case BufferFormat::R_8: {
+ const gfx::GLVersionInfo* version_info =
reveman 2016/02/20 01:07:55 ditto
Daniele Castagna 2016/02/20 01:16:16 Done.
+ gfx::GLContext::GetCurrent()->GetVersionInfo();
+ if (version_info->IsAtLeastGL(3, 0) ||
+ version_info->IsAtLeastGLES(3, 0)) {
+ return GL_R8;
+ } else {
+ return GL_RED;
+ }
+ }
case BufferFormat::RGBA_4444:
case BufferFormat::RGBA_8888:
return GL_RGBA;
@@ -125,10 +133,11 @@ GLenum DataFormat(BufferFormat format) {
return GL_RGBA;
case BufferFormat::BGRX_8888:
return GL_BGRA_EXT;
+ case BufferFormat::R_8:
+ return GL_RED;
case BufferFormat::RGBA_4444:
case BufferFormat::RGBA_8888:
case BufferFormat::BGRA_8888:
- case BufferFormat::R_8:
case BufferFormat::ATC:
case BufferFormat::ATCIA:
case BufferFormat::DXT1:
« ui/gl/gl_image_io_surface.mm ('K') | « ui/gl/gl_image_io_surface.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698