diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-26 20:41:34 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-26 20:41:34 +0000 |
commit | e89a8851c1eb66ef2f5dfb23361a6ec02b28505d (patch) | |
tree | 85bf14aa3a8f25e0ba66eb8a88ff47e695535eea /gpu/pgl | |
parent | e378c531dffe49aa0fcf127fdf2bf7f434d60b6c (diff) | |
download | chromium_src-e89a8851c1eb66ef2f5dfb23361a6ec02b28505d.zip chromium_src-e89a8851c1eb66ef2f5dfb23361a6ec02b28505d.tar.gz chromium_src-e89a8851c1eb66ef2f5dfb23361a6ec02b28505d.tar.bz2 |
An implementation of eglProcAddress
I don't auto-generate this because it seems like we should
make sure to expressly expose only those functions
we want to expose.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/1700015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/pgl')
-rw-r--r-- | gpu/pgl/egl_proc_address.c | 312 |
1 files changed, 312 insertions, 0 deletions
diff --git a/gpu/pgl/egl_proc_address.c b/gpu/pgl/egl_proc_address.c new file mode 100644 index 0000000..4fe732aa --- /dev/null +++ b/gpu/pgl/egl_proc_address.c @@ -0,0 +1,312 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file contains the implementation of eglGetProcAddress + +#include <stdlib.h> +#include <GLES2/gl2.h> + +typedef void (*EGLFunctionPointer)(void); +struct EGLFunctionInfo { + EGLFunctionPointer func; + char const * const name; +}; + +void (* eglGetProcAddress(char const * procname))() { + static const struct EGLFunctionInfo gl_functions[] = { + { (EGLFUNCTIONPOINTER)(&glActiveTexture), + "glActiveTexture", }, + { (EGLFUNCTIONPOINTER)(&glAttachShader), + "glAttachShader", }, + { (EGLFUNCTIONPOINTER)(&glBindAttribLocation), + "glBindAttribLocation", }, + { (EGLFUNCTIONPOINTER)(&glBindBuffer), + "glBindBuffer", }, + { (EGLFUNCTIONPOINTER)(&glBindFramebuffer), + "glBindFramebuffer", }, + { (EGLFUNCTIONPOINTER)(&glBindRenderbuffer), + "glBindRenderbuffer", }, + { (EGLFUNCTIONPOINTER)(&glBindTexture), + "glBindTexture", }, + { (EGLFUNCTIONPOINTER)(&glBlendColor), + "glBlendColor", }, + { (EGLFUNCTIONPOINTER)(&glBlendEquation), + "glBlendEquation", }, + { (EGLFUNCTIONPOINTER)(&glBlendEquationSeparate), + "glBlendEquationSeparate", }, + { (EGLFUNCTIONPOINTER)(&glBlendFunc), + "glBlendFunc", }, + { (EGLFUNCTIONPOINTER)(&glBlendFuncSeparate), + "glBlendFuncSeparate", }, + { (EGLFUNCTIONPOINTER)(&glBufferData), + "glBufferData", }, + { (EGLFUNCTIONPOINTER)(&glBufferSubData), + "glBufferSubData", }, + { (EGLFUNCTIONPOINTER)(&glCheckFramebufferStatus), + "glCheckFramebufferStatus", }, + { (EGLFUNCTIONPOINTER)(&glClear), + "glClear", }, + { (EGLFUNCTIONPOINTER)(&glClearColor), + "glClearColor", }, + { (EGLFUNCTIONPOINTER)(&glClearDepthf), + "glClearDepthf", }, + { (EGLFUNCTIONPOINTER)(&glClearStencil), + "glClearStencil", }, + { (EGLFUNCTIONPOINTER)(&glColorMask), + "glColorMask", }, + { (EGLFUNCTIONPOINTER)(&glCompileShader), + "glCompileShader", }, + { (EGLFUNCTIONPOINTER)(&glCompressedTexImage2D), + "glCompressedTexImage2D", }, + { (EGLFUNCTIONPOINTER)(&glCompressedTexSubImage2D), + "glCompressedTexSubImage2D", }, + { (EGLFUNCTIONPOINTER)(&glCopyTexImage2D), + "glCopyTexImage2D", }, + { (EGLFUNCTIONPOINTER)(&glCopyTexSubImage2D), + "glCopyTexSubImage2D", }, + { (EGLFUNCTIONPOINTER)(&glCreateProgram), + "glCreateProgram", }, + { (EGLFUNCTIONPOINTER)(&glCreateShader), + "glCreateShader", }, + { (EGLFUNCTIONPOINTER)(&glCullFace), + "glCullFace", }, + { (EGLFUNCTIONPOINTER)(&glDeleteBuffers), + "glDeleteBuffers", }, + { (EGLFUNCTIONPOINTER)(&glDeleteFramebuffers), + "glDeleteFramebuffers", }, + { (EGLFUNCTIONPOINTER)(&glDeleteProgram), + "glDeleteProgram", }, + { (EGLFUNCTIONPOINTER)(&glDeleteRenderbuffers), + "glDeleteRenderbuffers", }, + { (EGLFUNCTIONPOINTER)(&glDeleteShader), + "glDeleteShader", }, + { (EGLFUNCTIONPOINTER)(&glDeleteTextures), + "glDeleteTextures", }, + { (EGLFUNCTIONPOINTER)(&glDepthFunc), + "glDepthFunc", }, + { (EGLFUNCTIONPOINTER)(&glDepthMask), + "glDepthMask", }, + { (EGLFUNCTIONPOINTER)(&glDepthRangef), + "glDepthRangef", }, + { (EGLFUNCTIONPOINTER)(&glDetachShader), + "glDetachShader", }, + { (EGLFUNCTIONPOINTER)(&glDisable), + "glDisable", }, + { (EGLFUNCTIONPOINTER)(&glDisableVertexAttribArray), + "glDisableVertexAttribArray", }, + { (EGLFUNCTIONPOINTER)(&glDrawArrays), + "glDrawArrays", }, + { (EGLFUNCTIONPOINTER)(&glDrawElements), + "glDrawElements", }, + { (EGLFUNCTIONPOINTER)(&glEnable), + "glEnable", }, + { (EGLFUNCTIONPOINTER)(&glEnableVertexAttribArray), + "glEnableVertexAttribArray", }, + { (EGLFUNCTIONPOINTER)(&glFinish), + "glFinish", }, + { (EGLFUNCTIONPOINTER)(&glFlush), + "glFlush", }, + { (EGLFUNCTIONPOINTER)(&glFramebufferRenderbuffer), + "glFramebufferRenderbuffer", }, + { (EGLFUNCTIONPOINTER)(&glFramebufferTexture2D), + "glFramebufferTexture2D", }, + { (EGLFUNCTIONPOINTER)(&glFrontFace), + "glFrontFace", }, + { (EGLFUNCTIONPOINTER)(&glGenBuffers), + "glGenBuffers", }, + { (EGLFUNCTIONPOINTER)(&glGenerateMipmap), + "glGenerateMipmap", }, + { (EGLFUNCTIONPOINTER)(&glGenFramebuffers), + "glGenFramebuffers", }, + { (EGLFUNCTIONPOINTER)(&glGenRenderbuffers), + "glGenRenderbuffers", }, + { (EGLFUNCTIONPOINTER)(&glGenTextures), + "glGenTextures", }, + { (EGLFUNCTIONPOINTER)(&glGetActiveAttrib), + "glGetActiveAttrib", }, + { (EGLFUNCTIONPOINTER)(&glGetActiveUniform), + "glGetActiveUniform", }, + { (EGLFUNCTIONPOINTER)(&glGetAttachedShaders), + "glGetAttachedShaders", }, + { (EGLFUNCTIONPOINTER)(&glGetAttribLocation), + "glGetAttribLocation", }, + { (EGLFUNCTIONPOINTER)(&glGetBooleanv), + "glGetBooleanv", }, + { (EGLFUNCTIONPOINTER)(&glGetBufferParameteriv), + "glGetBufferParameteriv", }, + { (EGLFUNCTIONPOINTER)(&glGetError), + "glGetError", }, + { (EGLFUNCTIONPOINTER)(&glGetFloatv), + "glGetFloatv", }, + { (EGLFUNCTIONPOINTER)(&glGetFramebufferAttachmentParameteriv), + "glGetFramebufferAttachmentParameteriv", }, + { (EGLFUNCTIONPOINTER)(&glGetIntegerv), + "glGetIntegerv", }, + { (EGLFUNCTIONPOINTER)(&glGetProgramiv), + "glGetProgramiv", }, + { (EGLFUNCTIONPOINTER)(&glGetProgramInfoLog), + "glGetProgramInfoLog", }, + { (EGLFUNCTIONPOINTER)(&glGetRenderbufferParameteriv), + "glGetRenderbufferParameteriv", }, + { (EGLFUNCTIONPOINTER)(&glGetShaderiv), + "glGetShaderiv", }, + { (EGLFUNCTIONPOINTER)(&glGetShaderInfoLog), + "glGetShaderInfoLog", }, + { (EGLFUNCTIONPOINTER)(&glGetShaderPrecisionFormat), + "glGetShaderPrecisionFormat", }, + { (EGLFUNCTIONPOINTER)(&glGetShaderSource), + "glGetShaderSource", }, + { (EGLFUNCTIONPOINTER)(&glGetString), + "glGetString", }, + { (EGLFUNCTIONPOINTER)(&glGetTexParameterfv), + "glGetTexParameterfv", }, + { (EGLFUNCTIONPOINTER)(&glGetTexParameteriv), + "glGetTexParameteriv", }, + { (EGLFUNCTIONPOINTER)(&glGetUniformfv), + "glGetUniformfv", }, + { (EGLFUNCTIONPOINTER)(&glGetUniformiv), + "glGetUniformiv", }, + { (EGLFUNCTIONPOINTER)(&glGetUniformLocation), + "glGetUniformLocation", }, + { (EGLFUNCTIONPOINTER)(&glGetVertexAttribfv), + "glGetVertexAttribfv", }, + { (EGLFUNCTIONPOINTER)(&glGetVertexAttribiv), + "glGetVertexAttribiv", }, + { (EGLFUNCTIONPOINTER)(&glGetVertexAttribPointerv), + "glGetVertexAttribPointerv", }, + { (EGLFUNCTIONPOINTER)(&glHint), + "glHint", }, + { (EGLFUNCTIONPOINTER)(&glIsBuffer), + "glIsBuffer", }, + { (EGLFUNCTIONPOINTER)(&glIsEnabled), + "glIsEnabled", }, + { (EGLFUNCTIONPOINTER)(&glIsFramebuffer), + "glIsFramebuffer", }, + { (EGLFUNCTIONPOINTER)(&glIsProgram), + "glIsProgram", }, + { (EGLFUNCTIONPOINTER)(&glIsRenderbuffer), + "glIsRenderbuffer", }, + { (EGLFUNCTIONPOINTER)(&glIsShader), + "glIsShader", }, + { (EGLFUNCTIONPOINTER)(&glIsTexture), + "glIsTexture", }, + { (EGLFUNCTIONPOINTER)(&glLineWidth), + "glLineWidth", }, + { (EGLFUNCTIONPOINTER)(&glLinkProgram), + "glLinkProgram", }, + { (EGLFUNCTIONPOINTER)(&glPixelStorei), + "glPixelStorei", }, + { (EGLFUNCTIONPOINTER)(&glPolygonOffset), + "glPolygonOffset", }, + { (EGLFUNCTIONPOINTER)(&glReadPixels), + "glReadPixels", }, + { (EGLFUNCTIONPOINTER)(&glReleaseShaderCompiler), + "glReleaseShaderCompiler", }, + { (EGLFUNCTIONPOINTER)(&glRenderbufferStorage), + "glRenderbufferStorage", }, + { (EGLFUNCTIONPOINTER)(&glSampleCoverage), + "glSampleCoverage", }, + { (EGLFUNCTIONPOINTER)(&glScissor), + "glScissor", }, + { (EGLFUNCTIONPOINTER)(&glShaderBinary), + "glShaderBinary", }, + { (EGLFUNCTIONPOINTER)(&glShaderSource), + "glShaderSource", }, + { (EGLFUNCTIONPOINTER)(&glStencilFunc), + "glStencilFunc", }, + { (EGLFUNCTIONPOINTER)(&glStencilFuncSeparate), + "glStencilFuncSeparate", }, + { (EGLFUNCTIONPOINTER)(&glStencilMask), + "glStencilMask", }, + { (EGLFUNCTIONPOINTER)(&glStencilMaskSeparate), + "glStencilMaskSeparate", }, + { (EGLFUNCTIONPOINTER)(&glStencilOp), + "glStencilOp", }, + { (EGLFUNCTIONPOINTER)(&glStencilOpSeparate), + "glStencilOpSeparate", }, + { (EGLFUNCTIONPOINTER)(&glTexImage2D), + "glTexImage2D", }, + { (EGLFUNCTIONPOINTER)(&glTexParameterf), + "glTexParameterf", }, + { (EGLFUNCTIONPOINTER)(&glTexParameterfv), + "glTexParameterfv", }, + { (EGLFUNCTIONPOINTER)(&glTexParameteri), + "glTexParameteri", }, + { (EGLFUNCTIONPOINTER)(&glTexParameteriv), + "glTexParameteriv", }, + { (EGLFUNCTIONPOINTER)(&glTexSubImage2D), + "glTexSubImage2D", }, + { (EGLFUNCTIONPOINTER)(&glUniform1f), + "glUniform1f", }, + { (EGLFUNCTIONPOINTER)(&glUniform1fv), + "glUniform1fv", }, + { (EGLFUNCTIONPOINTER)(&glUniform1i), + "glUniform1i", }, + { (EGLFUNCTIONPOINTER)(&glUniform1iv), + "glUniform1iv", }, + { (EGLFUNCTIONPOINTER)(&glUniform2f), + "glUniform2f", }, + { (EGLFUNCTIONPOINTER)(&glUniform2fv), + "glUniform2fv", }, + { (EGLFUNCTIONPOINTER)(&glUniform2i), + "glUniform2i", }, + { (EGLFUNCTIONPOINTER)(&glUniform2iv), + "glUniform2iv", }, + { (EGLFUNCTIONPOINTER)(&glUniform3f), + "glUniform3f", }, + { (EGLFUNCTIONPOINTER)(&glUniform3fv), + "glUniform3fv", }, + { (EGLFUNCTIONPOINTER)(&glUniform3i), + "glUniform3i", }, + { (EGLFUNCTIONPOINTER)(&glUniform3iv), + "glUniform3iv", }, + { (EGLFUNCTIONPOINTER)(&glUniform4f), + "glUniform4f", }, + { (EGLFUNCTIONPOINTER)(&glUniform4fv), + "glUniform4fv", }, + { (EGLFUNCTIONPOINTER)(&glUniform4i), + "glUniform4i", }, + { (EGLFUNCTIONPOINTER)(&glUniform4iv), + "glUniform4iv", }, + { (EGLFUNCTIONPOINTER)(&glUniformMatrix2fv), + "glUniformMatrix2fv", }, + { (EGLFUNCTIONPOINTER)(&glUniformMatrix3fv), + "glUniformMatrix3fv", }, + { (EGLFUNCTIONPOINTER)(&glUniformMatrix4fv), + "glUniformMatrix4fv", }, + { (EGLFUNCTIONPOINTER)(&glUseProgram), + "glUseProgram", }, + { (EGLFUNCTIONPOINTER)(&glValidateProgram), + "glValidateProgram", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib1f), + "glVertexAttrib1f", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib1fv), + "glVertexAttrib1fv", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib2f), + "glVertexAttrib2f", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib2fv), + "glVertexAttrib2fv", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib3f), + "glVertexAttrib3f", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib3fv), + "glVertexAttrib3fv", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib4f), + "glVertexAttrib4f", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttrib4fv), + "glVertexAttrib4fv", }, + { (EGLFUNCTIONPOINTER)(&glVertexAttribPointer), + "glVertexAttribPointer", }, + { (EGLFUNCTIONPOINTER)(&glViewport), + "glViewport", }, + }; + + unsigned int num_functions = sizeof(gl_functions) / sizeof(gl_functions[0]); + unsigned int ii; + for (ii = 0; ii < num_functions; ++ii) { + if (strcmp(gl_functions[ii].name, procname) == 0) { + return gl_functions[ii].func; + } + } + return NULL; +} |