update_ext.sh 12.8 KB
Newer Older
mem's avatar
mem committed
1
#!/bin/bash
ikits's avatar
ikits committed
2
##
ikits's avatar
ikits committed
3
4
## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
ikits's avatar
ikits committed
5
6
7
8
9
10
11
12
13
14
##
## This program is distributed under the terms and conditions of the GNU
## General Public License Version 2 as published by the Free Software
## Foundation or, at your option, any later version.
##
## Parameters:
##
##       $1: Extensions directory
##       $2: Registry directory
##       $3: The black list
mem's avatar
mem committed
15
16
17
18
19

set -e

if [ ! -d $1 ] ; then
    mkdir $1
20
21

# Parse each of the extensions in the registry
mem's avatar
mem committed
22
23
    find $2 -name doc -type d -prune -o -name \*.txt -print | \
	grep -v -f $3 | sort | bin/parse_spec.pl $1
24

mem's avatar
mem committed
25
# fix GL_NV_texture_compression_vtc
26
27
28
    grep -v EXT $1/GL_NV_texture_compression_vtc > tmp
    mv tmp $1/GL_NV_texture_compression_vtc

mem's avatar
mem committed
29
# remove duplicates from GL_ARB_vertex_program and GL_ARB_fragment_program
30
31
32
    grep -v -F -f $1/GL_ARB_vertex_program $1/GL_ARB_fragment_program > tmp
    mv tmp $1/GL_ARB_fragment_program

mem's avatar
mem committed
33
# remove duplicates from GLX_EXT_visual_rating and GLX_EXT_visual_info
34
35
36
    grep -v -F -f $1/GLX_EXT_visual_info $1/GLX_EXT_visual_rating > tmp
    mv tmp $1/GLX_EXT_visual_rating

ikits's avatar
ikits committed
37
38
39
40
41
42
43
44
# GL_EXT_draw_buffers2 and GL_EXT_transform_feedback both define glGetBooleanIndexedvEXT but with different parameter names
    grep -v glGetBooleanIndexedvEXT $1/GL_EXT_transform_feedback > tmp
    mv tmp $1/GL_EXT_transform_feedback    

# GL_EXT_draw_buffers2 and GL_EXT_transform_feedback both define glGetIntegerIndexedvEXT but with different parameter names
    grep -v glGetIntegerIndexedvEXT $1/GL_EXT_transform_feedback > tmp
    mv tmp $1/GL_EXT_transform_feedback    

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# remove duplicates from GL_NV_video_capture and GLX_NV_video_capture
    grep -v glX $1/GL_NV_video_capture > tmp
    mv tmp $1/GL_NV_video_capture

# add missing functions to GL_NV_video_capture
	cat >> $1/GL_NV_video_capture <<EOT
    void glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params)
    void glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params)
    void glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params)
    void glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params)
    void glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params)
    void glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params)
EOT

# fix WGL_NV_video_capture
    cat >> $1/WGL_NV_video_capture <<EOT
    DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
EOT

64
65
66
67
68
# fix GLX_NV_video_capture
    cat >> $1/GLX_NV_video_capture <<EOT
    typedef XID GLXVideoCaptureDeviceNV
EOT

ikits's avatar
ikits committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# remove duplicates from GL_NV_present_video and GLX_NV_present_video
    grep -v -F -f $1/GLX_NV_present_video $1/GL_NV_present_video > tmp
    mv tmp $1/GL_NV_present_video

# fix WGL_NV_present_video
    cat >> $1/WGL_NV_present_video <<EOT
    DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
EOT

# fix WGL_NV_video_output
    cat >> $1/WGL_NV_video_output <<EOT
    DECLARE_HANDLE(HPVIDEODEV);
EOT

mem's avatar
mem committed
83
# fix GL_NV_occlusion_query and GL_HP_occlusion_test
84
85
    grep -v '_HP' $1/GL_NV_occlusion_query > tmp
    mv tmp $1/GL_NV_occlusion_query
ikits's avatar
ikits committed
86
    perl -e's/OCCLUSION_TEST_HP.*/OCCLUSION_TEST_HP 0x8165/' -pi \
ikits's avatar
ikits committed
87
	$1/GL_HP_occlusion_test
ikits's avatar
ikits committed
88
    perl -e's/OCCLUSION_TEST_RESULT_HP.*/OCCLUSION_TEST_RESULT_HP 0x8166/' -pi \
ikits's avatar
ikits committed
89
	$1/GL_HP_occlusion_test
90

ikits's avatar
ikits committed
91
# fix GLvoid in GL_ARB_vertex_buffer_objects
ikits's avatar
ikits committed
92
    perl -e 's/ void\*/ GLvoid\*/g' -pi \
ikits's avatar
ikits committed
93
94
        $1/GL_ARB_vertex_buffer_object

ikits's avatar
ikits committed
95
96
97
98
99
100
101
102
103
104
# add deprecated constants to GL_ATI_fragment_shader
    cat >> $1/GL_ATI_fragment_shader <<EOT
	GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
	GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
	GL_NUM_PASSES_ATI 0x8970
	GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
	GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
	GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
	GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
	GL_COLOR_ALPHA_PAIRING_ATI 0x8975
ikits's avatar
ikits committed
105
106
	GL_SWIZZLE_STRQ_ATI 0x897A
	GL_SWIZZLE_STRQ_DQ_ATI 0x897B
ikits's avatar
ikits committed
107
108
EOT

ikits's avatar
ikits committed
109
110
111
112
113
114
115
# add deprecated constants to GL_NV_texture_shader
    cat >> $1/GL_NV_texture_shader <<EOT
	GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1
	GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3
	GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2
EOT
	
mem's avatar
mem committed
116
# fix WGL_ATI_pixel_format_float
117
118
    cat >> $1/WGL_ATI_pixel_format_float <<EOT
	GL_RGBA_FLOAT_MODE_ATI 0x8820
ikits's avatar
ikits committed
119
	GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
120
121
EOT

ikits's avatar
ikits committed
122
123
124
125
126
127
128
129
130
131
132
# fix WGL_ARB_make_current_read
    cat >> $1/WGL_ARB_make_current_read <<EOT
	ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
	ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
EOT

# fix WGL_EXT_make_current_read
    cat >> $1/WGL_EXT_make_current_read <<EOT
	ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
EOT

133
134
135
136
137
138
139
140
141
142
143
144
145
# add typedefs to GL_ARB_vertex_buffer_object; (from personal communication
# with Marco Fabbricatore).
#
# Rationale.  The spec says:
#
#   "Both types are defined as signed integers large enough to contain
#   any pointer value [...] The idea of making these types unsigned was
#   considered, but was ultimately rejected ..."
    cat >> $1/GL_ARB_vertex_buffer_object <<EOT
	typedef ptrdiff_t GLsizeiptrARB
	typedef ptrdiff_t GLintptrARB
EOT

mem's avatar
mem committed
146
# add typedefs to GLX_EXT_import_context
147
148
149
150
    cat >> $1/GLX_EXT_import_context <<EOT
	typedef XID GLXContextID
EOT

mem's avatar
mem committed
151
# add tokens to GLX_OML_swap_method
152
153
154
155
156
157
    cat >> $1/GLX_OML_swap_method <<EOT
	GLX_SWAP_EXCHANGE_OML 0x8061
	GLX_SWAP_COPY_OML 0x8062
	GLX_SWAP_UNDEFINED_OML 0x8063
EOT

mem's avatar
mem committed
158
# add typedefs to GLX_SGIX_fbconfig
159
160
161
162
163
    cat >> $1/GLX_SGIX_fbconfig <<EOT
	typedef XID GLXFBConfigIDSGIX
	typedef struct __GLXFBConfigRec *GLXFBConfigSGIX
EOT

mem's avatar
mem committed
164
# add typedefs to GLX_SGIX_pbuffer
165
166
167
168
169
    cat >> $1/GLX_SGIX_pbuffer <<EOT
	typedef XID GLXPbufferSGIX
	typedef struct { int type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; int event_type; int draw_type; unsigned int mask; int x, y; int width, height; int count; } GLXBufferClobberEventSGIX
EOT

mem's avatar
mem committed
170
# add typedef to GL_NV_half_float
171
172
173
174
    cat >> $1/GL_NV_half_float <<EOT
	typedef unsigned short GLhalf
EOT

mem's avatar
mem committed
175
# add handle to WGL_ARB_pbuffer
176
177
178
179
    cat >> $1/WGL_ARB_pbuffer <<EOT
	DECLARE_HANDLE(HPBUFFERARB);
EOT

mem's avatar
mem committed
180
# add handle to WGL_EXT_pbuffer
181
182
183
184
    cat >> $1/WGL_EXT_pbuffer <<EOT
	DECLARE_HANDLE(HPBUFFEREXT);
EOT

mem's avatar
mem committed
185
186
# get rid of GL_SUN_multi_draw_arrays
    rm -f $1/GL_SUN_multi_draw_arrays
187

188
# change variable names in GL_ARB_vertex_shader
ikits's avatar
ikits committed
189
190
191
192
    perl -e 's/v0/x/g' -pi $1/GL_ARB_vertex_shader
    perl -e 's/v1/y/g' -pi $1/GL_ARB_vertex_shader
    perl -e 's/v2/z/g' -pi $1/GL_ARB_vertex_shader
    perl -e 's/v3/w/g' -pi $1/GL_ARB_vertex_shader
193

194
195
# remove triplicates in GL_ARB_shader_objects, GL_ARB_fragment_shader, 
# and GL_ARB_vertex_shader
196
197
198
199
200
    grep -v -F -f $1/GL_ARB_shader_objects $1/GL_ARB_fragment_shader > tmp
    mv tmp $1/GL_ARB_fragment_shader
    grep -v -F -f $1/GL_ARB_shader_objects $1/GL_ARB_vertex_shader > tmp
    mv tmp $1/GL_ARB_vertex_shader

201
# remove duplicates in GL_ARB_vertex_program and GL_ARB_vertex_shader
202
203
204
205
    grep -v -F -f $1/GL_ARB_vertex_program $1/GL_ARB_vertex_shader > tmp
    mv tmp $1/GL_ARB_vertex_shader

# remove triplicates in GL_ARB_fragment_program, GL_ARB_fragment_shader,
206
# and GL_ARB_vertex_shader
ikits's avatar
ikits committed
207
    grep -v -F -f $1/GL_ARB_fragment_program $1/GL_ARB_fragment_shader > tmp
208
209
210
211
    mv tmp $1/GL_ARB_fragment_shader
    grep -v -F -f $1/GL_ARB_fragment_program $1/GL_ARB_vertex_shader > tmp
    mv tmp $1/GL_ARB_vertex_shader

ikits's avatar
ikits committed
212
213
214
215
216
217
218
219
220
221
222
223
# remove duplicates in GL_EXT_direct_state_access
    grep -v "glGetBooleanIndexedvEXT" $1/GL_EXT_direct_state_access > tmp
    mv tmp $1/GL_EXT_direct_state_access
    grep -v "glGetIntegerIndexedvEXT" $1/GL_EXT_direct_state_access > tmp
    mv tmp $1/GL_EXT_direct_state_access
    grep -v "glDisableIndexedEXT" $1/GL_EXT_direct_state_access > tmp
    mv tmp $1/GL_EXT_direct_state_access
    grep -v "glEnableIndexedEXT" $1/GL_EXT_direct_state_access > tmp
    mv tmp $1/GL_EXT_direct_state_access
    grep -v "glIsEnabledIndexedEXT" $1/GL_EXT_direct_state_access > tmp
    mv tmp $1/GL_EXT_direct_state_access

224
225
226
227
228
229
# remove duplicates in GL_NV_explicit_multisample
    grep -v "glGetBooleanIndexedvEXT" $1/GL_NV_explicit_multisample > tmp
    mv tmp $1/GL_NV_explicit_multisample
    grep -v "glGetIntegerIndexedvEXT" $1/GL_NV_explicit_multisample > tmp
    mv tmp $1/GL_NV_explicit_multisample

230
# fix bugs in GL_ARB_vertex_shader
231
232
    grep -v "GL_FLOAT" $1/GL_ARB_vertex_shader > tmp
    mv tmp $1/GL_ARB_vertex_shader
ikits's avatar
ikits committed
233
    perl -e 's/handle /GLhandleARB /g' -pi $1/GL_ARB_vertex_shader
234

235
# fix bugs in GL_ARB_shader_objects
236
    grep -v "GL_FLOAT " $1/GL_ARB_shader_objects > tmp
237
    mv tmp $1/GL_ARB_shader_objects
238
    grep -v "GL_INT " $1/GL_ARB_shader_objects > tmp
239
240
    mv tmp $1/GL_ARB_shader_objects

241
# add typedefs to GL_ARB_shader_objects
242
243
    cat >> $1/GL_ARB_shader_objects <<EOT
	typedef char GLcharARB
ikits's avatar
ikits committed
244
	typedef unsigned int GLhandleARB
245
EOT
ikits's avatar
ikits committed
246

ikits's avatar
ikits committed
247
248
249
250
251
252
253
254
# add missing functions to GL_ARB_transpose_matrix
	cat >> $1/GL_ARB_transpose_matrix <<EOT
	void glLoadTransposeMatrixfARB (GLfloat m[16])
	void glLoadTransposeMatrixdARB (GLdouble m[16])
	void glMultTransposeMatrixfARB (GLfloat m[16])
	void glMultTransposeMatrixdARB (GLdouble m[16])
EOT

255
256
257
258
259
260
# add missing tokens to GL_EXT_framebuffer_multisample
	cat >> $1/GL_EXT_framebuffer_multisample <<EOT
	GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
	GL_MAX_SAMPLES_EXT 0x8D57
EOT

261
262
263
264
265
266
267
268
# Filter out GL_NV_gpu_program_fp64 enums and functions
    head -n3 $1/GL_NV_gpu_program_fp64 > tmp
    mv tmp $1/GL_NV_gpu_program_fp64

# Filter glGetUniformui64vNV from GL_NV_shader_buffer_load
    grep -v "glGetUniformui64vNV" $1/GL_NV_shader_buffer_load > tmp
    mv tmp $1/GL_NV_shader_buffer_load

269
270
271
272
273
# Filter out profile enumerations from GLX_ARB_create_context
    grep -v "_PROFILE_" $1/GLX_ARB_create_context > tmp
    mv tmp $1/GLX_ARB_create_context

# Filter only profile related enumerations for GLX_ARB_create_context_profile
274
    head -n3 $1/GLX_ARB_create_context_profile > tmp
275
276
277
278
279
280
281
282
    grep "_PROFILE_" $1/GLX_ARB_create_context_profile >> tmp
    mv tmp $1/GLX_ARB_create_context_profile

# Filter out profile enumerations from WGL_ARB_create_context
    grep -v "_PROFILE_" $1/WGL_ARB_create_context > tmp
    mv tmp $1/WGL_ARB_create_context

# Filter only profile related enumerations for WGL_ARB_create_context_profile
283
    head -n3 $1/WGL_ARB_create_context_profile > tmp
284
285
286
287
288
289
290
291
292
293
294
295
296
    grep "_PROFILE_" $1/WGL_ARB_create_context_profile >> tmp
    mv tmp $1/WGL_ARB_create_context_profile

# add missing function to GLX_NV_copy_image
	cat >> $1/GLX_NV_copy_image <<EOT
  void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth)
EOT

# add missing function to WGL_NV_copy_image
	cat >> $1/WGL_NV_copy_image <<EOT
  BOOL wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth)
EOT

nigels's avatar
nigels committed
297
# Filter glProgramParameteri from GL_ARB_separate_shader_objects
298
299
#    grep -v "glProgramParameteri" $1/GL_ARB_separate_shader_objects > tmp
#    mv tmp $1/GL_ARB_separate_shader_objects
nigels's avatar
nigels committed
300
301
302
303
304

# Filter out EXT functions from GL_ARB_viewport_array
    grep -v "EXT" $1/GL_ARB_viewport_array > tmp
    mv tmp $1/GL_ARB_viewport_array

305
306
307
308
309
310
311
312
313
# Additional enumerations for GL_NV_vertex_buffer_unified_memory
# These are mentioned in GL_ARB_draw_indirect.txt

    cat >> $1/GL_NV_vertex_buffer_unified_memory <<EOT
	GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
	GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
	GL_DRAW_INDIRECT_LENGTH_NV  0x8F42
EOT

314
315
316
317
318
319
# Filter glGetPointerv from GL_ARB_debug_output
# It's part of OpenGL 1.1, after all

    grep -v "glGetPointerv" $1/GL_ARB_debug_output > tmp
    mv tmp $1/GL_ARB_debug_output

320
321
322
323
324
325
# Filter glGetPointerv from GL_EXT_vertex_array
# It's part of OpenGL 1.1, after all

    grep -v "glGetPointerv" $1/GL_EXT_vertex_array > tmp
    mv tmp $1/GL_EXT_vertex_array

326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# add typedef to GL_AMD_debug_output
# parse_spec.pl can't parse typedefs from New Types section, but ought to
    cat >> $1/GL_AMD_debug_output <<EOT
	typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam)
EOT

# add typedef to GL_ARB_debug_output
# parse_spec.pl can't parse typedefs from New Types section, but ought to
    cat >> $1/GL_ARB_debug_output <<EOT
	typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam)
EOT

# add typedefs to GL_ARB_cl_event
# parse_spec.pl can't parse typedefs from New Types section, but ought to
    cat >> $1/GL_ARB_cl_event <<EOT
	typedef struct _cl_context *cl_context
	typedef struct _cl_event *cl_event
EOT

ikits's avatar
ikits committed
345
346
# clean up
    rm -f $1/*.bak
ikits's avatar
ikits committed
347

mem's avatar
mem committed
348
fi