summaryrefslogtreecommitdiffstats
path: root/ui/gl
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 17:13:41 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 17:13:41 +0000
commit2a15063e9e41ebd3020e041bb3e849b37e919d25 (patch)
tree43f1cb21ae2d0432650c653d864c427ba8464645 /ui/gl
parent4145d17a54bbf9c5b7b29efb9f55eaa6f954602b (diff)
downloadchromium_src-2a15063e9e41ebd3020e041bb3e849b37e919d25.zip
chromium_src-2a15063e9e41ebd3020e041bb3e849b37e919d25.tar.gz
chromium_src-2a15063e9e41ebd3020e041bb3e849b37e919d25.tar.bz2
Revert 199454 "Move WrappedTexImage functionality to ui/gl"
> Move WrappedTexImage functionality to ui/gl > > BUG=235031 > > Review URL: https://chromiumcodereview.appspot.com/14557009 BUG=239827 TBR=gman@chromium.org Review URL: https://codereview.chromium.org/14783012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rwxr-xr-xui/gl/generate_bindings.py16
-rw-r--r--ui/gl/gl_bindings.h71
-rw-r--r--ui/gl/gl_gl_api_implementation.cc123
3 files changed, 18 insertions, 192 deletions
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index 968ec77..c19488c 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -1218,6 +1218,22 @@ class GLContext;
file.write('};\n')
file.write('\n')
+ # Write Driver struct.
+ file.write(
+"""struct GL_EXPORT Driver%(name)s {
+ void InitializeBindings();
+ void InitializeExtensionBindings(GLContext* context);
+ void InitializeDebugBindings();
+ void ClearBindings();
+ void UpdateDebugExtensionBindings();
+
+ Procs%(name)s fn;
+ Procs%(name)s debug_fn;
+ Extensions%(name)s ext;
+""" % {'name': set_name.upper()})
+ file.write('};\n')
+ file.write('\n')
+
# Write Api class.
file.write(
"""class GL_EXPORT %(name)sApi {
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h
index 38cadde..e7bd808 100644
--- a/ui/gl/gl_bindings.h
+++ b/ui/gl/gl_bindings.h
@@ -212,77 +212,6 @@ typedef uint64 EGLuint64CHROMIUM;
namespace gfx {
-struct GL_EXPORT DriverGL {
- void Initialize();
- void InitializeExtensions(GLContext* context);
- void InitializeDebugBindings();
- void ClearBindings();
- void UpdateDebugExtensionBindings();
-
- ProcsGL fn;
- ProcsGL orig_fn;
- ProcsGL debug_fn;
- ExtensionsGL ext;
-
- private:
- void InitializeBindings();
- void InitializeExtensionBindings(GLContext* context);
-};
-
-struct GL_EXPORT DriverOSMESA {
- void InitializeBindings();
- void InitializeExtensionBindings(GLContext* context);
- void InitializeDebugBindings();
- void ClearBindings();
- void UpdateDebugExtensionBindings();
-
- ProcsOSMESA fn;
- ProcsOSMESA debug_fn;
- ExtensionsOSMESA ext;
-};
-
-#if defined(OS_WIN)
-struct GL_EXPORT DriverWGL {
- void InitializeBindings();
- void InitializeExtensionBindings(GLContext* context);
- void InitializeDebugBindings();
- void ClearBindings();
- void UpdateDebugExtensionBindings();
-
- ProcsWGL fn;
- ProcsWGL debug_fn;
- ExtensionsWGL ext;
-};
-#endif
-
-#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID)
-struct GL_EXPORT DriverEGL {
- void InitializeBindings();
- void InitializeExtensionBindings(GLContext* context);
- void InitializeDebugBindings();
- void ClearBindings();
- void UpdateDebugExtensionBindings();
-
- ProcsEGL fn;
- ProcsEGL debug_fn;
- ExtensionsEGL ext;
-};
-#endif
-
-#if defined(USE_X11)
-struct GL_EXPORT DriverGLX {
- void InitializeBindings();
- void InitializeExtensionBindings(GLContext* context);
- void InitializeDebugBindings();
- void ClearBindings();
- void UpdateDebugExtensionBindings();
-
- ProcsGLX fn;
- ProcsGLX debug_fn;
- ExtensionsGLX ext;
-};
-#endif
-
GL_EXPORT extern GLApi* g_current_gl_context;
GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
GL_EXPORT extern DriverGL g_driver_gl;
diff --git a/ui/gl/gl_gl_api_implementation.cc b/ui/gl/gl_gl_api_implementation.cc
index 12a67c7..303ae1d 100644
--- a/ui/gl/gl_gl_api_implementation.cc
+++ b/ui/gl/gl_gl_api_implementation.cc
@@ -10,7 +10,6 @@
#include "base/command_line.h"
#include "base/string_util.h"
#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_state_restorer.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_switches.h"
@@ -24,126 +23,8 @@ static RealGLApi* g_real_gl;
// A GL Api that calls TRACE and then calls another GL api.
static TraceGLApi* g_trace_gl;
-namespace {
-
-static inline GLenum GetTexInternalFormat(GLenum internal_format) {
- if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
- if (internal_format == GL_BGRA_EXT || internal_format == GL_BGRA8_EXT)
- return GL_RGBA8;
- }
- return internal_format;
-}
-
-// TODO(epenner): Could the above function be merged into this and removed?
-static inline GLenum GetTexInternalFormat(GLenum internal_format,
- GLenum format,
- GLenum type) {
- GLenum gl_internal_format = GetTexInternalFormat(internal_format);
-
- if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
- return gl_internal_format;
-
- if (type == GL_FLOAT) {
- switch (format) {
- case GL_RGBA:
- gl_internal_format = GL_RGBA32F_ARB;
- break;
- case GL_RGB:
- gl_internal_format = GL_RGB32F_ARB;
- break;
- case GL_LUMINANCE_ALPHA:
- gl_internal_format = GL_LUMINANCE_ALPHA32F_ARB;
- break;
- case GL_LUMINANCE:
- gl_internal_format = GL_LUMINANCE32F_ARB;
- break;
- case GL_ALPHA:
- gl_internal_format = GL_ALPHA32F_ARB;
- break;
- default:
- NOTREACHED();
- break;
- }
- } else if (type == GL_HALF_FLOAT_OES) {
- switch (format) {
- case GL_RGBA:
- gl_internal_format = GL_RGBA16F_ARB;
- break;
- case GL_RGB:
- gl_internal_format = GL_RGB16F_ARB;
- break;
- case GL_LUMINANCE_ALPHA:
- gl_internal_format = GL_LUMINANCE_ALPHA16F_ARB;
- break;
- case GL_LUMINANCE:
- gl_internal_format = GL_LUMINANCE16F_ARB;
- break;
- case GL_ALPHA:
- gl_internal_format = GL_ALPHA16F_ARB;
- break;
- default:
- NOTREACHED();
- break;
- }
- }
- return gl_internal_format;
-}
-
-static inline GLenum GetTexType(GLenum type) {
- if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) {
- if (type == GL_HALF_FLOAT_OES)
- return GL_HALF_FLOAT_ARB;
- }
- return type;
-}
-
-static void GL_BINDING_CALL CustomTexImage2D(
- GLenum target, GLint level, GLint internalformat,
- GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type,
- const void* pixels) {
- GLenum gl_internal_format = GetTexInternalFormat(
- internalformat, format, type);
- GLenum gl_type = GetTexType(type);
- return g_driver_gl.orig_fn.glTexImage2DFn(
- target, level, gl_internal_format, width, height, border, 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_type = GetTexType(type);
- return g_driver_gl.orig_fn.glTexSubImage2DFn(
- target, level, xoffset, yoffset, width, height, format, gl_type, pixels);
-}
-
-static void GL_BINDING_CALL CustomTexStorage2DEXT(
- GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
- GLsizei height) {
- GLenum gl_internal_format = GetTexInternalFormat(internalformat);
- return g_driver_gl.orig_fn.glTexStorage2DEXTFn(
- target, levels, gl_internal_format, width, height);
-}
-
-} // anonymous namespace
-
-void DriverGL::Initialize() {
- InitializeBindings();
- orig_fn = fn;
- fn.glTexImage2DFn =
- reinterpret_cast<glTexImage2DProc>(CustomTexImage2D);
- fn.glTexStorage2DEXTFn =
- reinterpret_cast<glTexStorage2DEXTProc>(CustomTexStorage2DEXT);
- fn.glTexSubImage2DFn =
- reinterpret_cast<glTexSubImage2DProc>(CustomTexSubImage2D);
-}
-
-void DriverGL::InitializeExtensions(GLContext* context) {
- InitializeExtensionBindings(context);
-}
-
void InitializeGLBindingsGL() {
- g_driver_gl.Initialize();
+ g_driver_gl.InitializeBindings();
if (!g_real_gl) {
g_real_gl = new RealGLApi();
g_trace_gl = new TraceGLApi(g_real_gl);
@@ -170,7 +51,7 @@ void SetGLToRealGLApi() {
}
void InitializeGLExtensionBindingsGL(GLContext* context) {
- g_driver_gl.InitializeExtensions(context);
+ g_driver_gl.InitializeExtensionBindings(context);
}
void InitializeDebugGLBindingsGL() {