Chromium Code Reviews| Index: ui/gl/gl_gl_api_implementation.cc |
| diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc |
| index 369c3952808d1f3c86885415325bb8f7939fb0c8..88f8618c8dbc35c4631531b2cf0a3d8cc9e453e6 100644 |
| --- a/ui/gl/gl_gl_api_implementation.cc |
| +++ b/ui/gl/gl_gl_api_implementation.cc |
| @@ -154,9 +154,45 @@ static inline GLenum GetTexInternalFormat(GLenum internal_format, |
| break; |
| } |
| } |
| + |
| + if (gfx::g_version_info->is_es3 || |
| + gfx::g_version_info->is_desktop_core_profile) { |
|
Zhenyao Mo
2016/04/28 23:29:42
Should we also do the same for compatibility profi
xinghua.cao
2016/04/29 05:30:55
Yes, I have read the spec, mapping format is neede
|
| + switch (internal_format) { |
| + case GL_SRGB_EXT: |
| + gl_internal_format = GL_SRGB8; |
| + break; |
| + case GL_SRGB_ALPHA_EXT: |
| + gl_internal_format = GL_SRGB8_ALPHA8; |
| + break; |
| + default: |
| + break; |
| + } |
| + } |
| + |
| return gl_internal_format; |
| } |
| +static inline GLenum GetTexFormat(GLenum format) { |
| + GLenum gl_format = format; |
| + |
| + DCHECK(gfx::g_version_info); |
| + if (gfx::g_version_info->is_es3 || |
| + gfx::g_version_info->is_desktop_core_profile) { |
|
Zhenyao Mo
2016/04/28 23:29:42
Same question here?
|
| + switch (format) { |
| + case GL_SRGB_EXT: |
| + gl_format = GL_RGB; |
| + break; |
| + case GL_SRGB_ALPHA_EXT: |
| + gl_format = GL_RGBA; |
| + break; |
| + default: |
| + break; |
| + } |
| + } |
| + |
| + return gl_format; |
| +} |
| + |
| static inline GLenum GetTexType(GLenum type) { |
| if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { |
| if (type == GL_HALF_FLOAT_OES) |
| @@ -171,18 +207,21 @@ static void GL_BINDING_CALL CustomTexImage2D( |
| const void* pixels) { |
| GLenum gl_internal_format = GetTexInternalFormat( |
| internalformat, format, type); |
| + GLenum gl_format = GetTexFormat(format); |
| GLenum gl_type = GetTexType(type); |
| g_driver_gl.orig_fn.glTexImage2DFn( |
| - target, level, gl_internal_format, width, height, border, format, gl_type, |
| - pixels); |
| + target, level, gl_internal_format, width, height, border, gl_format, |
| + gl_type, pixels); |
| } |
| static void GL_BINDING_CALL CustomTexSubImage2D( |
| GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, |
| GLsizei height, GLenum format, GLenum type, const void* pixels) { |
| + GLenum gl_format = GetTexFormat(format); |
| GLenum gl_type = GetTexType(type); |
| g_driver_gl.orig_fn.glTexSubImage2DFn( |
| - target, level, xoffset, yoffset, width, height, format, gl_type, pixels); |
| + target, level, xoffset, yoffset, width, height, gl_format, gl_type, |
| + pixels); |
| } |
| static void GL_BINDING_CALL CustomTexStorage2DEXT( |