summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 20:31:48 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 20:31:48 +0000
commitd8a1713af55ecd119b31a65ec088e4049b3be1f1 (patch)
treee7bca67a5c91033437034d7dec7e47cb2422399b /o3d
parentaf60ef0bb32bd0babdf51e0e11795ad61b30ec4d (diff)
downloadchromium_src-d8a1713af55ecd119b31a65ec088e4049b3be1f1.zip
chromium_src-d8a1713af55ecd119b31a65ec088e4049b3be1f1.tar.gz
chromium_src-d8a1713af55ecd119b31a65ec088e4049b3be1f1.tar.bz2
o3d: gles2/desktop_gl: use ARB_shader_objects/ARB_vertex_shader functions instead of the GL2 ones
This is to support GL drivers that are 1.4+ARB_so/ARB_vs, like i915 linux drivers (with mesa's glsl2 branch). Tested on NVIDIA (it works), and i915 experimental driver (it doesn't crash but geometry isn't rendered). Review URL: http://codereview.chromium.org/3162006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/core/cross/gles2/gles2_headers.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/o3d/core/cross/gles2/gles2_headers.h b/o3d/core/cross/gles2/gles2_headers.h
index 545a9d7..f21317b 100644
--- a/o3d/core/cross/gles2/gles2_headers.h
+++ b/o3d/core/cross/gles2/gles2_headers.h
@@ -41,6 +41,67 @@
#include <GL/glx.h>
#endif
+// Use ARB_shader_object / ARB_vertex_shader functions to work when GL2 isn't
+// present but the extensions are.
+// Note that several GL2 functions are defined into the same ARB function (e.g.
+// glDeleteProgram and glDeleteShader into glDeleteObjectARB). That's expected.
+#undef glAttachShader
+#define glAttachShader glAttachObjectARB
+#undef glCompileShader
+#define glCompileShader glCompileShaderARB
+#undef glCreateProgram
+#define glCreateProgram glCreateProgramObjectARB
+#undef glCreateShader
+#define glCreateShader glCreateShaderObjectARB
+#undef glDeleteProgram
+#define glDeleteProgram glDeleteObjectARB
+#undef glDeleteShader
+#define glDeleteShader glDeleteObjectARB
+#undef glDisableVertexAttribArray
+#define glDisableVertexAttribArray glDisableVertexAttribArrayARB
+#undef glEnableVertexAttribArray
+#define glEnableVertexAttribArray glEnableVertexAttribArrayARB
+#undef glGetActiveAttrib
+#define glGetActiveAttrib glGetActiveAttribARB
+#undef glGetActiveUniform
+#define glGetActiveUniform glGetActiveUniformARB
+#undef glGetAttribLocation
+#define glGetAttribLocation glGetAttribLocationARB
+#undef glGetProgramInfoLog
+#define glGetProgramInfoLog glGetInfoLogARB
+#undef glGetProgramiv
+#define glGetProgramiv glGetObjectParameterivARB
+#undef glGetShaderInfoLog
+#define glGetShaderInfoLog glGetInfoLogARB
+#undef glGetShaderiv
+#define glGetShaderiv glGetObjectParameterivARB
+#undef glGetUniformLocation
+#define glGetUniformLocation glGetUniformLocationARB
+#undef glLinkProgram
+#define glLinkProgram glLinkProgramARB
+#undef glShaderSource
+#define glShaderSource glShaderSourceARB
+#undef glUniform1f
+#define glUniform1f glUniform1fARB
+#undef glUniform1fv
+#define glUniform1fv glUniform1fvARB
+#undef glUniform1i
+#define glUniform1i glUniform1iARB
+#undef glUniform1iv
+#define glUniform1iv glUniform1ivARB
+#undef glUniform2fv
+#define glUniform2fv glUniform2fvARB
+#undef glUniform3fv
+#define glUniform3fv glUniform3fvARB
+#undef glUniform4fv
+#define glUniform4fv glUniform4fvARB
+#undef glUniformMatrix4fv
+#define glUniformMatrix4fv glUniformMatrix4fvARB
+#undef glUseProgram
+#define glUseProgram glUseProgramObjectARB
+#undef glVertexAttribPointer
+#define glVertexAttribPointer glVertexAttribPointerARB
+
#elif defined(GLES2_BACKEND_NATIVE_GLES2)
#include <EGL/egl.h>