aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi/glapi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
committermarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
commit990bc3f015a4f8fce2eb918375defcd44980a845 (patch)
tree8e8301f19482b52cc00bd95b4593522cc93267af /mesalib/src/mapi/glapi
parent1af6fc1b5d93e54d6674de8b5870448b29f139a7 (diff)
downloadvcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.gz
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.bz2
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.zip
Used synchronise script to update files
Diffstat (limited to 'mesalib/src/mapi/glapi')
-rw-r--r--mesalib/src/mapi/glapi/.gitignore20
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml116
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml76
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml98
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml42
-rw-r--r--mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml44
-rw-r--r--mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml52
-rw-r--r--mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml196
-rw-r--r--mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml236
-rw-r--r--mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml46
-rw-r--r--mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml26
-rw-r--r--mesalib/src/mapi/glapi/gen/glX_API.xml468
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py546
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_procs.py430
-rw-r--r--mesalib/src/mapi/glapi/gen/next_available_offset.sh78
-rw-r--r--mesalib/src/mapi/glapi/glapi.c130
-rw-r--r--mesalib/src/mapi/glapi/glapi_dispatch.c184
-rw-r--r--mesalib/src/mapi/glapi/glapi_getproc.c1332
18 files changed, 2070 insertions, 2050 deletions
diff --git a/mesalib/src/mapi/glapi/.gitignore b/mesalib/src/mapi/glapi/.gitignore
new file mode 100644
index 000000000..21edf4f58
--- /dev/null
+++ b/mesalib/src/mapi/glapi/.gitignore
@@ -0,0 +1,20 @@
+.cvsignore
+glX_proto_common.pyo
+glX_proto_common.pyc
+typeexpr.pyo
+typeexpr.pyc
+license.pyo
+license.pyc
+gl_XML.pyo
+gl_XML.pyc
+glX_XML.pyo
+glX_XML.pyc
+glapi_gentable.c
+glapi_gentable.h
+glapi_mapi_tmp.h
+glapi_sparc.S
+glapi_x86-64.S
+glapi_x86.S
+glapitable.h
+glapitemp.h
+glprocs.h
diff --git a/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml b/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml
index 5e348544a..d52a88c60 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_ES2_compatibility.xml
@@ -1,58 +1,58 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-
-<category name="GL_ARB_ES2_compatibility" number="95">
- <enum name="FIXED" count="1" value="0x140C"/>
- <enum name="LOW_FLOAT" value="0x8DF0"/>
- <enum name="MEDIUM_FLOAT" value="0x8DF1"/>
- <enum name="HIGH_FLOAT" value="0x8DF2"/>
- <enum name="LOW_INT" value="0x8DF3"/>
- <enum name="MEDIUM_INT" value="0x8DF4"/>
- <enum name="HIGH_INT" value="0x8DF5"/>
- <enum name="SHADER_BINARY_FORMATS" value="0x8DF8"/>
- <enum name="NUM_SHADER_BINARY_FORMATS" value="0x8DF9"/>
- <enum name="SHADER_COMPILER" value="0x8DFA"/>
- <enum name="MAX_VERTEX_UNIFORM_VECTORS" value="0x8DFB"/>
- <enum name="MAX_VARYING_VECTORS" value="0x8DFC"/>
- <enum name="MAX_FRAGMENT_UNIFORM_VECTORS" value="0x8DFD"/>
-
- <function name="GetShaderPrecisionFormat" offset="assign">
- <param name="shadertype" type="GLenum"/>
- <param name="precisiontype" type="GLenum"/>
- <param name="range" type="GLint *"/>
- <param name="precision" type="GLint *"/>
- </function>
-
- <function name="ReleaseShaderCompiler" offset="assign">
- </function>
-
- <function name="ShaderBinary" offset="assign">
- <param name="n" type="GLsizei"/>
- <param name="shaders" type="const GLuint *"/>
- <param name="binaryformat" type="GLenum"/>
- <param name="binary" type="const GLvoid *"/>
- <param name="length" type="GLsizei"/>
- </function>
-
- <!-- from GL_OES_fixed_point -->
- <enum name="FIXED" value="0x140C"/>
- <type name="fixed" size="4" />
-
- <!-- from GL_OES_read_format -->
- <enum name="IMPLEMENTATION_COLOR_READ_TYPE" value="0x8B9A"/>
- <enum name="IMPLEMENTATION_COLOR_READ_FORMAT" value="0x8B9B"/>
-
- <!-- from GL_OES_single_precision -->
- <function name="ClearDepthf" offset="assign">
- <param name="depth" type="GLclampf"/>
- </function>
-
- <function name="DepthRangef" offset="assign">
- <param name="zNear" type="GLclampf"/>
- <param name="zFar" type="GLclampf"/>
- </function>
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_ES2_compatibility" number="95">
+ <enum name="FIXED" count="1" value="0x140C"/>
+ <enum name="LOW_FLOAT" value="0x8DF0"/>
+ <enum name="MEDIUM_FLOAT" value="0x8DF1"/>
+ <enum name="HIGH_FLOAT" value="0x8DF2"/>
+ <enum name="LOW_INT" value="0x8DF3"/>
+ <enum name="MEDIUM_INT" value="0x8DF4"/>
+ <enum name="HIGH_INT" value="0x8DF5"/>
+ <enum name="SHADER_BINARY_FORMATS" value="0x8DF8"/>
+ <enum name="NUM_SHADER_BINARY_FORMATS" value="0x8DF9"/>
+ <enum name="SHADER_COMPILER" value="0x8DFA"/>
+ <enum name="MAX_VERTEX_UNIFORM_VECTORS" value="0x8DFB"/>
+ <enum name="MAX_VARYING_VECTORS" value="0x8DFC"/>
+ <enum name="MAX_FRAGMENT_UNIFORM_VECTORS" value="0x8DFD"/>
+
+ <function name="GetShaderPrecisionFormat" offset="assign">
+ <param name="shadertype" type="GLenum"/>
+ <param name="precisiontype" type="GLenum"/>
+ <param name="range" type="GLint *"/>
+ <param name="precision" type="GLint *"/>
+ </function>
+
+ <function name="ReleaseShaderCompiler" offset="assign">
+ </function>
+
+ <function name="ShaderBinary" offset="assign">
+ <param name="n" type="GLsizei"/>
+ <param name="shaders" type="const GLuint *"/>
+ <param name="binaryformat" type="GLenum"/>
+ <param name="binary" type="const GLvoid *"/>
+ <param name="length" type="GLsizei"/>
+ </function>
+
+ <!-- from GL_OES_fixed_point -->
+ <enum name="FIXED" value="0x140C"/>
+ <type name="fixed" size="4" />
+
+ <!-- from GL_OES_read_format -->
+ <enum name="IMPLEMENTATION_COLOR_READ_TYPE" value="0x8B9A"/>
+ <enum name="IMPLEMENTATION_COLOR_READ_FORMAT" value="0x8B9B"/>
+
+ <!-- from GL_OES_single_precision -->
+ <function name="ClearDepthf" offset="assign">
+ <param name="depth" type="GLclampf"/>
+ </function>
+
+ <function name="DepthRangef" offset="assign">
+ <param name="zNear" type="GLclampf"/>
+ <param name="zFar" type="GLclampf"/>
+ </function>
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml b/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml
index b65f26b3d..0b6947cc5 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml
@@ -1,38 +1,38 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-
-<OpenGLAPI>
-
-<category name="GL_ARB_draw_buffers_blend" number="69">
-
- <function name="BlendEquationiARB" offset="assign">
- <param name="buf" type="GLuint"/>
- <param name="mode" type="GLenum"/>
- </function>
-
- <function name="BlendEquationSeparateiARB" offset="assign">
- <param name="buf" type="GLuint"/>
- <param name="modeRGB" type="GLenum"/>
- <param name="modeA" type="GLenum"/>
- </function>
-
- <function name="BlendFunciARB" offset="assign">
- <param name="buf" type="GLuint"/>
- <param name="src" type="GLenum"/>
- <param name="dst" type="GLenum"/>
- </function>
-
- <function name="BlendFuncSeparateiARB" offset="assign">
- <param name="buf" type="GLuint"/>
- <param name="srcRGB" type="GLenum"/>
- <param name="dstRGB" type="GLenum"/>
- <param name="srcA" type="GLenum"/>
- <param name="dstA" type="GLenum"/>
- </function>
-
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_ARB_draw_buffers_blend" number="69">
+
+ <function name="BlendEquationiARB" offset="assign">
+ <param name="buf" type="GLuint"/>
+ <param name="mode" type="GLenum"/>
+ </function>
+
+ <function name="BlendEquationSeparateiARB" offset="assign">
+ <param name="buf" type="GLuint"/>
+ <param name="modeRGB" type="GLenum"/>
+ <param name="modeA" type="GLenum"/>
+ </function>
+
+ <function name="BlendFunciARB" offset="assign">
+ <param name="buf" type="GLuint"/>
+ <param name="src" type="GLenum"/>
+ <param name="dst" type="GLenum"/>
+ </function>
+
+ <function name="BlendFuncSeparateiARB" offset="assign">
+ <param name="buf" type="GLuint"/>
+ <param name="srcRGB" type="GLenum"/>
+ <param name="dstRGB" type="GLenum"/>
+ <param name="srcA" type="GLenum"/>
+ <param name="dstA" type="GLenum"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml b/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml
index 016e64799..57bb776ac 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_draw_instanced.xml
@@ -1,49 +1,49 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-
-<OpenGLAPI>
-
-<category name="GL_ARB_draw_instanced" number="44">
-
- <function name="DrawArraysInstancedARB" offset="assign">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="primcount" type="GLsizei"/>
- </function>
-
- <function name="DrawElementsInstancedARB" offset="assign">
- <param name="mode" type="GLenum"/>
- <param name="count" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid *"/>
- <param name="primcount" type="GLsizei"/>
- </function>
-
-</category>
-
-
-<category name="GL_EXT_draw_instanced" number="327">
-
- <function name="DrawArraysInstancedEXT" alias="DrawArraysInstancedARB">
- <param name="mode" type="GLenum"/>
- <param name="first" type="GLint"/>
- <param name="count" type="GLsizei"/>
- <param name="primcount" type="GLsizei"/>
- </function>
-
- <function name="DrawElementsInstancedEXT" alias="DrawElementsInstancedARB">
- <param name="mode" type="GLenum"/>
- <param name="count" type="GLsizei"/>
- <param name="type" type="GLenum"/>
- <param name="indices" type="const GLvoid *"/>
- <param name="primcount" type="GLsizei"/>
- </function>
-
-</category>
-
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_ARB_draw_instanced" number="44">
+
+ <function name="DrawArraysInstancedARB" offset="assign">
+ <param name="mode" type="GLenum"/>
+ <param name="first" type="GLint"/>
+ <param name="count" type="GLsizei"/>
+ <param name="primcount" type="GLsizei"/>
+ </function>
+
+ <function name="DrawElementsInstancedARB" offset="assign">
+ <param name="mode" type="GLenum"/>
+ <param name="count" type="GLsizei"/>
+ <param name="type" type="GLenum"/>
+ <param name="indices" type="const GLvoid *"/>
+ <param name="primcount" type="GLsizei"/>
+ </function>
+
+</category>
+
+
+<category name="GL_EXT_draw_instanced" number="327">
+
+ <function name="DrawArraysInstancedEXT" alias="DrawArraysInstancedARB">
+ <param name="mode" type="GLenum"/>
+ <param name="first" type="GLint"/>
+ <param name="count" type="GLsizei"/>
+ <param name="primcount" type="GLsizei"/>
+ </function>
+
+ <function name="DrawElementsInstancedEXT" alias="DrawElementsInstancedARB">
+ <param name="mode" type="GLenum"/>
+ <param name="count" type="GLsizei"/>
+ <param name="type" type="GLenum"/>
+ <param name="indices" type="const GLvoid *"/>
+ <param name="primcount" type="GLsizei"/>
+ </function>
+
+</category>
+
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml b/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml
index 86d78df0a..822f54374 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_instanced_arrays.xml
@@ -1,21 +1,21 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-
-<OpenGLAPI>
-
-<category name="GL_ARB_instanced_arrays" number="49">
-
- <enum name="VERTEX_ATTRIB_ARRAY_DIVISOR_ARB" value="0x88FE"/>
-
- <function name="VertexAttribDivisorARB" offset="assign">
- <param name="index" type="GLuint"/>
- <param name="divisor" type="GLuint"/>
- </function>
-
-</category>
-
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_ARB_instanced_arrays" number="49">
+
+ <enum name="VERTEX_ATTRIB_ARRAY_DIVISOR_ARB" value="0x88FE"/>
+
+ <function name="VertexAttribDivisorARB" offset="assign">
+ <param name="index" type="GLuint"/>
+ <param name="divisor" type="GLuint"/>
+ </function>
+
+</category>
+
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml b/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml
index 82f0ec1dc..57680f553 100644
--- a/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml
+++ b/mesalib/src/mapi/glapi/gen/ARB_texture_buffer_object.xml
@@ -1,22 +1,22 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-
-<category name="GL_ARB_texture_buffer_object" number="51">
-
- <enum name="TEXTURE_BUFFER_ARB" value="0x8C2A"/>
- <enum name="MAX_TEXTURE_BUFFER_SIZE_ARB" value="0x8C2B"/>
- <enum name="TEXTURE_BINDING_BUFFER_ARB" value="0x8C2C"/>
- <enum name="TEXTURE_BUFFER_DATA_STORE_BINDING_ARB" value="0x8C2D"/>
- <enum name="TEXTURE_BUFFER_FORMAT_ARB" value="0x8C2E"/>
-
- <function name="TexBufferARB" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="internalFormat" type="GLenum"/>
- <param name="buffer" type="GLuint"/>
- </function>
-
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_ARB_texture_buffer_object" number="51">
+
+ <enum name="TEXTURE_BUFFER_ARB" value="0x8C2A"/>
+ <enum name="MAX_TEXTURE_BUFFER_SIZE_ARB" value="0x8C2B"/>
+ <enum name="TEXTURE_BINDING_BUFFER_ARB" value="0x8C2C"/>
+ <enum name="TEXTURE_BUFFER_DATA_STORE_BINDING_ARB" value="0x8C2D"/>
+ <enum name="TEXTURE_BUFFER_FORMAT_ARB" value="0x8C2E"/>
+
+ <function name="TexBufferARB" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="internalFormat" type="GLenum"/>
+ <param name="buffer" type="GLuint"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml b/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml
index f338aa3b6..6ec56157c 100644
--- a/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml
+++ b/mesalib/src/mapi/glapi/gen/EXT_separate_shader_objects.xml
@@ -1,26 +1,26 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-<OpenGLAPI>
-<category name="GL_EXT_separate_shader_objects" number="377">
- <!-- Alias of CURRENT_PROGRAM -->
- <enum name="ACTIVE_PROGRAM_EXT" value="0x8B8D"/>
-
- <function name="UseShaderProgramEXT" offset="assign">
- <param name="type" type="GLenum"/>
- <param name="program" type="GLuint"/>
- </function>
-
- <function name="ActiveProgramEXT" offset="assign">
- <param name="program" type="GLuint"/>
- </function>
-
- <function name="CreateShaderProgramEXT" offset="assign">
- <param name="type" type="GLenum"/>
- <param name="string" type="const GLchar *"/>
- <return type="GLuint"/>
- </function>
-</category>
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+<OpenGLAPI>
+<category name="GL_EXT_separate_shader_objects" number="377">
+ <!-- Alias of CURRENT_PROGRAM -->
+ <enum name="ACTIVE_PROGRAM_EXT" value="0x8B8D"/>
+
+ <function name="UseShaderProgramEXT" offset="assign">
+ <param name="type" type="GLenum"/>
+ <param name="program" type="GLuint"/>
+ </function>
+
+ <function name="ActiveProgramEXT" offset="assign">
+ <param name="program" type="GLuint"/>
+ </function>
+
+ <function name="CreateShaderProgramEXT" offset="assign">
+ <param name="type" type="GLenum"/>
+ <param name="string" type="const GLchar *"/>
+ <return type="GLuint"/>
+ </function>
+</category>
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml b/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml
index c33c12d1d..7e5a8cbeb 100644
--- a/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml
+++ b/mesalib/src/mapi/glapi/gen/EXT_texture_integer.xml
@@ -1,98 +1,98 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-
-<category name="GL_EXT_texture_integer" number="343">
-
- <enum name="RGBA_INTEGER_MODE_EXT" value="0x8D9E">
- <size name="Get" mode="get"/>
- </enum>
- <enum name="RGBA32UI_EXT" value="0x8D70"/>
- <enum name="RGB32UI_EXT" value="0x8D71"/>
- <enum name="ALPHA32UI_EXT" value="0x8D72"/>
- <enum name="INTENSITY32UI_EXT" value="0x8D73"/>
- <enum name="LUMINANCE32UI_EXT" value="0x8D74"/>
- <enum name="LUMINANCE_ALPHA32UI_EXT" value="0x8D75"/>
- <enum name="RGBA16UI_EXT" value="0x8D76"/>
- <enum name="RGB16UI_EXT" value="0x8D77"/>
- <enum name="ALPHA16UI_EXT" value="0x8D78"/>
- <enum name="INTENSITY16UI_EXT" value="0x8D79"/>
- <enum name="LUMINANCE16UI_EXT" value="0x8D7A"/>
- <enum name="LUMINANCE_ALPHA16UI_EXT" value="0x8D7B"/>
- <enum name="RGBA8UI_EXT" value="0x8D7C"/>
- <enum name="RGB8UI_EXT" value="0x8D7D"/>
- <enum name="ALPHA8UI_EXT" value="0x8D7E"/>
- <enum name="INTENSITY8UI_EXT" value="0x8D7F"/>
- <enum name="LUMINANCE8UI_EXT" value="0x8D80"/>
- <enum name="LUMINANCE_ALPHA8UI_EXT" value="0x8D81"/>
- <enum name="RGBA32I_EXT" value="0x8D82"/>
- <enum name="RGB32I_EXT" value="0x8D83"/>
- <enum name="ALPHA32I_EXT" value="0x8D84"/>
- <enum name="INTENSITY32I_EXT" value="0x8D85"/>
- <enum name="LUMINANCE32I_EXT" value="0x8D86"/>
- <enum name="LUMINANCE_ALPHA32I_EXT" value="0x8D87"/>
- <enum name="RGBA16I_EXT" value="0x8D88"/>
- <enum name="RGB16I_EXT" value="0x8D89"/>
- <enum name="ALPHA16I_EXT" value="0x8D8A"/>
- <enum name="INTENSITY16I_EXT" value="0x8D8B"/>
- <enum name="LUMINANCE16I_EXT" value="0x8D8C"/>
- <enum name="LUMINANCE_ALPHA16I_EXT" value="0x8D8D"/>
- <enum name="RGBA8I_EXT" value="0x8D8E"/>
- <enum name="RGB8I_EXT" value="0x8D8F"/>
- <enum name="ALPHA8I_EXT" value="0x8D90"/>
- <enum name="INTENSITY8I_EXT" value="0x8D91"/>
- <enum name="LUMINANCE8I_EXT" value="0x8D92"/>
- <enum name="LUMINANCE_ALPHA8I_EXT" value="0x8D93"/>
- <enum name="RED_INTEGER_EXT" value="0x8D94"/>
- <enum name="GREEN_INTEGER_EXT" value="0x8D95"/>
- <enum name="BLUE_INTEGER_EXT" value="0x8D96"/>
- <enum name="ALPHA_INTEGER_EXT" value="0x8D97"/>
- <enum name="RGB_INTEGER_EXT" value="0x8D98"/>
- <enum name="RGBA_INTEGER_EXT" value="0x8D99"/>
- <enum name="BGR_INTEGER_EXT" value="0x8D9A"/>
- <enum name="BGRA_INTEGER_EXT" value="0x8D9B"/>
- <enum name="LUMINANCE_INTEGER_EXT" value="0x8D9C"/>
- <enum name="LUMINANCE_ALPHA_INTEGER_EXT" value="0x8D9D"/>
-
- <function name="ClearColorIiEXT" offset="assign">
- <param name="r" type="GLint"/>
- <param name="g" type="GLint"/>
- <param name="b" type="GLint"/>
- <param name="a" type="GLint"/>
- </function>
-
- <function name="ClearColorIuiEXT" offset="assign">
- <param name="r" type="GLuint"/>
- <param name="g" type="GLuint"/>
- <param name="b" type="GLuint"/>
- <param name="a" type="GLuint"/>
- </function>
-
- <function name="TexParameterIivEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLint *"/>
- </function>
-
- <function name="TexParameterIuivEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="const GLuint *"/>
- </function>
-
- <function name="GetTexParameterIivEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLint *"/>
- </function>
-
- <function name="GetTexParameterIuivEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="pname" type="GLenum"/>
- <param name="params" type="GLuint *"/>
- </function>
-
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_EXT_texture_integer" number="343">
+
+ <enum name="RGBA_INTEGER_MODE_EXT" value="0x8D9E">
+ <size name="Get" mode="get"/>
+ </enum>
+ <enum name="RGBA32UI_EXT" value="0x8D70"/>
+ <enum name="RGB32UI_EXT" value="0x8D71"/>
+ <enum name="ALPHA32UI_EXT" value="0x8D72"/>
+ <enum name="INTENSITY32UI_EXT" value="0x8D73"/>
+ <enum name="LUMINANCE32UI_EXT" value="0x8D74"/>
+ <enum name="LUMINANCE_ALPHA32UI_EXT" value="0x8D75"/>
+ <enum name="RGBA16UI_EXT" value="0x8D76"/>
+ <enum name="RGB16UI_EXT" value="0x8D77"/>
+ <enum name="ALPHA16UI_EXT" value="0x8D78"/>
+ <enum name="INTENSITY16UI_EXT" value="0x8D79"/>
+ <enum name="LUMINANCE16UI_EXT" value="0x8D7A"/>
+ <enum name="LUMINANCE_ALPHA16UI_EXT" value="0x8D7B"/>
+ <enum name="RGBA8UI_EXT" value="0x8D7C"/>
+ <enum name="RGB8UI_EXT" value="0x8D7D"/>
+ <enum name="ALPHA8UI_EXT" value="0x8D7E"/>
+ <enum name="INTENSITY8UI_EXT" value="0x8D7F"/>
+ <enum name="LUMINANCE8UI_EXT" value="0x8D80"/>
+ <enum name="LUMINANCE_ALPHA8UI_EXT" value="0x8D81"/>
+ <enum name="RGBA32I_EXT" value="0x8D82"/>
+ <enum name="RGB32I_EXT" value="0x8D83"/>
+ <enum name="ALPHA32I_EXT" value="0x8D84"/>
+ <enum name="INTENSITY32I_EXT" value="0x8D85"/>
+ <enum name="LUMINANCE32I_EXT" value="0x8D86"/>
+ <enum name="LUMINANCE_ALPHA32I_EXT" value="0x8D87"/>
+ <enum name="RGBA16I_EXT" value="0x8D88"/>
+ <enum name="RGB16I_EXT" value="0x8D89"/>
+ <enum name="ALPHA16I_EXT" value="0x8D8A"/>
+ <enum name="INTENSITY16I_EXT" value="0x8D8B"/>
+ <enum name="LUMINANCE16I_EXT" value="0x8D8C"/>
+ <enum name="LUMINANCE_ALPHA16I_EXT" value="0x8D8D"/>
+ <enum name="RGBA8I_EXT" value="0x8D8E"/>
+ <enum name="RGB8I_EXT" value="0x8D8F"/>
+ <enum name="ALPHA8I_EXT" value="0x8D90"/>
+ <enum name="INTENSITY8I_EXT" value="0x8D91"/>
+ <enum name="LUMINANCE8I_EXT" value="0x8D92"/>
+ <enum name="LUMINANCE_ALPHA8I_EXT" value="0x8D93"/>
+ <enum name="RED_INTEGER_EXT" value="0x8D94"/>
+ <enum name="GREEN_INTEGER_EXT" value="0x8D95"/>
+ <enum name="BLUE_INTEGER_EXT" value="0x8D96"/>
+ <enum name="ALPHA_INTEGER_EXT" value="0x8D97"/>
+ <enum name="RGB_INTEGER_EXT" value="0x8D98"/>
+ <enum name="RGBA_INTEGER_EXT" value="0x8D99"/>
+ <enum name="BGR_INTEGER_EXT" value="0x8D9A"/>
+ <enum name="BGRA_INTEGER_EXT" value="0x8D9B"/>
+ <enum name="LUMINANCE_INTEGER_EXT" value="0x8D9C"/>
+ <enum name="LUMINANCE_ALPHA_INTEGER_EXT" value="0x8D9D"/>
+
+ <function name="ClearColorIiEXT" offset="assign">
+ <param name="r" type="GLint"/>
+ <param name="g" type="GLint"/>
+ <param name="b" type="GLint"/>
+ <param name="a" type="GLint"/>
+ </function>
+
+ <function name="ClearColorIuiEXT" offset="assign">
+ <param name="r" type="GLuint"/>
+ <param name="g" type="GLuint"/>
+ <param name="b" type="GLuint"/>
+ <param name="a" type="GLuint"/>
+ </function>
+
+ <function name="TexParameterIivEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="pname" type="GLenum"/>
+ <param name="params" type="const GLint *"/>
+ </function>
+
+ <function name="TexParameterIuivEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="pname" type="GLenum"/>
+ <param name="params" type="const GLuint *"/>
+ </function>
+
+ <function name="GetTexParameterIivEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="pname" type="GLenum"/>
+ <param name="params" type="GLint *"/>
+ </function>
+
+ <function name="GetTexParameterIuivEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="pname" type="GLenum"/>
+ <param name="params" type="GLuint *"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml b/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml
index bf9887a71..051f1e0cc 100644
--- a/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml
+++ b/mesalib/src/mapi/glapi/gen/EXT_transform_feedback.xml
@@ -1,118 +1,118 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-
-<OpenGLAPI>
-
-<category name="GL_EXT_transform_feedback" number="352">
-
- <enum name="TRANSFORM_FEEDBACK_BUFFER_EXT" value="0x8C8E"/>
- <enum name="TRANSFORM_FEEDBACK_BUFFER_START_EXT" value="0x8C84"/>
- <enum name="TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT" value="0x8C85"/>
- <enum name="TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT" value="0x8C8F"/>
- <enum name="INTERLEAVED_ATTRIBS_EXT" value="0x8C8C"/>
- <enum name="SEPARATE_ATTRIBS_EXT" value="0x8C8D"/>
- <enum name="PRIMITIVES_GENERATED_EXT" value="0x8C87"/>
- <enum name="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT" value="0x8C88"/>
- <enum name="RASTERIZER_DISCARD_EXT" value="0x8C89"/>
- <enum name="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT" value="0x8C8A"/>
- <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT" value="0x8C8B"/>
- <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT" value="0x8C80"/>
- <enum name="TRANSFORM_FEEDBACK_VARYINGS_EXT" value="0x8C83"/>
- <enum name="TRANSFORM_FEEDBACK_BUFFER_MODE_EXT" value="0x8C7F"/>
- <enum name="TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT" value="0x8C76"/>
-
- <function name="BindBufferRangeEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="buffer" type="GLuint"/>
- <param name="offset" type="GLintptr"/>
- <param name="size" type="GLsizeiptr"/>
- </function>
-
- <function name="BindBufferOffsetEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="buffer" type="GLuint"/>
- <param name="offset" type="GLintptr"/>
- </function>
-
- <function name="BindBufferBaseEXT" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="index" type="GLuint"/>
- <param name="buffer" type="GLuint"/>
- </function>
-
- <function name="BeginTransformFeedbackEXT" offset="assign">
- <param name="mode" type="GLenum"/>
- </function>
-
- <function name="EndTransformFeedbackEXT" offset="assign">
- </function>
-
- <function name="TransformFeedbackVaryingsEXT" offset="assign">
- <param name="program" type="GLuint"/>
- <param name="count" type="GLsizei"/>
- <param name="varyings" type="const char **"/>
- <param name="bufferMode" type="GLenum"/>
- </function>
-
- <function name="GetTransformFeedbackVaryingEXT" offset="assign">
- <param name="program" type="GLuint"/>
- <param name="index" type="GLuint"/>
- <param name="bufSize" type="GLsizei"/>
- <param name="length" type="GLsizei *"/>
- <param name="size" type="GLsizei *"/>
- <param name="type" type="GLenum *"/>
- <param name="name" type="GLchar *"/>
- </function>
-
- <!-- Note: the glGetIntegerIndexedvEXT() and glGetBooleanIndexedvEXT
- functions are defined in the EXT_draw_buffers2.xml file -->
-
-</category>
-
-
-<category name="GL_ARB_transform_feedback2" number="93">
-
- <enum name="TRANSFORM_FEEDBACK" value="0x8E22"/>
- <enum name="TRANSFORM_FEEDBACK_BUFFER_PAUSED" value="0x8E23"/>
- <enum name="TRANSFORM_FEEDBACK_BUFFER_ACTIVE" value="0x8E24"/>
- <enum name="TRANSFORM_FEEDBACK_BINDING" value="0x8E25"/>
-
- <function name="BindTransformFeedback" offset="assign">
- <param name="target" type="GLenum"/>
- <param name="id" type="GLuint"/>
- </function>
-
- <function name="DeleteTransformFeedbacks" offset="assign">
- <param name="n" type="GLsizei"/>
- <param name="ids" type="const GLuint *"/>
- </function>
-
- <function name="GenTransformFeedbacks" offset="assign">
- <param name="n" type="GLsizei"/>
- <param name="ids" type="GLuint *"/>
- </function>
-
- <function name="IsTransformFeedback" offset="assign">
- <param name="id" type="GLuint"/>
- <return type="GLboolean"/>
- </function>
-
- <function name="PauseTransformFeedback" offset="assign">
- </function>
-
- <function name="ResumeTransformFeedback" offset="assign">
- </function>
-
- <function name="DrawTransformFeedback" offset="assign">
- <param name="mode" type="GLenum"/>
- <param name="id" type="GLuint"/>
- </function>
-
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_EXT_transform_feedback" number="352">
+
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_EXT" value="0x8C8E"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_START_EXT" value="0x8C84"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT" value="0x8C85"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT" value="0x8C8F"/>
+ <enum name="INTERLEAVED_ATTRIBS_EXT" value="0x8C8C"/>
+ <enum name="SEPARATE_ATTRIBS_EXT" value="0x8C8D"/>
+ <enum name="PRIMITIVES_GENERATED_EXT" value="0x8C87"/>
+ <enum name="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT" value="0x8C88"/>
+ <enum name="RASTERIZER_DISCARD_EXT" value="0x8C89"/>
+ <enum name="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT" value="0x8C8A"/>
+ <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT" value="0x8C8B"/>
+ <enum name="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT" value="0x8C80"/>
+ <enum name="TRANSFORM_FEEDBACK_VARYINGS_EXT" value="0x8C83"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_MODE_EXT" value="0x8C7F"/>
+ <enum name="TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT" value="0x8C76"/>
+
+ <function name="BindBufferRangeEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ <param name="offset" type="GLintptr"/>
+ <param name="size" type="GLsizeiptr"/>
+ </function>
+
+ <function name="BindBufferOffsetEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ <param name="offset" type="GLintptr"/>
+ </function>
+
+ <function name="BindBufferBaseEXT" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="index" type="GLuint"/>
+ <param name="buffer" type="GLuint"/>
+ </function>
+
+ <function name="BeginTransformFeedbackEXT" offset="assign">
+ <param name="mode" type="GLenum"/>
+ </function>
+
+ <function name="EndTransformFeedbackEXT" offset="assign">
+ </function>
+
+ <function name="TransformFeedbackVaryingsEXT" offset="assign">
+ <param name="program" type="GLuint"/>
+ <param name="count" type="GLsizei"/>
+ <param name="varyings" type="const char **"/>
+ <param name="bufferMode" type="GLenum"/>
+ </function>
+
+ <function name="GetTransformFeedbackVaryingEXT" offset="assign">
+ <param name="program" type="GLuint"/>
+ <param name="index" type="GLuint"/>
+ <param name="bufSize" type="GLsizei"/>
+ <param name="length" type="GLsizei *"/>
+ <param name="size" type="GLsizei *"/>
+ <param name="type" type="GLenum *"/>
+ <param name="name" type="GLchar *"/>
+ </function>
+
+ <!-- Note: the glGetIntegerIndexedvEXT() and glGetBooleanIndexedvEXT
+ functions are defined in the EXT_draw_buffers2.xml file -->
+
+</category>
+
+
+<category name="GL_ARB_transform_feedback2" number="93">
+
+ <enum name="TRANSFORM_FEEDBACK" value="0x8E22"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_PAUSED" value="0x8E23"/>
+ <enum name="TRANSFORM_FEEDBACK_BUFFER_ACTIVE" value="0x8E24"/>
+ <enum name="TRANSFORM_FEEDBACK_BINDING" value="0x8E25"/>
+
+ <function name="BindTransformFeedback" offset="assign">
+ <param name="target" type="GLenum"/>
+ <param name="id" type="GLuint"/>
+ </function>
+
+ <function name="DeleteTransformFeedbacks" offset="assign">
+ <param name="n" type="GLsizei"/>
+ <param name="ids" type="const GLuint *"/>
+ </function>
+
+ <function name="GenTransformFeedbacks" offset="assign">
+ <param name="n" type="GLsizei"/>
+ <param name="ids" type="GLuint *"/>
+ </function>
+
+ <function name="IsTransformFeedback" offset="assign">
+ <param name="id" type="GLuint"/>
+ <return type="GLboolean"/>
+ </function>
+
+ <function name="PauseTransformFeedback" offset="assign">
+ </function>
+
+ <function name="ResumeTransformFeedback" offset="assign">
+ </function>
+
+ <function name="DrawTransformFeedback" offset="assign">
+ <param name="mode" type="GLenum"/>
+ <param name="id" type="GLuint"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml b/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml
index 0b5588fd4..abe7dda00 100644
--- a/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml
+++ b/mesalib/src/mapi/glapi/gen/NV_primitive_restart.xml
@@ -1,23 +1,23 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-
-<OpenGLAPI>
-
-<category name="GL_NV_primitive_restart" number="285">
-
- <enum name="PRIMITIVE_RESTART_NV" value="0x8558"/>
- <enum name="PRIMITIVE_RESTART_INDEX_NV" value="0x8559"/>
-
- <function name="PrimitiveRestartNV" offset="assign">
- </function>
-
- <function name="PrimitiveRestartIndexNV" offset="assign">
- <param name="index" type="GLuint"/>
- </function>
-
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_NV_primitive_restart" number="285">
+
+ <enum name="PRIMITIVE_RESTART_NV" value="0x8558"/>
+ <enum name="PRIMITIVE_RESTART_INDEX_NV" value="0x8559"/>
+
+ <function name="PrimitiveRestartNV" offset="assign">
+ </function>
+
+ <function name="PrimitiveRestartIndexNV" offset="assign">
+ <param name="index" type="GLuint"/>
+ </function>
+
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml b/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml
index dc707d0ab..52b1a3c08 100644
--- a/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml
+++ b/mesalib/src/mapi/glapi/gen/NV_texture_barrier.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<!-- Note: no GLX protocol info yet. -->
-
-
-<OpenGLAPI>
-
-<category name="GL_NV_texture_barrier" number="381">
- <function name="TextureBarrierNV" offset="assign" />
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<!-- Note: no GLX protocol info yet. -->
+
+
+<OpenGLAPI>
+
+<category name="GL_NV_texture_barrier" number="381">
+ <function name="TextureBarrierNV" offset="assign" />
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/glX_API.xml b/mesalib/src/mapi/glapi/gen/glX_API.xml
index 7e6a06685..b7f4a7770 100644
--- a/mesalib/src/mapi/glapi/gen/glX_API.xml
+++ b/mesalib/src/mapi/glapi/gen/glX_API.xml
@@ -1,234 +1,234 @@
-<?xml version="1.0"?>
-<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
-
-<OpenGLAPI>
-
-<!-- Right now this file is just used to generate the GLX protocol
- decode tables on the server. The only information that is needed
- for that purpose is the name of the function (or pseudo-function
- in the case of Render of VendorPrivate) and its opcode. Once
- this file is used for other purposes, additional information will
- need to be added.
- -->
-
-<category name="1.0" window_system="glX">
- <function name="Render">
- <glx sop="1"/>
- </function>
-
- <function name="RenderLarge">
- <glx sop="2"/>
- </function>
-
- <function name="CreateContext">
- <glx sop="3"/>
- </function>
-
- <function name="DestroyContext">
- <glx sop="4"/>
- </function>
-
- <function name="MakeCurrent">
- <glx sop="5"/>
- </function>
-
- <function name="IsDirect">
- <glx sop="6"/>
- </function>
-
- <function name="QueryVersion">
- <glx sop="7"/>
- </function>
-
- <function name="WaitGL">
- <glx sop="8"/>
- </function>
-
- <function name="WaitX">
- <glx sop="9"/>
- </function>
-
- <function name="CopyContext">
- <glx sop="10"/>
- </function>
-
- <function name="SwapBuffers">
- <glx sop="11"/>
- </function>
-
- <function name="UseXFont">
- <glx sop="12"/>
- </function>
-
- <function name="CreateGLXPixmap">
- <glx sop="13"/>
- </function>
-
- <function name="GetVisualConfigs">
- <glx sop="14"/>
- </function>
-
- <function name="DestroyGLXPixmap">
- <glx sop="15"/>
- </function>
-
- <function name="VendorPrivate">
- <glx sop="16"/>
- </function>
-
- <function name="VendorPrivateWithReply">
- <glx sop="17"/>
- </function>
-
- <function name="QueryExtensionsString">
- <glx sop="18"/>
- </function>
-</category>
-
-<category name="1.1" window_system="glX">
- <function name="QueryServerString">
- <glx sop="19"/>
- </function>
-
- <function name="ClientInfo">
- <glx sop="20"/>
- </function>
-</category>
-
-<category name="1.3" window_system="glX">
- <function name="GetFBConfigs">
- <glx sop="21"/>
- </function>
-
- <function name="CreatePixmap">
- <glx sop="22"/>
- </function>
-
- <function name="DestroyPixmap">
- <glx sop="23"/>
- </function>
-
- <function name="CreateNewContext">
- <glx sop="24"/>
- </function>
-
- <function name="QueryContext">
- <glx sop="25"/>
- </function>
-
- <function name="MakeContextCurrent">
- <glx sop="26"/>
- </function>
-
- <function name="CreatePbuffer">
- <glx sop="27"/>
- </function>
-
- <function name="DestroyPbuffer">
- <glx sop="28"/>
- </function>
-
- <function name="GetDrawableAttributes">
- <glx sop="29"/>
- </function>
-
- <function name="ChangeDrawableAttributes">
- <glx sop="30"/>
- </function>
-
- <function name="CreateWindow">
- <glx sop="31"/>
- </function>
-
- <function name="DestroyWindow">
- <glx sop="32"/>
- </function>
-</category>
-
-<category name="GLX_SGI_swap_control" number="40" window_system="glX">
- <function name="SwapIntervalSGI">
- <return type="int"/>
- <glx vendorpriv="65536"/>
- </function>
-</category>
-
-<category name="GLX_SGI_make_current_read" number="42" window_system="glX">
- <function name="MakeCurrentReadSGI">
-<!-- <param name="dpy" type="Display *"/>
- <param name="draw" type="GLXDrawable"/>
- <param name="read" type="GLXDrawable"/>
- <param name="ctx" type="GLXContext"/> -->
- <return type="Bool"/>
- <glx vendorpriv="65537"/>
- </function>
-</category>
-
-<category name="GLX_EXT_import_context" number="47" window_system="glX">
- <function name="QueryContextInfoEXT">
- <glx vendorpriv="1024"/>
- </function>
-</category>
-
-<category name="GLX_SGIX_fbconfig" number="49" window_system="glX">
- <function name="GetFBConfigsSGIX">
- <glx vendorpriv="65540"/>
- </function>
-
- <function name="CreateContextWithConfigSGIX">
- <glx vendorpriv="65541"/>
- </function>
-
- <function name="CreateGLXPixmapWithConfigSGIX">
- <glx vendorpriv="65542"/>
- </function>
-</category>
-
-<category name="GLX_SGIX_pbuffer" number="50" window_system="glX">
- <function name="CreateGLXPbufferSGIX">
- <glx vendorpriv="65543"/>
- </function>
-
- <function name="DestroyGLXPbufferSGIX">
- <glx vendorpriv="65544"/>
- </function>
-
- <function name="ChangeDrawableAttributesSGIX">
- <glx vendorpriv="65545"/>
- </function>
-
- <function name="GetDrawableAttributesSGIX">
- <glx vendorpriv="65546"/>
- </function>
-</category>
-
-<category name="GLX_MESA_copy_sub_buffer" number="215">
- <function name="CopySubBufferMESA">
- <glx vendorpriv="5154"/>
- </function>
-</category>
-
-<category name="GLX_EXT_texture_from_pixmap">
- <function name="BindTexImageEXT">
- <glx vendorpriv="1330"/>
- </function>
-
- <function name="ReleaseTexImageEXT">
- <glx vendorpriv="1331"/>
- </function>
-</category>
-
-<category name="GLX_ARB_create_context" number="56">
- <function name="SetClientInfoARB">
- <glx sop="33"/>
- </function>
-
- <function name="CreateContextAttribsARB">
- <glx sop="34"/>
- </function>
-
- <function name="SetClientInfo2ARB">
- <glx sop="35"/>
- </function>
-</category>
-
-</OpenGLAPI>
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<!-- Right now this file is just used to generate the GLX protocol
+ decode tables on the server. The only information that is needed
+ for that purpose is the name of the function (or pseudo-function
+ in the case of Render of VendorPrivate) and its opcode. Once
+ this file is used for other purposes, additional information will
+ need to be added.
+ -->
+
+<category name="1.0" window_system="glX">
+ <function name="Render">
+ <glx sop="1"/>
+ </function>
+
+ <function name="RenderLarge">
+ <glx sop="2"/>
+ </function>
+
+ <function name="CreateContext">
+ <glx sop="3"/>
+ </function>
+
+ <function name="DestroyContext">
+ <glx sop="4"/>
+ </function>
+
+ <function name="MakeCurrent">
+ <glx sop="5"/>
+ </function>
+
+ <function name="IsDirect">
+ <glx sop="6"/>
+ </function>
+
+ <function name="QueryVersion">
+ <glx sop="7"/>
+ </function>
+
+ <function name="WaitGL">
+ <glx sop="8"/>
+ </function>
+
+ <function name="WaitX">
+ <glx sop="9"/>
+ </function>
+
+ <function name="CopyContext">
+ <glx sop="10"/>
+ </function>
+
+ <function name="SwapBuffers">
+ <glx sop="11"/>
+ </function>
+
+ <function name="UseXFont">
+ <glx sop="12"/>
+ </function>
+
+ <function name="CreateGLXPixmap">
+ <glx sop="13"/>
+ </function>
+
+ <function name="GetVisualConfigs">
+ <glx sop="14"/>
+ </function>
+
+ <function name="DestroyGLXPixmap">
+ <glx sop="15"/>
+ </function>
+
+ <function name="VendorPrivate">
+ <glx sop="16"/>
+ </function>
+
+ <function name="VendorPrivateWithReply">
+ <glx sop="17"/>
+ </function>
+
+ <function name="QueryExtensionsString">
+ <glx sop="18"/>
+ </function>
+</category>
+
+<category name="1.1" window_system="glX">
+ <function name="QueryServerString">
+ <glx sop="19"/>
+ </function>
+
+ <function name="ClientInfo">
+ <glx sop="20"/>
+ </function>
+</category>
+
+<category name="1.3" window_system="glX">
+ <function name="GetFBConfigs">
+ <glx sop="21"/>
+ </function>
+
+ <function name="CreatePixmap">
+ <glx sop="22"/>
+ </function>
+
+ <function name="DestroyPixmap">
+ <glx sop="23"/>
+ </function>
+
+ <function name="CreateNewContext">
+ <glx sop="24"/>
+ </function>
+
+ <function name="QueryContext">
+ <glx sop="25"/>
+ </function>
+
+ <function name="MakeContextCurrent">
+ <glx sop="26"/>
+ </function>
+
+ <function name="CreatePbuffer">
+ <glx sop="27"/>
+ </function>
+
+ <function name="DestroyPbuffer">
+ <glx sop="28"/>
+ </function>
+
+ <function name="GetDrawableAttributes">
+ <glx sop="29"/>
+ </function>
+
+ <function name="ChangeDrawableAttributes">
+ <glx sop="30"/>
+ </function>
+
+ <function name="CreateWindow">
+ <glx sop="31"/>
+ </function>
+
+ <function name="DestroyWindow">
+ <glx sop="32"/>
+ </function>
+</category>
+
+<category name="GLX_SGI_swap_control" number="40" window_system="glX">
+ <function name="SwapIntervalSGI">
+ <return type="int"/>
+ <glx vendorpriv="65536"/>
+ </function>
+</category>
+
+<category name="GLX_SGI_make_current_read" number="42" window_system="glX">
+ <function name="MakeCurrentReadSGI">
+<!-- <param name="dpy" type="Display *"/>
+ <param name="draw" type="GLXDrawable"/>
+ <param name="read" type="GLXDrawable"/>
+ <param name="ctx" type="GLXContext"/> -->
+ <return type="Bool"/>
+ <glx vendorpriv="65537"/>
+ </function>
+</category>
+
+<category name="GLX_EXT_import_context" number="47" window_system="glX">
+ <function name="QueryContextInfoEXT">
+ <glx vendorpriv="1024"/>
+ </function>
+</category>
+
+<category name="GLX_SGIX_fbconfig" number="49" window_system="glX">
+ <function name="GetFBConfigsSGIX">
+ <glx vendorpriv="65540"/>
+ </function>
+
+ <function name="CreateContextWithConfigSGIX">
+ <glx vendorpriv="65541"/>
+ </function>
+
+ <function name="CreateGLXPixmapWithConfigSGIX">
+ <glx vendorpriv="65542"/>
+ </function>
+</category>
+
+<category name="GLX_SGIX_pbuffer" number="50" window_system="glX">
+ <function name="CreateGLXPbufferSGIX">
+ <glx vendorpriv="65543"/>
+ </function>
+
+ <function name="DestroyGLXPbufferSGIX">
+ <glx vendorpriv="65544"/>
+ </function>
+
+ <function name="ChangeDrawableAttributesSGIX">
+ <glx vendorpriv="65545"/>
+ </function>
+
+ <function name="GetDrawableAttributesSGIX">
+ <glx vendorpriv="65546"/>
+ </function>
+</category>
+
+<category name="GLX_MESA_copy_sub_buffer" number="215">
+ <function name="CopySubBufferMESA">
+ <glx vendorpriv="5154"/>
+ </function>
+</category>
+
+<category name="GLX_EXT_texture_from_pixmap">
+ <function name="BindTexImageEXT">
+ <glx vendorpriv="1330"/>
+ </function>
+
+ <function name="ReleaseTexImageEXT">
+ <glx vendorpriv="1331"/>
+ </function>
+</category>
+
+<category name="GLX_ARB_create_context" number="56">
+ <function name="SetClientInfoARB">
+ <glx sop="33"/>
+ </function>
+
+ <function name="CreateContextAttribsARB">
+ <glx sop="34"/>
+ </function>
+
+ <function name="SetClientInfo2ARB">
+ <glx sop="35"/>
+ </function>
+</category>
+
+</OpenGLAPI>
diff --git a/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py b/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py
index bd904bee2..400e684da 100644
--- a/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py
+++ b/mesalib/src/mapi/glapi/gen/gl_SPARC_asm.py
@@ -1,273 +1,273 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# on the rights to use, copy, modify, merge, publish, distribute, sub
-# license, and/or sell copies of the Software, and to permit persons to whom
-# the Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import license
-import gl_XML, glX_XML
-import sys, getopt
-
-class PrintGenericStubs(gl_XML.gl_print_base):
- def __init__(self):
- gl_XML.gl_print_base.__init__(self)
- self.name = "gl_SPARC_asm.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
-
-
- def printRealHeader(self):
- print '#ifdef __arch64__'
- print '#define GL_OFF(N)\t((N) * 8)'
- print '#define GL_LL\t\tldx'
- print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)'
- print '#define GL_STACK_SIZE\t128'
- print '#else'
- print '#define GL_OFF(N)\t((N) * 4)'
- print '#define GL_LL\t\tld'
- print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)'
- print '#define GL_STACK_SIZE\t64'
- print '#endif'
- print ''
- print '#define GLOBL_FN(x) .globl x ; .type x, @function'
- print '#define HIDDEN(x) .hidden x'
- print ''
- print '\t.register %g2, #scratch'
- print '\t.register %g3, #scratch'
- print ''
- print '\t.text'
- print ''
- print '\tGLOBL_FN(__glapi_sparc_icache_flush)'
- print '\tHIDDEN(__glapi_sparc_icache_flush)'
- print '\t.type\t__glapi_sparc_icache_flush, @function'
- print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
- print '\tflush\t%o0'
- print '\tretl'
- print '\t nop'
- print ''
- print '\t.align\t32'
- print ''
- print '\t.type\t__glapi_sparc_get_pc, @function'
- print '__glapi_sparc_get_pc:'
- print '\tretl'
- print '\t add\t%o7, %g2, %g2'
- print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc'
- print ''
- print '#ifdef GLX_USE_TLS'
- print ''
- print '\tGLOBL_FN(__glapi_sparc_get_dispatch)'
- print '\tHIDDEN(__glapi_sparc_get_dispatch)'
- print '__glapi_sparc_get_dispatch:'
- print '\tmov\t%o7, %g1'
- print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
- print '\tcall\t__glapi_sparc_get_pc'
- print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
- print '\tmov\t%g1, %o7'
- print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
- print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
- print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
- print '\tretl'
- print '\t mov\t%g2, %o0'
- print ''
- print '\t.data'
- print '\t.align\t32'
- print ''
- print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */'
- print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */'
- print '\tGLOBL_FN(__glapi_sparc_tls_stub)'
- print '\tHIDDEN(__glapi_sparc_tls_stub)'
- print '__glapi_sparc_tls_stub: /* Call offset in %g3 */'
- print '\tmov\t%o7, %g1'
- print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
- print '\tcall\t__glapi_sparc_get_pc'
- print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
- print '\tmov\t%g1, %o7'
- print '\tsrl\t%g3, 10, %g3'
- print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
- print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
- print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
- print '\tGL_LL\t[%g7+%g2], %g1'
- print '\tGL_LL\t[%g1 + %g3], %g1'
- print '\tjmp\t%g1'
- print '\t nop'
- print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub'
- print ''
- print '#define GL_STUB(fn, off)\t\t\t\t\\'
- print '\tGLOBL_FN(fn);\t\t\t\t\t\\'
- print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\'
- print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\'
- print '\t.size\tfn,.-fn;'
- print ''
- print '#elif defined(PTHREADS)'
- print ''
- print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */'
- print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */'
- print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */'
- print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */'
- print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */'
- print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */'
- print ''
- print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */'
- print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */'
- print ''
- print '\t.data'
- print '\t.align\t32'
- print ''
- print '\tGLOBL_FN(__glapi_sparc_pthread_stub)'
- print '\tHIDDEN(__glapi_sparc_pthread_stub)'
- print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */'
- print '\tmov\t%o7, %g1'
- print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
- print '\tcall\t__glapi_sparc_get_pc'
- print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
- print '\tmov\t%g1, %o7'
- print '\tsethi\t%hi(_glapi_Dispatch), %g1'
- print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
- print '\tsrl\t%g3, 10, %g3'
- print '\tGL_LL\t[%g2+%g1], %g2'
- print '\tGL_LL\t[%g2], %g1'
- print '\tcmp\t%g1, 0'
- print '\tbe\t2f'
- print '\t nop'
- print '1:\tGL_LL\t[%g1 + %g3], %g1'
- print '\tjmp\t%g1'
- print '\t nop'
- print '2:\tsave\t%sp, GL_STACK_SIZE, %sp'
- print '\tmov\t%g3, %l0'
- print '\tcall\t_glapi_get_dispatch'
- print '\t nop'
- print '\tmov\t%o0, %g1'
- print '\tmov\t%l0, %g3'
- print '\tba\t1b'
- print '\t restore %g0, %g0, %g0'
- print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub'
- print ''
- print '#define GL_STUB(fn, off)\t\t\t\\'
- print '\tGLOBL_FN(fn);\t\t\t\t\\'
- print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\'
- print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
- print '\t.size\tfn,.-fn;'
- print ''
- print '#else /* Non-threaded version. */'
- print ''
- print '\t.type __glapi_sparc_nothread_stub, @function'
- print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */'
- print '\tmov\t%o7, %g1'
- print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
- print '\tcall\t__glapi_sparc_get_pc'
- print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
- print '\tmov\t%g1, %o7'
- print '\tsrl\t%g3, 10, %g3'
- print '\tsethi\t%hi(_glapi_Dispatch), %g1'
- print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
- print '\tGL_LL\t[%g2+%g1], %g2'
- print '\tGL_LL\t[%g2], %g1'
- print '\tGL_LL\t[%g1 + %g3], %g1'
- print '\tjmp\t%g1'
- print '\t nop'
- print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub'
- print ''
- print '#define GL_STUB(fn, off)\t\t\t\\'
- print '\tGLOBL_FN(fn);\t\t\t\t\\'
- print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\'
- print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
- print '\t.size\tfn,.-fn;'
- print ''
- print '#endif'
- print ''
- print '#define GL_STUB_ALIAS(fn, alias) \\'
- print ' .globl fn; \\'
- print ' .set fn, alias'
- print ''
- print '\t.text'
- print '\t.align\t32'
- print ''
- print '\t.globl\tgl_dispatch_functions_start'
- print '\tHIDDEN(gl_dispatch_functions_start)'
- print 'gl_dispatch_functions_start:'
- print ''
- return
-
- def printRealFooter(self):
- print ''
- print '\t.globl\tgl_dispatch_functions_end'
- print '\tHIDDEN(gl_dispatch_functions_end)'
- print 'gl_dispatch_functions_end:'
- return
-
- def printBody(self, api):
- for f in api.functionIterateByOffset():
- name = f.dispatch_name()
-
- print '\tGL_STUB(gl%s, %d)' % (name, f.offset)
-
- if not f.is_static_entry_point(f.name):
- print '\tHIDDEN(gl%s)' % (name)
-
- for f in api.functionIterateByOffset():
- name = f.dispatch_name()
-
- if f.is_static_entry_point(f.name):
- for n in f.entry_points:
- if n != f.name:
- text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name)
-
- if f.has_different_protocol(n):
- print '#ifndef GLX_INDIRECT_RENDERING'
- print text
- print '#endif'
- else:
- print text
-
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
- mode = "generic"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
- except Exception,e:
- show_usage()
-
- for (arg,val) in args:
- if arg == '-m':
- mode = val
- elif arg == "-f":
- file_name = val
-
- if mode == "generic":
- printer = PrintGenericStubs()
- else:
- print "ERROR: Invalid mode \"%s\" specified." % mode
- show_usage()
-
- api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
- printer.Print(api)
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick <idr@us.ibm.com>
+
+import license
+import gl_XML, glX_XML
+import sys, getopt
+
+class PrintGenericStubs(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+ self.name = "gl_SPARC_asm.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+
+ def printRealHeader(self):
+ print '#ifdef __arch64__'
+ print '#define GL_OFF(N)\t((N) * 8)'
+ print '#define GL_LL\t\tldx'
+ print '#define GL_TIE_LD(SYM)\t%tie_ldx(SYM)'
+ print '#define GL_STACK_SIZE\t128'
+ print '#else'
+ print '#define GL_OFF(N)\t((N) * 4)'
+ print '#define GL_LL\t\tld'
+ print '#define GL_TIE_LD(SYM)\t%tie_ld(SYM)'
+ print '#define GL_STACK_SIZE\t64'
+ print '#endif'
+ print ''
+ print '#define GLOBL_FN(x) .globl x ; .type x, @function'
+ print '#define HIDDEN(x) .hidden x'
+ print ''
+ print '\t.register %g2, #scratch'
+ print '\t.register %g3, #scratch'
+ print ''
+ print '\t.text'
+ print ''
+ print '\tGLOBL_FN(__glapi_sparc_icache_flush)'
+ print '\tHIDDEN(__glapi_sparc_icache_flush)'
+ print '\t.type\t__glapi_sparc_icache_flush, @function'
+ print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
+ print '\tflush\t%o0'
+ print '\tretl'
+ print '\t nop'
+ print ''
+ print '\t.align\t32'
+ print ''
+ print '\t.type\t__glapi_sparc_get_pc, @function'
+ print '__glapi_sparc_get_pc:'
+ print '\tretl'
+ print '\t add\t%o7, %g2, %g2'
+ print '\t.size\t__glapi_sparc_get_pc, .-__glapi_sparc_get_pc'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '\tGLOBL_FN(__glapi_sparc_get_dispatch)'
+ print '\tHIDDEN(__glapi_sparc_get_dispatch)'
+ print '__glapi_sparc_get_dispatch:'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
+ print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
+ print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
+ print '\tretl'
+ print '\t mov\t%g2, %o0'
+ print ''
+ print '\t.data'
+ print '\t.align\t32'
+ print ''
+ print '\t/* --> sethi %hi(_glapi_tls_Dispatch), %g1 */'
+ print '\t/* --> or %g1, %lo(_glapi_tls_Dispatch), %g1 */'
+ print '\tGLOBL_FN(__glapi_sparc_tls_stub)'
+ print '\tHIDDEN(__glapi_sparc_tls_stub)'
+ print '__glapi_sparc_tls_stub: /* Call offset in %g3 */'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\tadd\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsrl\t%g3, 10, %g3'
+ print '\tsethi\t%tie_hi22(_glapi_tls_Dispatch), %g1'
+ print '\tadd\t%g1, %tie_lo10(_glapi_tls_Dispatch), %g1'
+ print '\tGL_LL\t[%g2 + %g1], %g2, GL_TIE_LD(_glapi_tls_Dispatch)'
+ print '\tGL_LL\t[%g7+%g2], %g1'
+ print '\tGL_LL\t[%g1 + %g3], %g1'
+ print '\tjmp\t%g1'
+ print '\t nop'
+ print '\t.size\t__glapi_sparc_tls_stub, .-__glapi_sparc_tls_stub'
+ print ''
+ print '#define GL_STUB(fn, off)\t\t\t\t\\'
+ print '\tGLOBL_FN(fn);\t\t\t\t\t\\'
+ print 'fn:\tba\t__glapi_sparc_tls_stub;\t\t\t\\'
+ print '\t sethi\tGL_OFF(off), %g3;\t\t\t\\'
+ print '\t.size\tfn,.-fn;'
+ print ''
+ print '#elif defined(PTHREADS)'
+ print ''
+ print '\t/* 64-bit 0x00 --> sethi %hh(_glapi_Dispatch), %g1 */'
+ print '\t/* 64-bit 0x04 --> sethi %lm(_glapi_Dispatch), %g2 */'
+ print '\t/* 64-bit 0x08 --> or %g1, %hm(_glapi_Dispatch), %g1 */'
+ print '\t/* 64-bit 0x0c --> sllx %g1, 32, %g1 */'
+ print '\t/* 64-bit 0x10 --> add %g1, %g2, %g1 */'
+ print '\t/* 64-bit 0x14 --> ldx [%g1 + %lo(_glapi_Dispatch)], %g1 */'
+ print ''
+ print '\t/* 32-bit 0x00 --> sethi %hi(_glapi_Dispatch), %g1 */'
+ print '\t/* 32-bit 0x04 --> ld [%g1 + %lo(_glapi_Dispatch)], %g1 */'
+ print ''
+ print '\t.data'
+ print '\t.align\t32'
+ print ''
+ print '\tGLOBL_FN(__glapi_sparc_pthread_stub)'
+ print '\tHIDDEN(__glapi_sparc_pthread_stub)'
+ print '__glapi_sparc_pthread_stub: /* Call offset in %g3 */'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsethi\t%hi(_glapi_Dispatch), %g1'
+ print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
+ print '\tsrl\t%g3, 10, %g3'
+ print '\tGL_LL\t[%g2+%g1], %g2'
+ print '\tGL_LL\t[%g2], %g1'
+ print '\tcmp\t%g1, 0'
+ print '\tbe\t2f'
+ print '\t nop'
+ print '1:\tGL_LL\t[%g1 + %g3], %g1'
+ print '\tjmp\t%g1'
+ print '\t nop'
+ print '2:\tsave\t%sp, GL_STACK_SIZE, %sp'
+ print '\tmov\t%g3, %l0'
+ print '\tcall\t_glapi_get_dispatch'
+ print '\t nop'
+ print '\tmov\t%o0, %g1'
+ print '\tmov\t%l0, %g3'
+ print '\tba\t1b'
+ print '\t restore %g0, %g0, %g0'
+ print '\t.size\t__glapi_sparc_pthread_stub, .-__glapi_sparc_pthread_stub'
+ print ''
+ print '#define GL_STUB(fn, off)\t\t\t\\'
+ print '\tGLOBL_FN(fn);\t\t\t\t\\'
+ print 'fn:\tba\t__glapi_sparc_pthread_stub;\t\\'
+ print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
+ print '\t.size\tfn,.-fn;'
+ print ''
+ print '#else /* Non-threaded version. */'
+ print ''
+ print '\t.type __glapi_sparc_nothread_stub, @function'
+ print '__glapi_sparc_nothread_stub: /* Call offset in %g3 */'
+ print '\tmov\t%o7, %g1'
+ print '\tsethi\t%hi(_GLOBAL_OFFSET_TABLE_-4), %g2'
+ print '\tcall\t__glapi_sparc_get_pc'
+ print '\t add\t%g2, %lo(_GLOBAL_OFFSET_TABLE_+4), %g2'
+ print '\tmov\t%g1, %o7'
+ print '\tsrl\t%g3, 10, %g3'
+ print '\tsethi\t%hi(_glapi_Dispatch), %g1'
+ print '\tor\t%g1, %lo(_glapi_Dispatch), %g1'
+ print '\tGL_LL\t[%g2+%g1], %g2'
+ print '\tGL_LL\t[%g2], %g1'
+ print '\tGL_LL\t[%g1 + %g3], %g1'
+ print '\tjmp\t%g1'
+ print '\t nop'
+ print '\t.size\t__glapi_sparc_nothread_stub, .-__glapi_sparc_nothread_stub'
+ print ''
+ print '#define GL_STUB(fn, off)\t\t\t\\'
+ print '\tGLOBL_FN(fn);\t\t\t\t\\'
+ print 'fn:\tba\t__glapi_sparc_nothread_stub;\t\\'
+ print '\t sethi\tGL_OFF(off), %g3;\t\t\\'
+ print '\t.size\tfn,.-fn;'
+ print ''
+ print '#endif'
+ print ''
+ print '#define GL_STUB_ALIAS(fn, alias) \\'
+ print ' .globl fn; \\'
+ print ' .set fn, alias'
+ print ''
+ print '\t.text'
+ print '\t.align\t32'
+ print ''
+ print '\t.globl\tgl_dispatch_functions_start'
+ print '\tHIDDEN(gl_dispatch_functions_start)'
+ print 'gl_dispatch_functions_start:'
+ print ''
+ return
+
+ def printRealFooter(self):
+ print ''
+ print '\t.globl\tgl_dispatch_functions_end'
+ print '\tHIDDEN(gl_dispatch_functions_end)'
+ print 'gl_dispatch_functions_end:'
+ return
+
+ def printBody(self, api):
+ for f in api.functionIterateByOffset():
+ name = f.dispatch_name()
+
+ print '\tGL_STUB(gl%s, %d)' % (name, f.offset)
+
+ if not f.is_static_entry_point(f.name):
+ print '\tHIDDEN(gl%s)' % (name)
+
+ for f in api.functionIterateByOffset():
+ name = f.dispatch_name()
+
+ if f.is_static_entry_point(f.name):
+ for n in f.entry_points:
+ if n != f.name:
+ text = '\tGL_STUB_ALIAS(gl%s, gl%s)' % (n, f.name)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
+
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+ mode = "generic"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == '-m':
+ mode = val
+ elif arg == "-f":
+ file_name = val
+
+ if mode == "generic":
+ printer = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer.Print(api)
diff --git a/mesalib/src/mapi/glapi/gen/gl_procs.py b/mesalib/src/mapi/glapi/gen/gl_procs.py
index f1522baec..a9ba48297 100644
--- a/mesalib/src/mapi/glapi/gen/gl_procs.py
+++ b/mesalib/src/mapi/glapi/gen/gl_procs.py
@@ -1,215 +1,215 @@
-#!/usr/bin/env python
-
-# (C) Copyright IBM Corporation 2004, 2005
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# on the rights to use, copy, modify, merge, publish, distribute, sub
-# license, and/or sell copies of the Software, and to permit persons to whom
-# the Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-import license
-import gl_XML, glX_XML
-import sys, getopt
-
-class PrintGlProcs(gl_XML.gl_print_base):
- def __init__(self, long_strings, es=False):
- gl_XML.gl_print_base.__init__(self)
-
- self.es = es
- self.long_strings = long_strings
- self.name = "gl_procs.py (from Mesa)"
- self.license = license.bsd_license_template % ( \
-"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
-(C) Copyright IBM Corporation 2004, 2006""", "BRIAN PAUL, IBM")
-
-
- def printRealHeader(self):
- print """
-/* This file is only included by glapi.c and is used for
- * the GetProcAddress() function
- */
-
-typedef struct {
- GLint Name_offset;
-#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
- _glapi_proc Address;
-#endif
- GLuint Offset;
-} glprocs_table_t;
-
-#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
-#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
-#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
-#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
-# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
-#endif
-
-"""
- return
-
- def printRealFooter(self):
- print ''
- print '#undef NAME_FUNC_OFFSET'
- return
-
- def printFunctionString(self, name):
- if self.long_strings:
- print ' "gl%s\\0"' % (name)
- else:
- print " 'g','l',",
- for c in name:
- print "'%s'," % (c),
-
- print "'\\0',"
-
-
- def printBody(self, api):
- print ''
- if self.long_strings:
- print 'static const char gl_string_table[] ='
- else:
- print 'static const char gl_string_table[] = {'
-
- base_offset = 0
- table = []
- for func in api.functionIterateByOffset():
- name = func.dispatch_name()
- self.printFunctionString(func.name)
- table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset))
-
- # The length of the function's name, plus 2 for "gl",
- # plus 1 for the NUL.
-
- base_offset += len(func.name) + 3
-
-
- for func in api.functionIterateByOffset():
- for n in func.entry_points:
- if n != func.name:
- name = func.dispatch_name()
- self.printFunctionString( n )
-
- if func.has_different_protocol(n):
- alt_name = "gl" + func.static_glx_name(n)
- table.append((base_offset, "gl" + name, alt_name, alt_name, func.offset))
- else:
- table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset))
-
- base_offset += len(n) + 3
-
-
- if self.long_strings:
- print ' ;'
- else:
- print '};'
-
- print ''
- print ''
- print "#ifdef USE_MGL_NAMESPACE"
- for func in api.functionIterateByOffset():
- for n in func.entry_points:
- if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)):
- print '#define gl_dispatch_stub_%u mgl_dispatch_stub_%u' % (func.offset, func.offset)
- break
- print "#endif /* USE_MGL_NAMESPACE */"
- print ''
- print ''
- print '#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)'
- for func in api.functionIterateByOffset():
- for n in func.entry_points:
- if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)):
- print '%s GLAPIENTRY gl_dispatch_stub_%u(%s);' % (func.return_type, func.offset, func.get_parameter_string())
- break
-
- if self.es:
- categories = {}
- for func in api.functionIterateByOffset():
- for n in func.entry_points:
- cat, num = api.get_category_for_name(n)
- if (cat.startswith("es") or cat.startswith("GL_OES")):
- if not categories.has_key(cat):
- categories[cat] = []
- proto = 'GLAPI %s GLAPIENTRY %s(%s);' \
- % (func.return_type, "gl" + n, func.get_parameter_string(n))
- categories[cat].append(proto)
- if categories:
- print ''
- print '/* OpenGL ES specific prototypes */'
- print ''
- keys = categories.keys()
- keys.sort()
- for key in keys:
- print '/* category %s */' % key
- print "\n".join(categories[key])
- print ''
-
- print '#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */'
-
- print ''
- print 'static const glprocs_table_t static_functions[] = {'
-
- for info in table:
- print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, %d),' % info
-
- print ' NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)'
- print '};'
- return
-
-
-def show_usage():
- print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
- print "-c Enable compatibility with OpenGL ES."
- print "-m mode mode can be one of:"
- print " long - Create code for compilers that can handle very"
- print " long string constants. (default)"
- print " short - Create code for compilers that can only handle"
- print " ANSI C89 string constants."
- sys.exit(1)
-
-if __name__ == '__main__':
- file_name = "gl_API.xml"
-
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
- except Exception,e:
- show_usage()
-
- long_string = 1
- es = False
- for (arg,val) in args:
- if arg == "-f":
- file_name = val
- elif arg == "-m":
- if val == "short":
- long_string = 0
- elif val == "long":
- long_string = 1
- else:
- show_usage()
- elif arg == "-c":
- es = True
-
- api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
- printer = PrintGlProcs(long_string, es)
- printer.Print(api)
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick <idr@us.ibm.com>
+
+import license
+import gl_XML, glX_XML
+import sys, getopt
+
+class PrintGlProcs(gl_XML.gl_print_base):
+ def __init__(self, long_strings, es=False):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.es = es
+ self.long_strings = long_strings
+ self.name = "gl_procs.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004, 2006""", "BRIAN PAUL, IBM")
+
+
+ def printRealHeader(self):
+ print """
+/* This file is only included by glapi.c and is used for
+ * the GetProcAddress() function
+ */
+
+typedef struct {
+ GLint Name_offset;
+#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
+ _glapi_proc Address;
+#endif
+ GLuint Offset;
+} glprocs_table_t;
+
+#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
+#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
+#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
+#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
+#endif
+
+"""
+ return
+
+ def printRealFooter(self):
+ print ''
+ print '#undef NAME_FUNC_OFFSET'
+ return
+
+ def printFunctionString(self, name):
+ if self.long_strings:
+ print ' "gl%s\\0"' % (name)
+ else:
+ print " 'g','l',",
+ for c in name:
+ print "'%s'," % (c),
+
+ print "'\\0',"
+
+
+ def printBody(self, api):
+ print ''
+ if self.long_strings:
+ print 'static const char gl_string_table[] ='
+ else:
+ print 'static const char gl_string_table[] = {'
+
+ base_offset = 0
+ table = []
+ for func in api.functionIterateByOffset():
+ name = func.dispatch_name()
+ self.printFunctionString(func.name)
+ table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset))
+
+ # The length of the function's name, plus 2 for "gl",
+ # plus 1 for the NUL.
+
+ base_offset += len(func.name) + 3
+
+
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ if n != func.name:
+ name = func.dispatch_name()
+ self.printFunctionString( n )
+
+ if func.has_different_protocol(n):
+ alt_name = "gl" + func.static_glx_name(n)
+ table.append((base_offset, "gl" + name, alt_name, alt_name, func.offset))
+ else:
+ table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.offset))
+
+ base_offset += len(n) + 3
+
+
+ if self.long_strings:
+ print ' ;'
+ else:
+ print '};'
+
+ print ''
+ print ''
+ print "#ifdef USE_MGL_NAMESPACE"
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)):
+ print '#define gl_dispatch_stub_%u mgl_dispatch_stub_%u' % (func.offset, func.offset)
+ break
+ print "#endif /* USE_MGL_NAMESPACE */"
+ print ''
+ print ''
+ print '#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)'
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)):
+ print '%s GLAPIENTRY gl_dispatch_stub_%u(%s);' % (func.return_type, func.offset, func.get_parameter_string())
+ break
+
+ if self.es:
+ categories = {}
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ cat, num = api.get_category_for_name(n)
+ if (cat.startswith("es") or cat.startswith("GL_OES")):
+ if not categories.has_key(cat):
+ categories[cat] = []
+ proto = 'GLAPI %s GLAPIENTRY %s(%s);' \
+ % (func.return_type, "gl" + n, func.get_parameter_string(n))
+ categories[cat].append(proto)
+ if categories:
+ print ''
+ print '/* OpenGL ES specific prototypes */'
+ print ''
+ keys = categories.keys()
+ keys.sort()
+ for key in keys:
+ print '/* category %s */' % key
+ print "\n".join(categories[key])
+ print ''
+
+ print '#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */'
+
+ print ''
+ print 'static const glprocs_table_t static_functions[] = {'
+
+ for info in table:
+ print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, %d),' % info
+
+ print ' NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)'
+ print '};'
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m mode] [-c]" % sys.argv[0]
+ print "-c Enable compatibility with OpenGL ES."
+ print "-m mode mode can be one of:"
+ print " long - Create code for compilers that can handle very"
+ print " long string constants. (default)"
+ print " short - Create code for compilers that can only handle"
+ print " ANSI C89 string constants."
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:c")
+ except Exception,e:
+ show_usage()
+
+ long_string = 1
+ es = False
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ if val == "short":
+ long_string = 0
+ elif val == "long":
+ long_string = 1
+ else:
+ show_usage()
+ elif arg == "-c":
+ es = True
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer = PrintGlProcs(long_string, es)
+ printer.Print(api)
diff --git a/mesalib/src/mapi/glapi/gen/next_available_offset.sh b/mesalib/src/mapi/glapi/gen/next_available_offset.sh
index 20d45ec54..e7d6c2f4a 100644
--- a/mesalib/src/mapi/glapi/gen/next_available_offset.sh
+++ b/mesalib/src/mapi/glapi/gen/next_available_offset.sh
@@ -1,39 +1,39 @@
-#!/usr/bin/env bash
-#
-# (C) Copyright IBM Corporation 2004
-# All Rights Reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# on the rights to use, copy, modify, merge, publish, distribute, sub
-# license, and/or sell copies of the Software, and to permit persons to whom
-# the Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice (including the next
-# paragraph) shall be included in all copies or substantial portions of the
-# Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
-# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-# IN THE SOFTWARE.
-#
-# Authors:
-# Ian Romanick <idr@us.ibm.com>
-
-# Trivial shell script to search the API definition file and print out the
-# next numerically available API entry-point offset. This could probably
-# be made smarter, but it would be better to use the existin Python
-# framework to do that. This is just a quick-and-dirty hack.
-
-num=$(grep 'offset="' gl_API.xml |\
- sed 's/.\+ offset="//g;s/".*$//g' |\
- grep -v '?' |\
- sort -rn |\
- head -1)
-
-echo $((num + 1))
+#!/usr/bin/env bash
+#
+# (C) Copyright IBM Corporation 2004
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick <idr@us.ibm.com>
+
+# Trivial shell script to search the API definition file and print out the
+# next numerically available API entry-point offset. This could probably
+# be made smarter, but it would be better to use the existin Python
+# framework to do that. This is just a quick-and-dirty hack.
+
+num=$(grep 'offset="' gl_API.xml |\
+ sed 's/.\+ offset="//g;s/".*$//g' |\
+ grep -v '?' |\
+ sort -rn |\
+ head -1)
+
+echo $((num + 1))
diff --git a/mesalib/src/mapi/glapi/glapi.c b/mesalib/src/mapi/glapi/glapi.c
index 77f75faed..f7655c558 100644
--- a/mesalib/src/mapi/glapi/glapi.c
+++ b/mesalib/src/mapi/glapi/glapi.c
@@ -1,65 +1,65 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.9
- *
- * Copyright (C) 2010 LunarG Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Chia-I Wu <olv@lunarg.com>
- */
-
-#include "glapi/glapi.h"
-#include "mapi/u_current.h"
-
-/*
- * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in
- * u_current.c.
- */
-
-#ifdef GLX_USE_TLS
-/* not used, but defined for compatibility */
-const struct _glapi_table *_glapi_Dispatch;
-const void *_glapi_Context;
-#endif /* GLX_USE_TLS */
-
-void
-_glapi_destroy_multithread(void)
-{
- u_current_destroy();
-}
-
-void
-_glapi_check_multithread(void)
-{
- u_current_init();
-}
-
-void
-_glapi_set_context(void *context)
-{
- u_current_set_user((const void *) context);
-}
-
-void
-_glapi_set_dispatch(struct _glapi_table *dispatch)
-{
- u_current_set((const struct mapi_table *) dispatch);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#include "glapi/glapi.h"
+#include "mapi/u_current.h"
+
+/*
+ * Global variables, _glapi_get_context, and _glapi_get_dispatch are defined in
+ * u_current.c.
+ */
+
+#ifdef GLX_USE_TLS
+/* not used, but defined for compatibility */
+const struct _glapi_table *_glapi_Dispatch;
+const void *_glapi_Context;
+#endif /* GLX_USE_TLS */
+
+void
+_glapi_destroy_multithread(void)
+{
+ u_current_destroy();
+}
+
+void
+_glapi_check_multithread(void)
+{
+ u_current_init();
+}
+
+void
+_glapi_set_context(void *context)
+{
+ u_current_set_user((const void *) context);
+}
+
+void
+_glapi_set_dispatch(struct _glapi_table *dispatch)
+{
+ u_current_set((const struct mapi_table *) dispatch);
+}
diff --git a/mesalib/src/mapi/glapi/glapi_dispatch.c b/mesalib/src/mapi/glapi/glapi_dispatch.c
index be8c4e71d..989f4a3fc 100644
--- a/mesalib/src/mapi/glapi/glapi_dispatch.c
+++ b/mesalib/src/mapi/glapi/glapi_dispatch.c
@@ -1,92 +1,92 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.3
- *
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file glapi_dispatch.c
- *
- * This file generates all the gl* function entrypoints. This code is not
- * used if optimized assembly stubs are available (e.g., using
- * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC).
- *
- * \note
- * This file is also used to build the client-side libGL that loads DRI-based
- * device drivers. At build-time it is symlinked to src/glx.
- *
- * \author Brian Paul <brian@precisioninsight.com>
- */
-
-#include "glapi/glapi_priv.h"
-#include "glapi/glapitable.h"
-
-
-#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
-
-#if defined(WIN32)
-#define KEYWORD1 GLAPI
-#else
-#define KEYWORD1 PUBLIC
-#endif
-
-#define KEYWORD2 GLAPIENTRY
-
-#if defined(USE_MGL_NAMESPACE)
-#define NAME(func) mgl##func
-#else
-#define NAME(func) gl##func
-#endif
-
-#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */
-
-#define F stdout
-#define DISPATCH(FUNC, ARGS, MESSAGE) \
- fprintf MESSAGE; \
- GET_DISPATCH()->FUNC ARGS
-
-#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
- fprintf MESSAGE; \
- return GET_DISPATCH()->FUNC ARGS
-
-#else
-
-#define DISPATCH(FUNC, ARGS, MESSAGE) \
- GET_DISPATCH()->FUNC ARGS
-
-#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
- return GET_DISPATCH()->FUNC ARGS
-
-#endif /* logging */
-
-
-#ifndef GLAPIENTRY
-#define GLAPIENTRY
-#endif
-
-#ifdef GLX_INDIRECT_RENDERING
-/* those link to libglapi.a should provide the entry points */
-#define _GLAPI_SKIP_PROTO_ENTRY_POINTS
-#endif
-#include "glapi/glapitemp.h"
-
-#endif /* USE_X86_ASM */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file glapi_dispatch.c
+ *
+ * This file generates all the gl* function entrypoints. This code is not
+ * used if optimized assembly stubs are available (e.g., using
+ * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC).
+ *
+ * \note
+ * This file is also used to build the client-side libGL that loads DRI-based
+ * device drivers. At build-time it is symlinked to src/glx.
+ *
+ * \author Brian Paul <brian@precisioninsight.com>
+ */
+
+#include "glapi/glapi_priv.h"
+#include "glapi/glapitable.h"
+
+
+#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM))
+
+#if defined(WIN32)
+#define KEYWORD1 GLAPI
+#else
+#define KEYWORD1 PUBLIC
+#endif
+
+#define KEYWORD2 GLAPIENTRY
+
+#if defined(USE_MGL_NAMESPACE)
+#define NAME(func) mgl##func
+#else
+#define NAME(func) gl##func
+#endif
+
+#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */
+
+#define F stdout
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+ fprintf MESSAGE; \
+ GET_DISPATCH()->FUNC ARGS
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ fprintf MESSAGE; \
+ return GET_DISPATCH()->FUNC ARGS
+
+#else
+
+#define DISPATCH(FUNC, ARGS, MESSAGE) \
+ GET_DISPATCH()->FUNC ARGS
+
+#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
+ return GET_DISPATCH()->FUNC ARGS
+
+#endif /* logging */
+
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY
+#endif
+
+#ifdef GLX_INDIRECT_RENDERING
+/* those link to libglapi.a should provide the entry points */
+#define _GLAPI_SKIP_PROTO_ENTRY_POINTS
+#endif
+#include "glapi/glapitemp.h"
+
+#endif /* USE_X86_ASM */
diff --git a/mesalib/src/mapi/glapi/glapi_getproc.c b/mesalib/src/mapi/glapi/glapi_getproc.c
index 21380ea41..0a6ff7795 100644
--- a/mesalib/src/mapi/glapi/glapi_getproc.c
+++ b/mesalib/src/mapi/glapi/glapi_getproc.c
@@ -1,666 +1,666 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file glapi_getproc.c
- *
- * Code for implementing glXGetProcAddress(), etc.
- * This was originally in glapi.c but refactored out.
- */
-
-
-#include "glapi/glapi_priv.h"
-#include "glapi/glapitable.h"
-
-
-#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
-
-
-/**********************************************************************
- * Static function management.
- */
-
-
-#if !defined(DISPATCH_FUNCTION_SIZE)
-# define NEED_FUNCTION_POINTER
-#endif
-#include "glapi/glprocs.h"
-
-
-/**
- * Search the table of static entrypoint functions for the named function
- * and return the corresponding glprocs_table_t entry.
- */
-static const glprocs_table_t *
-get_static_proc( const char * n )
-{
- GLuint i;
- for (i = 0; static_functions[i].Name_offset >= 0; i++) {
- const char *testName = gl_string_table + static_functions[i].Name_offset;
-#ifdef MANGLE
- /* skip the prefix on the name */
- if (strcmp(testName, n + 1) == 0)
-#else
- if (strcmp(testName, n) == 0)
-#endif
- {
- return &static_functions[i];
- }
- }
- return NULL;
-}
-
-
-/**
- * Return dispatch table offset of the named static (built-in) function.
- * Return -1 if function not found.
- */
-static GLint
-get_static_proc_offset(const char *funcName)
-{
- const glprocs_table_t * const f = get_static_proc( funcName );
- if (f == NULL) {
- return -1;
- }
-
- return f->Offset;
-}
-
-
-
-/**
- * Return dispatch function address for the named static (built-in) function.
- * Return NULL if function not found.
- */
-static _glapi_proc
-get_static_proc_address(const char *funcName)
-{
- const glprocs_table_t * const f = get_static_proc( funcName );
- if (f == NULL) {
- return NULL;
- }
-
-#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING)
- return (f->Address == NULL)
- ? get_entrypoint_address(f->Offset)
- : f->Address;
-#elif defined(DISPATCH_FUNCTION_SIZE)
- return get_entrypoint_address(f->Offset);
-#else
- return f->Address;
-#endif
-}
-
-
-
-/**
- * Return the name of the function at the given offset in the dispatch
- * table. For debugging only.
- */
-static const char *
-get_static_proc_name( GLuint offset )
-{
- GLuint i;
- for (i = 0; static_functions[i].Name_offset >= 0; i++) {
- if (static_functions[i].Offset == offset) {
- return gl_string_table + static_functions[i].Name_offset;
- }
- }
- return NULL;
-}
-
-
-
-/**********************************************************************
- * Extension function management.
- */
-
-
-/**
- * Track information about a function added to the GL API.
- */
-struct _glapi_function {
- /**
- * Name of the function.
- */
- const char * name;
-
-
- /**
- * Text string that describes the types of the parameters passed to the
- * named function. Parameter types are converted to characters using the
- * following rules:
- * - 'i' for \c GLint, \c GLuint, and \c GLenum
- * - 'p' for any pointer type
- * - 'f' for \c GLfloat and \c GLclampf
- * - 'd' for \c GLdouble and \c GLclampd
- */
- const char * parameter_signature;
-
-
- /**
- * Offset in the dispatch table where the pointer to the real function is
- * located. If the driver has not requested that the named function be
- * added to the dispatch table, this will have the value ~0.
- */
- unsigned dispatch_offset;
-
-
- /**
- * Pointer to the dispatch stub for the named function.
- *
- * \todo
- * The semantic of this field should be changed slightly. Currently, it
- * is always expected to be non-\c NULL. However, it would be better to
- * only allocate the entry-point stub when the application requests the
- * function via \c glXGetProcAddress. This would save memory for all the
- * functions that the driver exports but that the application never wants
- * to call.
- */
- _glapi_proc dispatch_stub;
-};
-
-
-static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
-static GLuint NumExtEntryPoints = 0;
-
-
-static struct _glapi_function *
-get_extension_proc(const char *funcName)
-{
- GLuint i;
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
- return & ExtEntryTable[i];
- }
- }
- return NULL;
-}
-
-
-static GLint
-get_extension_proc_offset(const char *funcName)
-{
- const struct _glapi_function * const f = get_extension_proc( funcName );
- if (f == NULL) {
- return -1;
- }
-
- return f->dispatch_offset;
-}
-
-
-static _glapi_proc
-get_extension_proc_address(const char *funcName)
-{
- const struct _glapi_function * const f = get_extension_proc( funcName );
- if (f == NULL) {
- return NULL;
- }
-
- return f->dispatch_stub;
-}
-
-
-static const char *
-get_extension_proc_name(GLuint offset)
-{
- GLuint i;
- for (i = 0; i < NumExtEntryPoints; i++) {
- if (ExtEntryTable[i].dispatch_offset == offset) {
- return ExtEntryTable[i].name;
- }
- }
- return NULL;
-}
-
-
-/**
- * strdup() is actually not a standard ANSI C or POSIX routine.
- * Irix will not define it if ANSI mode is in effect.
- */
-static char *
-str_dup(const char *str)
-{
- char *copy;
- copy = (char*) malloc(strlen(str) + 1);
- if (!copy)
- return NULL;
- strcpy(copy, str);
- return copy;
-}
-
-
-/**
- * Generate new entrypoint
- *
- * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver
- * calls \c _glapi_add_dispatch we'll put in the proper offset. If that
- * never happens, and the user calls this function, he'll segfault. That's
- * what you get when you try calling a GL function that doesn't really exist.
- *
- * \param funcName Name of the function to create an entry-point for.
- *
- * \sa _glapi_add_entrypoint
- */
-
-static struct _glapi_function *
-add_function_name( const char * funcName )
-{
- struct _glapi_function * entry = NULL;
- _glapi_proc entrypoint = NULL;
- char * name_dup = NULL;
-
- if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS)
- return NULL;
-
- if (funcName == NULL)
- return NULL;
-
- name_dup = str_dup(funcName);
- if (name_dup == NULL)
- return NULL;
-
- entrypoint = generate_entrypoint(~0);
-
- if (entrypoint == NULL) {
- free(name_dup);
- return NULL;
- }
-
- entry = & ExtEntryTable[NumExtEntryPoints];
- NumExtEntryPoints++;
-
- entry->name = name_dup;
- entry->parameter_signature = NULL;
- entry->dispatch_offset = ~0;
- entry->dispatch_stub = entrypoint;
-
- return entry;
-}
-
-
-static struct _glapi_function *
-set_entry_info( struct _glapi_function * entry, const char * signature, unsigned offset )
-{
- char * sig_dup = NULL;
-
- if (signature == NULL)
- return NULL;
-
- sig_dup = str_dup(signature);
- if (sig_dup == NULL)
- return NULL;
-
- fill_in_entrypoint_offset(entry->dispatch_stub, offset);
-
- entry->parameter_signature = sig_dup;
- entry->dispatch_offset = offset;
-
- return entry;
-}
-
-
-/**
- * Fill-in the dispatch stub for the named function.
- *
- * This function is intended to be called by a hardware driver. When called,
- * a dispatch stub may be created created for the function. A pointer to this
- * dispatch function will be returned by glXGetProcAddress.
- *
- * \param function_names Array of pointers to function names that should
- * share a common dispatch offset.
- * \param parameter_signature String representing the types of the parameters
- * passed to the named function. Parameter types
- * are converted to characters using the following
- * rules:
- * - 'i' for \c GLint, \c GLuint, and \c GLenum
- * - 'p' for any pointer type
- * - 'f' for \c GLfloat and \c GLclampf
- * - 'd' for \c GLdouble and \c GLclampd
- *
- * \returns
- * The offset in the dispatch table of the named function. A pointer to the
- * driver's implementation of the named function should be stored at
- * \c dispatch_table[\c offset]. Return -1 if error/problem.
- *
- * \sa glXGetProcAddress
- *
- * \warning
- * This function can only handle up to 8 names at a time. As far as I know,
- * the maximum number of names ever associated with an existing GL function is
- * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT,
- * \c glPointParameterfARB, and \c glPointParameterf), so this should not be
- * too painful of a limitation.
- *
- * \todo
- * Determine whether or not \c parameter_signature should be allowed to be
- * \c NULL. It doesn't seem like much of a hardship for drivers to have to
- * pass in an empty string.
- *
- * \todo
- * Determine if code should be added to reject function names that start with
- * 'glX'.
- *
- * \bug
- * Add code to compare \c parameter_signature with the parameter signature of
- * a static function. In order to do that, we need to find a way to \b get
- * the parameter signature of a static function.
- */
-
-int
-_glapi_add_dispatch( const char * const * function_names,
- const char * parameter_signature )
-{
- static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
- const char * const real_sig = (parameter_signature != NULL)
- ? parameter_signature : "";
- struct _glapi_function * entry[8];
- GLboolean is_static[8];
- unsigned i;
- int offset = ~0;
-
- init_glapi_relocs_once();
-
- (void) memset( is_static, 0, sizeof( is_static ) );
- (void) memset( entry, 0, sizeof( entry ) );
-
- /* Find the _single_ dispatch offset for all function names that already
- * exist (and have a dispatch offset).
- */
-
- for ( i = 0 ; function_names[i] != NULL ; i++ ) {
- const char * funcName = function_names[i];
- int static_offset;
- int extension_offset;
-
- if (funcName[0] != 'g' || funcName[1] != 'l')
- return -1;
-
- /* search built-in functions */
- static_offset = get_static_proc_offset(funcName);
-
- if (static_offset >= 0) {
-
- is_static[i] = GL_TRUE;
-
- /* FIXME: Make sure the parameter signatures match! How do we get
- * FIXME: the parameter signature for static functions?
- */
-
- if ( (offset != ~0) && (static_offset != offset) ) {
- return -1;
- }
-
- offset = static_offset;
-
- continue;
- }
-
- /* search added extension functions */
- entry[i] = get_extension_proc(funcName);
-
- if (entry[i] != NULL) {
- extension_offset = entry[i]->dispatch_offset;
-
- /* The offset may be ~0 if the function name was added by
- * glXGetProcAddress but never filled in by the driver.
- */
-
- if (extension_offset == ~0) {
- continue;
- }
-
- if (strcmp(real_sig, entry[i]->parameter_signature) != 0) {
- return -1;
- }
-
- if ( (offset != ~0) && (extension_offset != offset) ) {
- return -1;
- }
-
- offset = extension_offset;
- }
- }
-
- /* If all function names are either new (or with no dispatch offset),
- * allocate a new dispatch offset.
- */
-
- if (offset == ~0) {
- offset = next_dynamic_offset;
- next_dynamic_offset++;
- }
-
- /* Fill in the dispatch offset for the new function names (and those with
- * no dispatch offset).
- */
-
- for ( i = 0 ; function_names[i] != NULL ; i++ ) {
- if (is_static[i]) {
- continue;
- }
-
- /* generate entrypoints for new function names */
- if (entry[i] == NULL) {
- entry[i] = add_function_name( function_names[i] );
- if (entry[i] == NULL) {
- /* FIXME: Possible memory leak here. */
- return -1;
- }
- }
-
- if (entry[i]->dispatch_offset == ~0) {
- set_entry_info( entry[i], real_sig, offset );
- }
- }
-
- return offset;
-}
-
-
-/**
- * Return offset of entrypoint for named function within dispatch table.
- */
-GLint
-_glapi_get_proc_offset(const char *funcName)
-{
- GLint offset;
-
- /* search extension functions first */
- offset = get_extension_proc_offset(funcName);
- if (offset >= 0)
- return offset;
-
- /* search static functions */
- return get_static_proc_offset(funcName);
-}
-
-
-
-/**
- * Return pointer to the named function. If the function name isn't found
- * in the name of static functions, try generating a new API entrypoint on
- * the fly with assembly language.
- */
-_glapi_proc
-_glapi_get_proc_address(const char *funcName)
-{
- _glapi_proc func;
- struct _glapi_function * entry;
-
- init_glapi_relocs_once();
-
-#ifdef MANGLE
- /* skip the prefix on the name */
- if (funcName[1] != 'g' || funcName[2] != 'l')
- return NULL;
-#else
- if (funcName[0] != 'g' || funcName[1] != 'l')
- return NULL;
-#endif
-
- /* search extension functions first */
- func = get_extension_proc_address(funcName);
- if (func)
- return func;
-
- /* search static functions */
- func = get_static_proc_address(funcName);
- if (func)
- return func;
-
- /* generate entrypoint, dispatch offset must be filled in by the driver */
- entry = add_function_name(funcName);
- if (entry == NULL)
- return NULL;
-
- return entry->dispatch_stub;
-}
-
-
-
-/**
- * Return the name of the function at the given dispatch offset.
- * This is only intended for debugging.
- */
-const char *
-_glapi_get_proc_name(GLuint offset)
-{
- const char * n;
-
- /* search built-in functions */
- n = get_static_proc_name(offset);
- if ( n != NULL ) {
- return n;
- }
-
- /* search added extension functions */
- return get_extension_proc_name(offset);
-}
-
-
-
-/**********************************************************************
- * GL API table functions.
- */
-
-
-/**
- * Return size of dispatch table struct as number of functions (or
- * slots).
- */
-GLuint
-_glapi_get_dispatch_table_size(void)
-{
- /*
- * The dispatch table size (number of entries) is the size of the
- * _glapi_table struct plus the number of dynamic entries we can add.
- * The extra slots can be filled in by DRI drivers that register new
- * extension functions.
- */
- return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS;
-}
-
-
-/**
- * Make sure there are no NULL pointers in the given dispatch table.
- * Intended for debugging purposes.
- */
-void
-_glapi_check_table_not_null(const struct _glapi_table *table)
-{
-#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
- const GLuint entries = _glapi_get_dispatch_table_size();
- const void **tab = (const void **) table;
- GLuint i;
- for (i = 1; i < entries; i++) {
- assert(tab[i]);
- }
-#else
- (void) table;
-#endif
-}
-
-
-/**
- * Do some spot checks to be sure that the dispatch table
- * slots are assigned correctly. For debugging only.
- */
-void
-_glapi_check_table(const struct _glapi_table *table)
-{
-#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
- {
- GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
- char *BeginFunc = (char*) &table->Begin;
- GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
- assert(BeginOffset == offset);
- }
- {
- GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
- char *viewportFunc = (char*) &table->Viewport;
- GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
- assert(viewportOffset == offset);
- }
- {
- GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
- char *VertexPointerFunc = (char*) &table->VertexPointer;
- GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
- assert(VertexPointerOffset == offset);
- }
- {
- GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
- char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
- GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
- assert(ResetMinMaxOffset == offset);
- }
- {
- GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
- char *blendColorFunc = (char*) &table->BlendColor;
- GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
- assert(blendColorOffset == offset);
- }
- {
- GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
- char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
- GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
- assert(secondaryColor3fOffset == offset);
- }
- {
- GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
- char *pointParameterivFunc = (char*) &table->PointParameterivNV;
- GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
- assert(pointParameterivOffset == offset);
- }
- {
- GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
- char *setFenceFunc = (char*) &table->SetFenceNV;
- GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
- assert(setFenceOffset == offset);
- }
-#else
- (void) table;
-#endif
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file glapi_getproc.c
+ *
+ * Code for implementing glXGetProcAddress(), etc.
+ * This was originally in glapi.c but refactored out.
+ */
+
+
+#include "glapi/glapi_priv.h"
+#include "glapi/glapitable.h"
+
+
+#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
+
+
+/**********************************************************************
+ * Static function management.
+ */
+
+
+#if !defined(DISPATCH_FUNCTION_SIZE)
+# define NEED_FUNCTION_POINTER
+#endif
+#include "glapi/glprocs.h"
+
+
+/**
+ * Search the table of static entrypoint functions for the named function
+ * and return the corresponding glprocs_table_t entry.
+ */
+static const glprocs_table_t *
+get_static_proc( const char * n )
+{
+ GLuint i;
+ for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+ const char *testName = gl_string_table + static_functions[i].Name_offset;
+#ifdef MANGLE
+ /* skip the prefix on the name */
+ if (strcmp(testName, n + 1) == 0)
+#else
+ if (strcmp(testName, n) == 0)
+#endif
+ {
+ return &static_functions[i];
+ }
+ }
+ return NULL;
+}
+
+
+/**
+ * Return dispatch table offset of the named static (built-in) function.
+ * Return -1 if function not found.
+ */
+static GLint
+get_static_proc_offset(const char *funcName)
+{
+ const glprocs_table_t * const f = get_static_proc( funcName );
+ if (f == NULL) {
+ return -1;
+ }
+
+ return f->Offset;
+}
+
+
+
+/**
+ * Return dispatch function address for the named static (built-in) function.
+ * Return NULL if function not found.
+ */
+static _glapi_proc
+get_static_proc_address(const char *funcName)
+{
+ const glprocs_table_t * const f = get_static_proc( funcName );
+ if (f == NULL) {
+ return NULL;
+ }
+
+#if defined(DISPATCH_FUNCTION_SIZE) && defined(GLX_INDIRECT_RENDERING)
+ return (f->Address == NULL)
+ ? get_entrypoint_address(f->Offset)
+ : f->Address;
+#elif defined(DISPATCH_FUNCTION_SIZE)
+ return get_entrypoint_address(f->Offset);
+#else
+ return f->Address;
+#endif
+}
+
+
+
+/**
+ * Return the name of the function at the given offset in the dispatch
+ * table. For debugging only.
+ */
+static const char *
+get_static_proc_name( GLuint offset )
+{
+ GLuint i;
+ for (i = 0; static_functions[i].Name_offset >= 0; i++) {
+ if (static_functions[i].Offset == offset) {
+ return gl_string_table + static_functions[i].Name_offset;
+ }
+ }
+ return NULL;
+}
+
+
+
+/**********************************************************************
+ * Extension function management.
+ */
+
+
+/**
+ * Track information about a function added to the GL API.
+ */
+struct _glapi_function {
+ /**
+ * Name of the function.
+ */
+ const char * name;
+
+
+ /**
+ * Text string that describes the types of the parameters passed to the
+ * named function. Parameter types are converted to characters using the
+ * following rules:
+ * - 'i' for \c GLint, \c GLuint, and \c GLenum
+ * - 'p' for any pointer type
+ * - 'f' for \c GLfloat and \c GLclampf
+ * - 'd' for \c GLdouble and \c GLclampd
+ */
+ const char * parameter_signature;
+
+
+ /**
+ * Offset in the dispatch table where the pointer to the real function is
+ * located. If the driver has not requested that the named function be
+ * added to the dispatch table, this will have the value ~0.
+ */
+ unsigned dispatch_offset;
+
+
+ /**
+ * Pointer to the dispatch stub for the named function.
+ *
+ * \todo
+ * The semantic of this field should be changed slightly. Currently, it
+ * is always expected to be non-\c NULL. However, it would be better to
+ * only allocate the entry-point stub when the application requests the
+ * function via \c glXGetProcAddress. This would save memory for all the
+ * functions that the driver exports but that the application never wants
+ * to call.
+ */
+ _glapi_proc dispatch_stub;
+};
+
+
+static struct _glapi_function ExtEntryTable[MAX_EXTENSION_FUNCS];
+static GLuint NumExtEntryPoints = 0;
+
+
+static struct _glapi_function *
+get_extension_proc(const char *funcName)
+{
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (strcmp(ExtEntryTable[i].name, funcName) == 0) {
+ return & ExtEntryTable[i];
+ }
+ }
+ return NULL;
+}
+
+
+static GLint
+get_extension_proc_offset(const char *funcName)
+{
+ const struct _glapi_function * const f = get_extension_proc( funcName );
+ if (f == NULL) {
+ return -1;
+ }
+
+ return f->dispatch_offset;
+}
+
+
+static _glapi_proc
+get_extension_proc_address(const char *funcName)
+{
+ const struct _glapi_function * const f = get_extension_proc( funcName );
+ if (f == NULL) {
+ return NULL;
+ }
+
+ return f->dispatch_stub;
+}
+
+
+static const char *
+get_extension_proc_name(GLuint offset)
+{
+ GLuint i;
+ for (i = 0; i < NumExtEntryPoints; i++) {
+ if (ExtEntryTable[i].dispatch_offset == offset) {
+ return ExtEntryTable[i].name;
+ }
+ }
+ return NULL;
+}
+
+
+/**
+ * strdup() is actually not a standard ANSI C or POSIX routine.
+ * Irix will not define it if ANSI mode is in effect.
+ */
+static char *
+str_dup(const char *str)
+{
+ char *copy;
+ copy = (char*) malloc(strlen(str) + 1);
+ if (!copy)
+ return NULL;
+ strcpy(copy, str);
+ return copy;
+}
+
+
+/**
+ * Generate new entrypoint
+ *
+ * Use a temporary dispatch offset of ~0 (i.e. -1). Later, when the driver
+ * calls \c _glapi_add_dispatch we'll put in the proper offset. If that
+ * never happens, and the user calls this function, he'll segfault. That's
+ * what you get when you try calling a GL function that doesn't really exist.
+ *
+ * \param funcName Name of the function to create an entry-point for.
+ *
+ * \sa _glapi_add_entrypoint
+ */
+
+static struct _glapi_function *
+add_function_name( const char * funcName )
+{
+ struct _glapi_function * entry = NULL;
+ _glapi_proc entrypoint = NULL;
+ char * name_dup = NULL;
+
+ if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS)
+ return NULL;
+
+ if (funcName == NULL)
+ return NULL;
+
+ name_dup = str_dup(funcName);
+ if (name_dup == NULL)
+ return NULL;
+
+ entrypoint = generate_entrypoint(~0);
+
+ if (entrypoint == NULL) {
+ free(name_dup);
+ return NULL;
+ }
+
+ entry = & ExtEntryTable[NumExtEntryPoints];
+ NumExtEntryPoints++;
+
+ entry->name = name_dup;
+ entry->parameter_signature = NULL;
+ entry->dispatch_offset = ~0;
+ entry->dispatch_stub = entrypoint;
+
+ return entry;
+}
+
+
+static struct _glapi_function *
+set_entry_info( struct _glapi_function * entry, const char * signature, unsigned offset )
+{
+ char * sig_dup = NULL;
+
+ if (signature == NULL)
+ return NULL;
+
+ sig_dup = str_dup(signature);
+ if (sig_dup == NULL)
+ return NULL;
+
+ fill_in_entrypoint_offset(entry->dispatch_stub, offset);
+
+ entry->parameter_signature = sig_dup;
+ entry->dispatch_offset = offset;
+
+ return entry;
+}
+
+
+/**
+ * Fill-in the dispatch stub for the named function.
+ *
+ * This function is intended to be called by a hardware driver. When called,
+ * a dispatch stub may be created created for the function. A pointer to this
+ * dispatch function will be returned by glXGetProcAddress.
+ *
+ * \param function_names Array of pointers to function names that should
+ * share a common dispatch offset.
+ * \param parameter_signature String representing the types of the parameters
+ * passed to the named function. Parameter types
+ * are converted to characters using the following
+ * rules:
+ * - 'i' for \c GLint, \c GLuint, and \c GLenum
+ * - 'p' for any pointer type
+ * - 'f' for \c GLfloat and \c GLclampf
+ * - 'd' for \c GLdouble and \c GLclampd
+ *
+ * \returns
+ * The offset in the dispatch table of the named function. A pointer to the
+ * driver's implementation of the named function should be stored at
+ * \c dispatch_table[\c offset]. Return -1 if error/problem.
+ *
+ * \sa glXGetProcAddress
+ *
+ * \warning
+ * This function can only handle up to 8 names at a time. As far as I know,
+ * the maximum number of names ever associated with an existing GL function is
+ * 4 (\c glPointParameterfSGIS, \c glPointParameterfEXT,
+ * \c glPointParameterfARB, and \c glPointParameterf), so this should not be
+ * too painful of a limitation.
+ *
+ * \todo
+ * Determine whether or not \c parameter_signature should be allowed to be
+ * \c NULL. It doesn't seem like much of a hardship for drivers to have to
+ * pass in an empty string.
+ *
+ * \todo
+ * Determine if code should be added to reject function names that start with
+ * 'glX'.
+ *
+ * \bug
+ * Add code to compare \c parameter_signature with the parameter signature of
+ * a static function. In order to do that, we need to find a way to \b get
+ * the parameter signature of a static function.
+ */
+
+int
+_glapi_add_dispatch( const char * const * function_names,
+ const char * parameter_signature )
+{
+ static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
+ const char * const real_sig = (parameter_signature != NULL)
+ ? parameter_signature : "";
+ struct _glapi_function * entry[8];
+ GLboolean is_static[8];
+ unsigned i;
+ int offset = ~0;
+
+ init_glapi_relocs_once();
+
+ (void) memset( is_static, 0, sizeof( is_static ) );
+ (void) memset( entry, 0, sizeof( entry ) );
+
+ /* Find the _single_ dispatch offset for all function names that already
+ * exist (and have a dispatch offset).
+ */
+
+ for ( i = 0 ; function_names[i] != NULL ; i++ ) {
+ const char * funcName = function_names[i];
+ int static_offset;
+ int extension_offset;
+
+ if (funcName[0] != 'g' || funcName[1] != 'l')
+ return -1;
+
+ /* search built-in functions */
+ static_offset = get_static_proc_offset(funcName);
+
+ if (static_offset >= 0) {
+
+ is_static[i] = GL_TRUE;
+
+ /* FIXME: Make sure the parameter signatures match! How do we get
+ * FIXME: the parameter signature for static functions?
+ */
+
+ if ( (offset != ~0) && (static_offset != offset) ) {
+ return -1;
+ }
+
+ offset = static_offset;
+
+ continue;
+ }
+
+ /* search added extension functions */
+ entry[i] = get_extension_proc(funcName);
+
+ if (entry[i] != NULL) {
+ extension_offset = entry[i]->dispatch_offset;
+
+ /* The offset may be ~0 if the function name was added by
+ * glXGetProcAddress but never filled in by the driver.
+ */
+
+ if (extension_offset == ~0) {
+ continue;
+ }
+
+ if (strcmp(real_sig, entry[i]->parameter_signature) != 0) {
+ return -1;
+ }
+
+ if ( (offset != ~0) && (extension_offset != offset) ) {
+ return -1;
+ }
+
+ offset = extension_offset;
+ }
+ }
+
+ /* If all function names are either new (or with no dispatch offset),
+ * allocate a new dispatch offset.
+ */
+
+ if (offset == ~0) {
+ offset = next_dynamic_offset;
+ next_dynamic_offset++;
+ }
+
+ /* Fill in the dispatch offset for the new function names (and those with
+ * no dispatch offset).
+ */
+
+ for ( i = 0 ; function_names[i] != NULL ; i++ ) {
+ if (is_static[i]) {
+ continue;
+ }
+
+ /* generate entrypoints for new function names */
+ if (entry[i] == NULL) {
+ entry[i] = add_function_name( function_names[i] );
+ if (entry[i] == NULL) {
+ /* FIXME: Possible memory leak here. */
+ return -1;
+ }
+ }
+
+ if (entry[i]->dispatch_offset == ~0) {
+ set_entry_info( entry[i], real_sig, offset );
+ }
+ }
+
+ return offset;
+}
+
+
+/**
+ * Return offset of entrypoint for named function within dispatch table.
+ */
+GLint
+_glapi_get_proc_offset(const char *funcName)
+{
+ GLint offset;
+
+ /* search extension functions first */
+ offset = get_extension_proc_offset(funcName);
+ if (offset >= 0)
+ return offset;
+
+ /* search static functions */
+ return get_static_proc_offset(funcName);
+}
+
+
+
+/**
+ * Return pointer to the named function. If the function name isn't found
+ * in the name of static functions, try generating a new API entrypoint on
+ * the fly with assembly language.
+ */
+_glapi_proc
+_glapi_get_proc_address(const char *funcName)
+{
+ _glapi_proc func;
+ struct _glapi_function * entry;
+
+ init_glapi_relocs_once();
+
+#ifdef MANGLE
+ /* skip the prefix on the name */
+ if (funcName[1] != 'g' || funcName[2] != 'l')
+ return NULL;
+#else
+ if (funcName[0] != 'g' || funcName[1] != 'l')
+ return NULL;
+#endif
+
+ /* search extension functions first */
+ func = get_extension_proc_address(funcName);
+ if (func)
+ return func;
+
+ /* search static functions */
+ func = get_static_proc_address(funcName);
+ if (func)
+ return func;
+
+ /* generate entrypoint, dispatch offset must be filled in by the driver */
+ entry = add_function_name(funcName);
+ if (entry == NULL)
+ return NULL;
+
+ return entry->dispatch_stub;
+}
+
+
+
+/**
+ * Return the name of the function at the given dispatch offset.
+ * This is only intended for debugging.
+ */
+const char *
+_glapi_get_proc_name(GLuint offset)
+{
+ const char * n;
+
+ /* search built-in functions */
+ n = get_static_proc_name(offset);
+ if ( n != NULL ) {
+ return n;
+ }
+
+ /* search added extension functions */
+ return get_extension_proc_name(offset);
+}
+
+
+
+/**********************************************************************
+ * GL API table functions.
+ */
+
+
+/**
+ * Return size of dispatch table struct as number of functions (or
+ * slots).
+ */
+GLuint
+_glapi_get_dispatch_table_size(void)
+{
+ /*
+ * The dispatch table size (number of entries) is the size of the
+ * _glapi_table struct plus the number of dynamic entries we can add.
+ * The extra slots can be filled in by DRI drivers that register new
+ * extension functions.
+ */
+ return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS;
+}
+
+
+/**
+ * Make sure there are no NULL pointers in the given dispatch table.
+ * Intended for debugging purposes.
+ */
+void
+_glapi_check_table_not_null(const struct _glapi_table *table)
+{
+#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
+ const GLuint entries = _glapi_get_dispatch_table_size();
+ const void **tab = (const void **) table;
+ GLuint i;
+ for (i = 1; i < entries; i++) {
+ assert(tab[i]);
+ }
+#else
+ (void) table;
+#endif
+}
+
+
+/**
+ * Do some spot checks to be sure that the dispatch table
+ * slots are assigned correctly. For debugging only.
+ */
+void
+_glapi_check_table(const struct _glapi_table *table)
+{
+#ifdef EXTRA_DEBUG /* set to DEBUG for extra DEBUG */
+ {
+ GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
+ char *BeginFunc = (char*) &table->Begin;
+ GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
+ assert(BeginOffset == offset);
+ }
+ {
+ GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
+ char *viewportFunc = (char*) &table->Viewport;
+ GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
+ assert(viewportOffset == offset);
+ }
+ {
+ GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
+ char *VertexPointerFunc = (char*) &table->VertexPointer;
+ GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
+ assert(VertexPointerOffset == offset);
+ }
+ {
+ GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
+ char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
+ GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
+ assert(ResetMinMaxOffset == offset);
+ }
+ {
+ GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
+ char *blendColorFunc = (char*) &table->BlendColor;
+ GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
+ assert(blendColorOffset == offset);
+ }
+ {
+ GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
+ char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
+ GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
+ assert(secondaryColor3fOffset == offset);
+ }
+ {
+ GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
+ char *pointParameterivFunc = (char*) &table->PointParameterivNV;
+ GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
+ assert(pointParameterivOffset == offset);
+ }
+ {
+ GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
+ char *setFenceFunc = (char*) &table->SetFenceNV;
+ GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
+ assert(setFenceOffset == offset);
+ }
+#else
+ (void) table;
+#endif
+}