diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-09 09:04:51 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-09 09:04:51 +0000 |
commit | 8e5c56316a1019d5d699a33e351d8cddc2b03176 (patch) | |
tree | ea67082fb03930722a355b57b1ac818f12397f33 /webkit/gpu/webgraphicscontext3d_in_process_impl.cc | |
parent | 8be43d0c753ef09c2d86026b0bfb9672bc225bd8 (diff) | |
download | chromium_src-8e5c56316a1019d5d699a33e351d8cddc2b03176.zip chromium_src-8e5c56316a1019d5d699a33e351d8cddc2b03176.tar.gz chromium_src-8e5c56316a1019d5d699a33e351d8cddc2b03176.tar.bz2 |
Properly support BGRA textures on desktop GL
On GLES2, you must have internalFormat == format. That's what WebKit passes to
WebGraphicsContext3DInProcessImpl. On Desktop GL, internalFormat must be one of
RGBA* for BGRA textures. This patch does the proper translation.
BUG=None
TEST=WebKit compositor
Review URL: http://codereview.chromium.org/8202019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104674 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/gpu/webgraphicscontext3d_in_process_impl.cc')
-rw-r--r-- | webkit/gpu/webgraphicscontext3d_in_process_impl.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc index ffcd46d..ae8c4c5 100644 --- a/webkit/gpu/webgraphicscontext3d_in_process_impl.cc +++ b/webkit/gpu/webgraphicscontext3d_in_process_impl.cc @@ -1331,6 +1331,17 @@ void WebGraphicsContext3DInProcessImpl::texImage2D( WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) { makeContextCurrent(); + if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { + if (format == GL_BGRA_EXT && internalFormat == GL_BGRA_EXT) { + internalFormat = GL_RGBA; + } else if (type == GL_FLOAT) { + if (format == GL_RGBA) { + internalFormat = GL_RGBA32F_ARB; + } else if (format == GL_RGB) { + internalFormat = GL_RGB32F_ARB; + } + } + } glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels); } |