Chromium Code Reviews| Index: ui/gl/gl_image_io_surface.mm |
| diff --git a/ui/gl/gl_image_io_surface.mm b/ui/gl/gl_image_io_surface.mm |
| index 3059333cc8896feb96c15f2b4147e3e927a3f417..2ae58ef5bb37d212dd95d14f1743cb8f852f41ed 100644 |
| --- a/ui/gl/gl_image_io_surface.mm |
| +++ b/ui/gl/gl_image_io_surface.mm |
| @@ -16,6 +16,7 @@ |
| #include "ui/gl/gl_bindings.h" |
| #include "ui/gl/gl_context.h" |
| #include "ui/gl/gl_helper.h" |
| +#include "ui/gl/gl_version_info.h" |
| #include "ui/gl/scoped_binders.h" |
| // Note that this must be included after gl_bindings.h to avoid conflicts. |
| @@ -68,7 +69,7 @@ STRINGIZE( |
| bool ValidInternalFormat(unsigned internalformat) { |
| switch (internalformat) { |
| - case GL_RED: |
| + case GL_R8: |
| case GL_BGRA_EXT: |
| case GL_RGB: |
| case GL_RGB_YCBCR_420V_CHROMIUM: |
| @@ -106,8 +107,16 @@ bool ValidFormat(BufferFormat format) { |
| GLenum TextureFormat(BufferFormat format) { |
| switch (format) { |
| - case BufferFormat::R_8: |
| - return GL_RED; |
| + case BufferFormat::R_8: { |
| + const gfx::GLVersionInfo* version_info = |
|
reveman
2016/02/20 01:07:55
Can this case be implemented this way?
return gfx
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::BGRA_8888: |
| case BufferFormat::RGBA_8888: |
| return GL_RGBA; |