1#!/bin/bash
2##
3## Copyright (C) 2002-2008, Marcelo E. Magallon <mmagallo[]debian org>
4## Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
5##
6## This program is distributed under the terms and conditions of the GNU
7## General Public License Version 2 as published by the Free Software
8## Foundation or, at your option, any later version.
9##
10## Parameters:
11##
12##       $1: Extensions directory
13
14set -e
15
16# fix GL_NV_texture_compression_vtc
17    grep -v EXT $1/GL_NV_texture_compression_vtc > tmp
18    mv tmp $1/GL_NV_texture_compression_vtc
19
20# remove duplicates from GL_ARB_vertex_program and GL_ARB_fragment_program
21    tail -n +5 $1/GL_ARB_vertex_program > patterns
22    grep -v -F -f patterns $1/GL_ARB_fragment_program > tmp
23    mv tmp $1/GL_ARB_fragment_program
24
25# remove duplicates from GLX_EXT_visual_rating and GLX_EXT_visual_info
26    tail -n +5 $1/GLX_EXT_visual_info > patterns
27    grep -v -F -f patterns $1/GLX_EXT_visual_rating > tmp
28    mv tmp $1/GLX_EXT_visual_rating
29
30# GL_EXT_draw_buffers2 and GL_EXT_transform_feedback both define glGetBooleanIndexedvEXT but with different parameter names
31    grep -v glGetBooleanIndexedvEXT $1/GL_EXT_transform_feedback > tmp
32    mv tmp $1/GL_EXT_transform_feedback
33
34# GL_EXT_draw_buffers2 and GL_EXT_transform_feedback both define glGetIntegerIndexedvEXT but with different parameter names
35    grep -v glGetIntegerIndexedvEXT $1/GL_EXT_transform_feedback > tmp
36    mv tmp $1/GL_EXT_transform_feedback
37
38# remove duplicates from GL_NV_video_capture and GLX_NV_video_capture
39    grep -v glX $1/GL_NV_video_capture > tmp
40    mv tmp $1/GL_NV_video_capture
41
42# add missing functions to GL_NV_video_capture
43	cat >> $1/GL_NV_video_capture <<EOT
44    void glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint* params)
45    void glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat* params)
46    void glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble* params)
47    void glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint* params)
48    void glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat* params)
49    void glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble* params)
50EOT
51
52# fix WGL_NV_video_capture
53    cat >> $1/WGL_NV_video_capture <<EOT
54    DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
55EOT
56
57# fix GLX_NV_video_capture
58    cat >> $1/GLX_NV_video_capture <<EOT
59    typedef XID GLXVideoCaptureDeviceNV
60EOT
61
62# remove duplicates from GL_NV_present_video and GLX_NV_present_video
63    tail -n +5 $1/GLX_NV_present_video > patterns
64    grep -v -F -f patterns $1/GL_NV_present_video > tmp
65    mv tmp $1/GL_NV_present_video
66
67# fix WGL_NV_present_video
68    cat >> $1/WGL_NV_present_video <<EOT
69    DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
70EOT
71
72# fix WGL_NV_video_output
73    cat >> $1/WGL_NV_video_output <<EOT
74    DECLARE_HANDLE(HPVIDEODEV);
75EOT
76
77# fix GL_NV_occlusion_query and GL_HP_occlusion_test
78    grep -v '_HP' $1/GL_NV_occlusion_query > tmp
79    mv tmp $1/GL_NV_occlusion_query
80    perl -e's/OCCLUSION_TEST_HP.*/OCCLUSION_TEST_HP 0x8165/' -pi \
81	$1/GL_HP_occlusion_test
82    perl -e's/OCCLUSION_TEST_RESULT_HP.*/OCCLUSION_TEST_RESULT_HP 0x8166/' -pi \
83	$1/GL_HP_occlusion_test
84
85# add deprecated constants to GL_ATI_fragment_shader
86    cat >> $1/GL_ATI_fragment_shader <<EOT
87	GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
88	GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
89	GL_NUM_PASSES_ATI 0x8970
90	GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
91	GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
92	GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
93	GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
94	GL_COLOR_ALPHA_PAIRING_ATI 0x8975
95	GL_SWIZZLE_STRQ_ATI 0x897A
96	GL_SWIZZLE_STRQ_DQ_ATI 0x897B
97EOT
98
99# add deprecated constants to GL_NV_texture_shader
100    cat >> $1/GL_NV_texture_shader <<EOT
101	GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1
102	GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3
103	GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2
104EOT
105
106# fix WGL_ATI_pixel_format_float
107    cat >> $1/WGL_ATI_pixel_format_float <<EOT
108	GL_RGBA_FLOAT_MODE_ATI 0x8820
109	GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
110EOT
111
112# fix WGL_ARB_make_current_read
113    cat >> $1/WGL_ARB_make_current_read <<EOT
114	ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
115	ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
116EOT
117
118# fix WGL_EXT_make_current_read
119    cat >> $1/WGL_EXT_make_current_read <<EOT
120	ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
121EOT
122
123# add typedefs to GL_ARB_vertex_buffer_object; (from personal communication
124# with Marco Fabbricatore).
125#
126# Rationale.  The spec says:
127#
128#   "Both types are defined as signed integers large enough to contain
129#   any pointer value [...] The idea of making these types unsigned was
130#   considered, but was ultimately rejected ..."
131    cat >> $1/GL_ARB_vertex_buffer_object <<EOT
132	typedef ptrdiff_t GLsizeiptrARB
133	typedef ptrdiff_t GLintptrARB
134EOT
135
136# add typedefs to GLX_EXT_import_context
137    cat >> $1/GLX_EXT_import_context <<EOT
138	typedef XID GLXContextID
139EOT
140
141# add tokens to GLX_OML_swap_method
142    cat >> $1/GLX_OML_swap_method <<EOT
143	GLX_SWAP_EXCHANGE_OML 0x8061
144	GLX_SWAP_COPY_OML 0x8062
145	GLX_SWAP_UNDEFINED_OML 0x8063
146EOT
147
148# add typedefs to GLX_SGIX_fbconfig
149    cat >> $1/GLX_SGIX_fbconfig <<EOT
150	typedef XID GLXFBConfigIDSGIX
151	typedef struct __GLXFBConfigRec *GLXFBConfigSGIX
152EOT
153
154# add typedefs to GLX_SGIX_pbuffer
155    cat >> $1/GLX_SGIX_pbuffer <<EOT
156	typedef XID GLXPbufferSGIX
157	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
158EOT
159
160# add typedef to GL_NV_half_float
161    cat >> $1/GL_NV_half_float <<EOT
162	typedef unsigned short GLhalf
163EOT
164
165# add handle to WGL_ARB_pbuffer
166    cat >> $1/WGL_ARB_pbuffer <<EOT
167	DECLARE_HANDLE(HPBUFFERARB);
168EOT
169
170# add handle to WGL_EXT_pbuffer
171    cat >> $1/WGL_EXT_pbuffer <<EOT
172	DECLARE_HANDLE(HPBUFFEREXT);
173EOT
174
175# get rid of GL_SUN_multi_draw_arrays
176    rm -f $1/GL_SUN_multi_draw_arrays
177
178# change variable names in GL_ARB_vertex_shader
179    perl -e 's/v0/x/g' -pi $1/GL_ARB_vertex_shader
180    perl -e 's/v1/y/g' -pi $1/GL_ARB_vertex_shader
181    perl -e 's/v2/z/g' -pi $1/GL_ARB_vertex_shader
182    perl -e 's/v3/w/g' -pi $1/GL_ARB_vertex_shader
183
184# remove triplicates in GL_ARB_shader_objects, GL_ARB_fragment_shader,
185# and GL_ARB_vertex_shader
186    tail -n +5 $1/GL_ARB_shader_objects > patterns
187    grep -v -F -f patterns $1/GL_ARB_fragment_shader > tmp
188    mv tmp $1/GL_ARB_fragment_shader
189    grep -v -F -f patterns $1/GL_ARB_vertex_shader > tmp
190    mv tmp $1/GL_ARB_vertex_shader
191
192# remove duplicates in GL_ARB_vertex_program and GL_ARB_vertex_shader
193    tail -n +5 $1/GL_ARB_vertex_program > patterns
194    grep -v -F -f patterns $1/GL_ARB_vertex_shader > tmp
195    mv tmp $1/GL_ARB_vertex_shader
196
197# remove triplicates in GL_ARB_fragment_program, GL_ARB_fragment_shader,
198# and GL_ARB_vertex_shader
199    tail -n +5 $1/GL_ARB_fragment_program > patterns
200    grep -v -F -f patterns $1/GL_ARB_fragment_shader > tmp
201    mv tmp $1/GL_ARB_fragment_shader
202    grep -v -F -f patterns $1/GL_ARB_vertex_shader > tmp
203    mv tmp $1/GL_ARB_vertex_shader
204
205# remove duplicates in GL_EXT_direct_state_access
206    grep -v "glGetBooleanIndexedvEXT" $1/GL_EXT_direct_state_access > tmp
207    mv tmp $1/GL_EXT_direct_state_access
208    grep -v "glGetIntegerIndexedvEXT" $1/GL_EXT_direct_state_access > tmp
209    mv tmp $1/GL_EXT_direct_state_access
210    grep -v "glDisableIndexedEXT" $1/GL_EXT_direct_state_access > tmp
211    mv tmp $1/GL_EXT_direct_state_access
212    grep -v "glEnableIndexedEXT" $1/GL_EXT_direct_state_access > tmp
213    mv tmp $1/GL_EXT_direct_state_access
214    grep -v "glIsEnabledIndexedEXT" $1/GL_EXT_direct_state_access > tmp
215    mv tmp $1/GL_EXT_direct_state_access
216
217# remove duplicates in GL_NV_explicit_multisample
218    grep -v "glGetBooleanIndexedvEXT" $1/GL_NV_explicit_multisample > tmp
219    mv tmp $1/GL_NV_explicit_multisample
220    grep -v "glGetIntegerIndexedvEXT" $1/GL_NV_explicit_multisample > tmp
221    mv tmp $1/GL_NV_explicit_multisample
222
223# fix bugs in GL_ARB_vertex_shader
224    grep -v "GL_FLOAT" $1/GL_ARB_vertex_shader > tmp
225    mv tmp $1/GL_ARB_vertex_shader
226    perl -e 's/handle /GLhandleARB /g' -pi $1/GL_ARB_vertex_shader
227
228# fix bugs in GL_ARB_shader_objects
229    grep -v "GL_FLOAT " $1/GL_ARB_shader_objects > tmp
230    mv tmp $1/GL_ARB_shader_objects
231    grep -v "GL_INT " $1/GL_ARB_shader_objects > tmp
232    mv tmp $1/GL_ARB_shader_objects
233
234# add typedefs to GL_ARB_shader_objects
235    cat >> $1/GL_ARB_shader_objects <<EOT
236	typedef char GLcharARB
237	typedef unsigned int GLhandleARB
238EOT
239
240# add missing functions to GL_ARB_transpose_matrix
241	cat >> $1/GL_ARB_transpose_matrix <<EOT
242	void glLoadTransposeMatrixfARB (GLfloat m[16])
243	void glLoadTransposeMatrixdARB (GLdouble m[16])
244	void glMultTransposeMatrixfARB (GLfloat m[16])
245	void glMultTransposeMatrixdARB (GLdouble m[16])
246EOT
247
248# add missing tokens to GL_EXT_framebuffer_multisample
249	cat >> $1/GL_EXT_framebuffer_multisample <<EOT
250	GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
251	GL_MAX_SAMPLES_EXT 0x8D57
252EOT
253
254# Filter out GL_NV_gpu_program_fp64 enums and functions
255    head -n4 $1/GL_NV_gpu_program_fp64 > tmp
256    mv tmp $1/GL_NV_gpu_program_fp64
257
258# Filter glGetUniformui64vNV from GL_NV_shader_buffer_load
259    grep -v "glGetUniformui64vNV" $1/GL_NV_shader_buffer_load > tmp
260    mv tmp $1/GL_NV_shader_buffer_load
261
262# Filter out profile enumerations from GLX_ARB_create_context
263    grep -v "_PROFILE_" $1/GLX_ARB_create_context > tmp
264    mv tmp $1/GLX_ARB_create_context
265
266# Filter only profile related enumerations for GLX_ARB_create_context_profile
267    head -n4 $1/GLX_ARB_create_context_profile > tmp
268    grep "_PROFILE_" $1/GLX_ARB_create_context_profile >> tmp
269    mv tmp $1/GLX_ARB_create_context_profile
270
271# Filter out profile enumerations from WGL_ARB_create_context
272    grep -v "_PROFILE_" $1/WGL_ARB_create_context > tmp
273    mv tmp $1/WGL_ARB_create_context
274
275# Filter only profile related enumerations for WGL_ARB_create_context_profile
276    head -n4 $1/WGL_ARB_create_context_profile > tmp
277    grep "_PROFILE_" $1/WGL_ARB_create_context_profile >> tmp
278    mv tmp $1/WGL_ARB_create_context_profile
279
280# add missing function to GLX_NV_copy_image
281	cat >> $1/GLX_NV_copy_image <<EOT
282  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)
283EOT
284
285# add missing function to WGL_NV_copy_image
286	cat >> $1/WGL_NV_copy_image <<EOT
287  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)
288EOT
289
290# Filter glProgramParameteri from GL_ARB_separate_shader_objects
291#    grep -v "glProgramParameteri" $1/GL_ARB_separate_shader_objects > tmp
292#    mv tmp $1/GL_ARB_separate_shader_objects
293
294# Filter out EXT functions from GL_ARB_viewport_array
295    grep -v "EXT" $1/GL_ARB_viewport_array > tmp
296    mv tmp $1/GL_ARB_viewport_array
297
298# Additional enumerations for GL_NV_vertex_buffer_unified_memory
299# These are mentioned in GL_ARB_draw_indirect.txt
300
301    cat >> $1/GL_NV_vertex_buffer_unified_memory <<EOT
302	GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
303	GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
304	GL_DRAW_INDIRECT_LENGTH_NV  0x8F42
305EOT
306
307# Filter glGetPointerv from GL_ARB_debug_output
308# It's part of OpenGL 1.1, after all
309
310    grep -v "glGetPointerv" $1/GL_ARB_debug_output > tmp
311    mv tmp $1/GL_ARB_debug_output
312
313# Filter glGetPointerv from GL_EXT_vertex_array
314# It's part of OpenGL 1.1, after all
315
316    grep -v "glGetPointerv" $1/GL_EXT_vertex_array > tmp
317    mv tmp $1/GL_EXT_vertex_array
318
319# add typedef to GL_AMD_debug_output
320# parse_spec.pl can't parse typedefs from New Types section, but ought to
321    cat >> $1/GL_AMD_debug_output <<EOT
322	typedef void (GLAPIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, void* userParam)
323EOT
324
325# add typedef to GL_ARB_debug_output
326# parse_spec.pl can't parse typedefs from New Types section, but ought to
327    cat >> $1/GL_ARB_debug_output <<EOT
328	typedef void (GLAPIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
329EOT
330
331# add typedef to GL_KHR_debug
332# parse_spec.pl can't parse typedefs from New Types section, but ought to
333    cat >> $1/GL_KHR_debug <<EOT
334	typedef void (GLAPIENTRY *GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
335EOT
336
337# Remove glGetPointerv from GL_KHR_debug
338    grep -v "glGetPointerv" $1/GL_KHR_debug > tmp
339    mv tmp $1/GL_KHR_debug
340
341# Remove GL_ARB_debug_group, GL_ARB_debug_label and GL_ARB_debug_output2, for now
342    rm -f $1/GL_ARB_debug_group
343    rm -f $1/GL_ARB_debug_label
344    rm -f $1/GL_ARB_debug_output2
345
346# add typedefs to GL_ARB_cl_event
347# parse_spec.pl can't parse typedefs from New Types section, but ought to
348    cat >> $1/GL_ARB_cl_event <<EOT
349	typedef struct _cl_context *cl_context
350	typedef struct _cl_event *cl_event
351EOT
352
353# Filter out EXT functions from GL_ARB_gpu_shader_fp64
354    grep -v 'EXT ' $1/GL_ARB_gpu_shader_fp64 > tmp
355    mv tmp $1/GL_ARB_gpu_shader_fp64
356
357# add missing functions to GL_EXT_direct_state_access (GL_ARB_gpu_shader_fp64 related)
358	cat >> $1/GL_EXT_direct_state_access <<EOT
359    void glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x)
360    void glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y)
361    void glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z)
362    void glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w)
363    void glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
364    void glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
365    void glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
366    void glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value)
367    void glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
368    void glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
369    void glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
370    void glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
371    void glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
372    void glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
373    void glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
374    void glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
375    void glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)
376EOT
377
378# add missing functions to GL_EXT_direct_state_access (GL_ARB_instanced_arrays related)
379# https://sourceforge.net/p/glew/bugs/242/
380    cat >> $1/GL_EXT_direct_state_access <<EOT
381    void glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor)
382EOT
383
384# Filter out GL_UNSIGNED_INT and GL_FLOAT from GL_AMD_performance_monitor
385    grep -v 'GL_UNSIGNED_INT ' $1/GL_AMD_performance_monitor > tmp
386    mv tmp $1/GL_AMD_performance_monitor
387    grep -v 'GL_FLOAT ' $1/GL_AMD_performance_monitor > tmp
388    mv tmp $1/GL_AMD_performance_monitor
389
390# Filter out GL_STORAGE_CACHED_APPLE and GL_STORAGE_SHARED_APPLE from GL_APPLE_texture_range
391    grep -v 'GL_STORAGE_CACHED_APPLE ' $1/GL_APPLE_texture_range > tmp
392    mv tmp $1/GL_APPLE_texture_range
393    grep -v 'GL_STORAGE_SHARED_APPLE ' $1/GL_APPLE_texture_range > tmp
394    mv tmp $1/GL_APPLE_texture_range
395
396# Filter out GL_RED from GL_ARB_texture_rg
397    grep -v 'GL_RED ' $1/GL_ARB_texture_rg > tmp
398    mv tmp $1/GL_ARB_texture_rg
399
400# Filter out _EXT enums from GL_ARB_texture_storage
401    grep -v '_EXT ' $1/GL_ARB_texture_storage > tmp
402    mv tmp $1/GL_ARB_texture_storage
403
404# Filter out TEXTURE_3D enums from GL_EXT_paletted_texture
405    grep -v 'TEXTURE_3D' $1/GL_EXT_paletted_texture > tmp
406    mv tmp $1/GL_EXT_paletted_texture
407
408# Filter out GL_VERSION_1_1 enums from GL_AMD_stencil_operation_extended
409    grep -v '0x150' $1/GL_AMD_stencil_operation_extended > tmp
410    mv tmp $1/GL_AMD_stencil_operation_extended
411
412# Filter out from GL_APPLE_ycbcr_422
413    grep -v 'GL_UNSIGNED_SHORT_8_8_APPLE' $1/GL_APPLE_ycbcr_422 > tmp
414    mv tmp $1/GL_APPLE_ycbcr_422
415    grep -v 'GL_UNSIGNED_SHORT_8_8_REV_APPLE' $1/GL_APPLE_ycbcr_422 > tmp
416    mv tmp $1/GL_APPLE_ycbcr_422
417
418# Filter out GL_FRAGMENT_DEPTH_EXT from GL_EXT_light_texture
419    grep -v 'GL_FRAGMENT_DEPTH_EXT' $1/GL_EXT_light_texture > tmp
420    mv tmp $1/GL_EXT_light_texture
421
422# Filter out GL_MULTISAMPLE_BIT_EXT from GL_SGIS_multisample
423    grep -v 'GL_MULTISAMPLE_BIT_EXT' $1/GL_SGIS_multisample > tmp
424    mv tmp $1/GL_SGIS_multisample
425
426# Filter out GL_COMPRESSED_RGB_S3TC_DXT1_EXT from GL_EXT_texture_compression_dxt1
427    grep -v 'GL_COMPRESSED_RGB_S3TC_DXT1_EXT' $1/GL_EXT_texture_compression_dxt1 > tmp
428    mv tmp $1/GL_EXT_texture_compression_dxt1
429
430# Filter out GL_COMPRESSED_RGBA_S3TC_DXT1_EXT from GL_EXT_texture_compression_dxt1
431    grep -v 'GL_COMPRESSED_RGBA_S3TC_DXT1_EXT' $1/GL_EXT_texture_compression_dxt1 > tmp
432    mv tmp $1/GL_EXT_texture_compression_dxt1
433
434# Append GLfixed to GL_ARB_ES2_compatibility
435# Probably ought to be explicitly mentioned in the spec language
436
437    cat >> $1/GL_ARB_ES2_compatibility <<EOT
438	typedef int GLfixed
439EOT
440
441# Append GLclampx to GL_REGAL_ES1_0_compatibility
442# Probably ought to be explicitly mentioned in the spec language
443
444    cat >> $1/GL_REGAL_ES1_0_compatibility <<EOT
445	typedef int GLclampx
446EOT
447
448# Append GLLOGPROCREGAL to GL_REGAL_log
449# Probably ought to be explicitly mentioned in the spec language
450
451    cat >> $1/GL_REGAL_log <<EOT
452	typedef void (APIENTRY *LOGPROCREGAL)(GLenum stream, GLsizei length, const GLchar *message, void *context)
453EOT
454
455# Fixup LOGPROCREGAL -> GLLOGPROCREGAL
456    perl -e 's/LOGPROCREGAL/GLLOGPROCREGAL/g' -pi $1/GL_REGAL_log
457
458# Filter out GL_BYTE from GL_OES_byte_coordinates
459    grep -v 'GL_BYTE' $1/GL_OES_byte_coordinates > tmp
460    mv tmp $1/GL_OES_byte_coordinates
461
462# Filter out fp64 (not widely supported) from GL_EXT_direct_state_access
463    egrep -v 'glProgramUniform.*[1234]d[v]?EXT' $1/GL_EXT_direct_state_access > tmp
464    mv tmp $1/GL_EXT_direct_state_access
465
466# Filter out all enums from GL_ANGLE_depth_texture
467    grep -v '0x' $1/GL_ANGLE_depth_texture > tmp
468    mv tmp $1/GL_ANGLE_depth_texture
469
470# Filter out GL_NONE enum from GL_ANGLE_depth_texture
471    grep -v 'GL_NONE' $1/GL_ANGLE_texture_usage > tmp
472    mv tmp $1/GL_ANGLE_texture_usage
473
474# Fixup REGAL and ANGLE urls
475
476    for i in $1/GL_REGAL_*; do perl -e 's#http://www.opengl.org/registry/specs/REGAL/.*#https://github.com/p3/regal/tree/master/doc/extensions#g' -pi $i; done
477    for i in $1/GL_ANGLE_*; do perl -e 's#http://www.opengl.org/registry/specs/ANGLE/.*#https://code.google.com/p/angleproject/source/browse/\#git%2Fextensions#g' -pi $i; done
478
479# Filter out GL_NV_blend_equation_advanced_coherent enums and functions
480    head -n4 $1/GL_NV_blend_equation_advanced_coherent > tmp
481    mv tmp $1/GL_NV_blend_equation_advanced_coherent
482
483# Filter out GL_AMD_gpu_shader_int64 enums and functions
484    head -n4 $1/GL_AMD_gpu_shader_int64 > tmp
485    mv tmp $1/GL_AMD_gpu_shader_int64
486
487# Filter out GL_NO_ERROR enum from GL_KHR_robustness
488    grep -v 'GL_NO_ERROR' $1/GL_KHR_robustness > tmp
489    mv tmp $1/GL_KHR_robustness
490
491# Filter out all enums from GL_KHR_blend_equation_advanced_coherent
492    grep -v '0x' $1/GL_KHR_blend_equation_advanced_coherent > tmp
493    mv tmp $1/GL_KHR_blend_equation_advanced_coherent
494
495# Filter out glBlendBarrierKHR enum from GL_KHR_blend_equation_advanced_coherent
496    grep -v 'glBlendBarrierKHR' $1/GL_KHR_blend_equation_advanced_coherent > tmp
497    mv tmp $1/GL_KHR_blend_equation_advanced_coherent
498
499# Filter out GL_NONE enum from GL_KHR_robustness
500    grep -v 'GL_NONE' $1/GL_KHR_context_flush_control > tmp
501    mv tmp $1/GL_KHR_context_flush_control
502
503# Filter out CoverageModulation from NV_framebuffer_mixed_samples
504# Superset of EXT_raster_multisample
505
506    grep -v "CoverageModulation" $1/GL_NV_framebuffer_mixed_samples > tmp
507    mv tmp $1/GL_NV_framebuffer_mixed_samples
508
509# Filter out glRasterSamplesEXT from NV_framebuffer_mixed_samples
510# Superset of EXT_raster_multisample
511
512    grep -v "RasterSamplesEXT" $1/GL_NV_framebuffer_mixed_samples > tmp
513    mv tmp $1/GL_NV_framebuffer_mixed_samples
514
515# Append GLVULKANPROCNV to GL_NV_draw_vulkan_image
516# Probably ought to be explicitly mentioned in the spec language
517
518    cat >> $1/GL_NV_draw_vulkan_image <<EOT
519    typedef void (APIENTRY *GLVULKANPROCNV)(void)
520EOT
521
522# clean up
523    rm -f patterns $1/*.bak
524