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

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: mapping format when context is not es2. 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..9e9b9381ace9ecdab9b70bc7965dd80ae52e32e6 100644
--- a/ui/gl/gl_gl_api_implementation.cc
+++ b/ui/gl/gl_gl_api_implementation.cc
@@ -154,9 +154,43 @@ static inline GLenum GetTexInternalFormat(GLenum internal_format,
break;
}
}
+
+ if (!(gfx::g_version_info->is_es2)) {
Ken Russell (switch to Gerrit) 2016/05/02 21:16:48 This negative if-statement is pretty broad and I t
xinghua.cao 2016/05/04 02:55:41 Done.
+ 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_es2)) {
Ken Russell (switch to Gerrit) 2016/05/02 21:16:48 Same comment as above in GetTexInternalFormat.
xinghua.cao 2016/05/04 02:55:40 Done.
+ 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 +205,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