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

Unified Diff: ui/gl/gl_gl_api_implementation.cc

Issue 1881883002: SRGB_EXT is a valid format of texture in WebGL1.0 and ES2.0 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address zhenyao's comment Created 4 years, 8 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 | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « gpu/command_buffer/service/texture_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698