5 my %gl_define_list_one;
6 my %gl_define_list_two;
14 "GL_INVALID_OPERATION",
23 my @match_one_way_list =
25 "RELATIVE_VERTICAL_LINE_TO_NV\$",
26 "RELATIVE_CUBIC_CURVE_TO_NV\$",
27 "RELATIVE_QUADRATIC_CURVE_TO_NV\$",
29 "VERTICAL_LINE_TO_NV\$",
30 "CUBIC_CURVE_TO_NV\$",
31 "QUADRATIC_CURVE_TO_NV\$",
33 "SMOOTH_QUADRATIC_CURVE_TO_NV\$",
35 "CURRENT_OCCLUSION_QUERY_ID_NV\$",
37 "UNSIGNED_INT64_NV\$",
40 "PROGRAM_ERROR_STRING_NV\$",
42 "PIXEL_COUNT_AVAILABLE_NV\$",
45 "PROGRAM_ERROR_POSITION_NV\$",
47 "CURRENT_MATRIX_STACK_DEPTH_NV\$",
48 "CURRENT_MATRIX_NV\$",
49 "MAX_TRACK_MATRICES_NV\$",
50 "MAX_TRACK_MATRIX_STACK_DEPTH_NV\$",
52 "PIXEL_COUNTER_BITS_NV\$",
54 "OFFSET_TEXTURE_2D_MATRIX_NV\$",
55 "OFFSET_TEXTURE_2D_BIAS_NV\$",
57 "VERTEX_PROGRAM_NV\$",
58 "PROGRAM_STRING_NV\$",
59 "PROGRAM_LENGTH_NV\$",
61 "VERTEX_PROGRAM_POINT_SIZE_NV\$",
63 "OFFSET_TEXTURE_2D_SCALE_NV\$",
65 "RENDERBUFFER_COVERAGE_SAMPLES_NV\$",
67 "MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV\$",
69 "MAP2_VERTEX_ATTRIB7_4_NV\$",
71 "CURRENT_ATTRIB_NV\$",
73 "ATTRIB_ARRAY_POINTER_NV\$",
74 "ATTRIB_ARRAY_STRIDE_NV\$",
75 "ATTRIB_ARRAY_TYPE_NV\$",
76 "ATTRIB_ARRAY_SIZE_NV\$",
78 "TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV\$",
79 "TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV\$",
81 "FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV\$",
85 "ALPHA_FLOAT16_ATI\$",
86 "ALPHA_FLOAT32_ATI\$",
88 "INTENSITY_FLOAT16_ATI\$",
89 "INTENSITY_FLOAT32_ATI\$",
91 "LUMINANCE_FLOAT16_ATI\$",
92 "LUMINANCE_FLOAT32_ATI\$",
94 "LUMINANCE_ALPHA_FLOAT16_ATI\$",
95 "LUMINANCE_ALPHA_FLOAT32_ATI\$",
100 "RGBA_FLOAT16_ATI\$",
101 "RGBA_FLOAT32_ATI\$",
103 "RGBA_FLOAT_MODE_ATI\$",
104 "MIRROR_CLAMP_ATI\$",
105 "SATURATE_BIT_ATI\$",
107 "OBJECT_BUFFER_SIZE_ATI\$",
108 "OBJECT_BUFFER_USAGE_ATI\$",
113 "VIRTUAL_PAGE_SIZE_X_AMD\$",
114 "VIRTUAL_PAGE_SIZE_Y_AMD\$",
115 "VIRTUAL_PAGE_SIZE_Z_AMD\$",
117 "MIN_SPARSE_LEVEL_AMD\$",
118 "MAX_SPARSE_TEXTURE_SIZE_AMD\$",
119 "MAX_SPARSE_3D_TEXTURE_SIZE_AMD\$",
121 "DEBUG_SEVERITY_HIGH_AMD\$",
122 "DEBUG_SEVERITY_LOW_AMD\$",
123 "DEBUG_SEVERITY_MEDIUM_AMD\$",
124 "DEBUG_LOGGED_MESSAGES_AMD\$",
125 "MAX_DEBUG_LOGGED_MESSAGES_AMD\$",
126 "MAX_DEBUG_MESSAGE_LENGTH_AMD\$",
128 "QUERY_OBJECT_AMD\$",
129 "QUERY_BUFFER_AMD\$",
130 "QUERY_BUFFER_BINDING_AMD\$",
131 "QUERY_RESULT_NO_WAIT_AMD\$",
133 "VERTEX_ARRAY_OBJECT_AMD\$",
136 "MAX_COMPUTE_FIXED_GROUP_SIZE_ARB\$",
137 "MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB\$",
139 "MAX_VARYING_FLOATS_ARB\$",
143 "OBJECT_DELETE_STATUS_ARB\$",
144 "OBJECT_ATTACHED_OBJECTS_ARB\$",
145 "OBJECT_ACTIVE_ATTRIBUTES_ARB\$",
146 "OBJECT_LINK_STATUS_ARB\$",
147 "OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB\$",
148 "OBJECT_INFO_LOG_LENGTH_ARB\$",
149 "OBJECT_SUBTYPE_ARB\$",
150 "OBJECT_SHADER_SOURCE_LENGTH_ARB\$",
151 "OBJECT_VALIDATE_STATUS_ARB\$",
152 "OBJECT_COMPILE_STATUS_ARB\$",
153 "OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB\$",
154 "OBJECT_ACTIVE_UNIFORMS_ARB\$",
156 "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB\$",
159 "SOURCE0_ALPHA_ARB\$",
161 "SOURCE1_ALPHA_ARB\$",
163 "SOURCE2_ALPHA_ARB\$",
165 "VERTEX_PROGRAM_POINT_SIZE_ARB\$",
169 "TEXTURE_1D_BINDING_EXT\$",
170 "TEXTURE_2D_BINDING_EXT\$",
171 "TEXTURE_3D_BINDING_EXT\$",
173 "FRAMEBUFFER_BINDING_EXT\$",
175 "TEXTURE_BUFFER_FORMAT_EXT\$",
177 "MAX_VERTEX_VARYING_COMPONENTS_EXT\$",
178 "MAX_GEOMETRY_VARYING_COMPONENTS_EXT\$",
179 "MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT\$",
181 "FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT\$",
183 "MODELVIEW0_MATRIX_EXT\$",
186 "MODELVIEW0_STACK_DEPTH_EXT\$",
188 "PROGRAM_OBJECT_EXT\$",
189 "SHADER_OBJECT_EXT\$",
191 "COMPARE_REF_DEPTH_TO_TEXTURE_EXT\$",
193 "COMPRESSED_RED_GREEN_RGTC2_EXT\$",
194 "COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT\$",
196 "FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT\$",
198 "POLYGON_OFFSET_EXT\$",
199 "DISTANCE_ATTENUATION_EXT\$",
200 "BLEND_EQUATION_EXT\$",
202 "SAMPLE_MASK_INVERT_EXT\$",
203 "SAMPLE_ALPHA_TO_MASK_EXT\$",
204 "SAMPLE_ALPHA_TO_ONE_EXT\$",
206 "FOG_COORDINATE_ARRAY_EXT\$",
207 "FOG_COORDINATE_ARRAY_POINTER_EXT\$",
208 "FOG_COORDINATE_ARRAY_STRIDE_EXT\$",
209 "FOG_COORDINATE_ARRAY_TYPE_EXT\$",
210 "FOG_COORDINATE_SOURCE_EXT\$",
211 "FOG_COORDINATE_EXT\$",
212 "CURRENT_FOG_COORDINATE_EXT\$",
214 "SOURCE0_ALPHA_EXT\$",
216 "SOURCE1_ALPHA_EXT\$",
218 "SOURCE2_ALPHA_EXT\$",
221 "LAYOUT_DEFAULT_INTEL\$",
224 "UNSIGNED_SHORT_8_8_APPLE\$",
225 "UNSIGNED_SHORT_8_8_REV_APPLE\$",
228 "ALPHA_FLOAT16_APPLE\$",
229 "ALPHA_FLOAT32_APPLE\$",
231 "INTENSITY_FLOAT16_APPLE\$",
232 "INTENSITY_FLOAT32_APPLE\$",
234 "LUMINANCE_FLOAT16_APPLE\$",
235 "LUMINANCE_FLOAT32_APPLE\$",
237 "LUMINANCE_ALPHA_FLOAT16_APPLE\$",
238 "LUMINANCE_ALPHA_FLOAT32_APPLE\$",
240 "RGB_FLOAT16_APPLE\$",
241 "RGB_FLOAT32_APPLE\$",
243 "RGBA_FLOAT16_APPLE\$",
244 "RGBA_FLOAT32_APPLE\$",
246 "VERTEX_ARRAY_BINDING_APPLE\$",
247 "VERTEX_ARRAY_RANGE_APPLE\$",
248 "VERTEX_ARRAY_RANGE_LENGTH_APPLE\$",
249 "VERTEX_ARRAY_RANGE_POINTER_APPLE\$",
250 "VERTEX_ARRAY_STORAGE_HINT_APPLE\$",
263 "SAMPLE_PATTERN_SGIS\$",
264 "SAMPLE_MASK_INVERT_SGIS\$",
265 "SAMPLE_ALPHA_TO_MASK_SGIS\$",
266 "SAMPLE_ALPHA_TO_ONE_SGIS\$",
268 "SHADOW_AMBIENT_SGIX\$",
269 "DISTANCE_ATTENUATION_SGIS\$",
273 "REPLACE_OLDEST_SUN\$",
278 "IMPLEMENTATION_COLOR_READ_TYPE_OES\$",
279 "IMPLEMENTATION_COLOR_READ_FORMAT_OES\$",
283 "TEXTURE_COMPONENTS\$",
286 "COMPARE_REF_TO_TEXTURE\$",
295 "MAX_CLIP_DISTANCES\$",
297 "TRANSFORM_FEEDBACK_BUFFER_ACTIVE\$",
298 "TRANSFORM_FEEDBACK_BUFFER_PAUSED\$",
300 "MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS\$",
301 "MAX_VARYING_FLOATS\$",
303 "VERTEX_PROGRAM_POINT_SIZE\$",
304 "POINT_SIZE_GRANULARITY\$",
305 "POINT_SIZE_RANGE\$",
307 "LINE_WIDTH_RANGE\$",
308 "LINE_WIDTH_GRANULARITY\$",
318 "FOG_COORDINATE_ARRAY\$",
319 "FOG_COORDINATE_ARRAY_STRIDE\$",
320 "FOG_COORDINATE_ARRAY_BUFFER_BINDING\$",
321 "FOG_COORDINATE_ARRAY_POINTER\$",
322 "FOG_COORDINATE_ARRAY_TYPE\$",
323 "FOG_COORDINATE_SOURCE\$",
325 "CURRENT_FOG_COORDINATE\$",
327 "COPY_READ_BUFFER\$",
328 "COPY_WRITE_BUFFER\$",
329 "FRAMEBUFFER_BINDING\$",
330 "TEXTURE_BUFFER_BINDING\$",
345 "CLIENT_PIXEL_STORE_BIT\$",
346 "VERTEX_ATTRIB_ARRAY_BARRIER_BIT\$",
347 "SYNC_FLUSH_COMMANDS_BIT\$",
348 "VERTEX_SHADER_BIT\$",
351 "CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT\$",
352 "CONTEXT_CORE_PROFILE_BIT\$",
356 "VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT\$",
361 "TEXTURE_STORAGE_SPARSE_BIT_AMD\$",
364 "GLYPH_WIDTH_BIT_NV\$",
366 "TEXTURE_DEFORMATION_BIT_SGIX\$",
370 "LAYOUT_LINEAR_INTEL\$",
375 "FRAGMENT_SHADER_BIT\$",
378 "CONTEXT_COMPATIBILITY_PROFILE_BIT\$",
379 "CONTEXT_FLAG_DEBUG_BIT\$",
380 "ELEMENT_ARRAY_BARRIER_BIT\$",
381 "CLIENT_VERTEX_ARRAY_BIT\$",
383 "ELEMENT_ARRAY_BARRIER_BIT_EXT\$",
391 "GLYPH_HEIGHT_BIT_NV\$",
393 "GEOMETRY_DEFORMATION_BIT_SGIX\$",
395 "REPLACE_MIDDLE_SUN\$",
397 "LAYOUT_LINEAR_CPU_CACHED_INTEL\$",
402 "RELATIVE_MOVE_TO_NV\$",
407 "MAP_INVALIDATE_RANGE_BIT\$",
408 "GEOMETRY_SHADER_BIT\$",
409 "UNIFORM_BARRIER_BIT\$",
411 "CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB\$",
413 "UNIFORM_BARRIER_BIT_EXT\$",
419 "GLYPH_HORIZONTAL_BEARING_X_BIT_NV\$",
422 "VERTEX23_BIT_PGI\$",
427 "RELATIVE_LINE_TO_NV\$",
431 "HORIZONTAL_LINE_TO_NV\$",
435 "RELATIVE_HORIZONTAL_LINE_TO_NV\$",
439 "MAP_INVALIDATE_BUFFER_BIT\$",
440 "TEXTURE_FETCH_BARRIER_BIT\$",
441 "TESS_CONTROL_SHADER_BIT\$",
444 "TEXTURE_FETCH_BARRIER_BIT_EXT\$",
449 "GLYPH_HORIZONTAL_BEARING_Y_BIT_NV\$",
453 # 10 TESS_EVALUATION_SHADER_BIT\$",
455 "POLYGON_STIPPLE_BIT\$",
456 "MAP_FLUSH_EXPLICIT_BIT\$",
458 "GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV\$",
459 "SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV\$",
464 # 20 COMPUTE_SHADER_BIT
467 "SHADER_IMAGE_ACCESS_BARRIER_BIT\$",
468 "MAP_UNSYNCHRONIZED_BIT\$",
470 "SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT\$",
474 "GLYPH_VERTICAL_BEARING_X_BIT_NV\$",
479 "COMMAND_BARRIER_BIT\$",
480 "MAP_PERSISTENT_BIT\$",
482 "COMMAND_BARRIER_BIT_EXT\$",
484 "GLYPH_VERTICAL_BEARING_Y_BIT_NV\$",
486 # 80 PIXEL_BUFFER_BARRIER_BIT
489 "MAP_COHERENT_BIT\$",
491 "GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV\$",
496 "DEPTH_BUFFER_BIT\$",
497 "TEXTURE_UPDATE_BARRIER_BIT\$",
498 "DYNAMIC_STORAGE_BIT\$",
500 "TEXTURE_UPDATE_BARRIER_BIT_EXT\$",
502 "GLYPH_HAS_KERNING_BIT_NV\$",
507 "CLIENT_STORAGE_BIT\$",
508 "BUFFER_UPDATE_BARRIER_BIT\$",
509 "ACCUM_BUFFER_BIT\$",
511 "BUFFER_UPDATE_BARRIER_BIT_EXT\$",
517 "STENCIL_BUFFER_BIT\$",
518 "FRAMEBUFFER_BARRIER_BIT\$",
520 "FRAMEBUFFER_BARRIER_BIT_EXT\$",
526 "TRANSFORM_FEEDBACK_BARRIER_BIT\$",
528 "TRANSFORM_FEEDBACK_BARRIER_BIT_EXT\$",
534 "ATOMIC_COUNTER_BARRIER_BIT\$",
537 "ATOMIC_COUNTER_BARRIER_BIT_EXT\$",
543 "SHADER_STORAGE_BARRIER_BIT\$",
548 "CLIENT_MAPPED_BUFFER_BARRIER_BIT\$",
549 "COLOR_BUFFER_BIT\$",
554 "QUERY_BUFFER_BARRIER_BIT\$",
558 "FONT_X_MIN_BOUNDS_BIT_NV\$",
563 "FONT_Y_MIN_BOUNDS_BIT_NV\$",
568 "FONT_X_MAX_BOUNDS_BIT_NV\$",
569 "EDGEFLAG_BIT_PGI\$",
573 "FONT_Y_MAX_BOUNDS_BIT_NV\$",
576 # 100000 FONT_UNITS_PER_EM_BIT_NV
578 "MAT_AMBIENT_BIT_PGI\$",
580 # 200000 FONT_ASCENDER_BIT_NV
582 "MAT_AMBIENT_AND_DIFFUSE_BIT_PGI\$",
584 # 400000 FONT_DESCENDER_BIT_NV
586 "MAT_DIFFUSE_BIT_PGI\$",
588 # 800000 FONT_HEIGHT_BIT_NV
590 "MAT_EMISSION_BIT_PGI\$",
592 # 1000000 FONT_MAX_ADVANCE_WIDTH_BIT_NV
594 "MAT_COLOR_INDEXES_BIT_PGI\$",
596 # 2000000 FONT_MAX_ADVANCE_HEIGHT_BIT_NV
598 "MAT_SHININESS_BIT_PGI\$",
600 # 4000000 FONT_UNDERLINE_POSITION_BIT_NV
602 "MAT_SPECULAR_BIT_PGI\$",
604 # 8000000 FONT_UNDERLINE_THICKNESS_BIT_NV
608 # 10000000 FONT_HAS_KERNING_BIT_NV
610 "TEXCOORD1_BIT_PGI\$",
612 # 20000000 MULTISAMPLE_BIT
614 "MULTISAMPLE_BIT_3DFX\$",
615 "TEXCOORD2_BIT_PGI\$",
617 # ffffffff ALL_ATTRIB_BITS
621 "ALL_BARRIER_BITS\$",
622 "CLIENT_ALL_ATTRIB_BITS\$",
624 "ALL_BARRIER_BITS_EXT\$"
645 FOUND
: foreach my $p (@exclude_list)
656 # print "excluded : $d\n";
667 FOUND
: foreach my $p (@match_one_way_list)
684 if(define_excluded
($d) == 1)
687 elsif(define_one_way
($d) == 1)
689 if(exists $gl_define_list_one{$d})
691 # print "$d already there\n";
695 $gl_define_list_one{$d} = $v;
697 # push @gl_define_list_one, $d
701 if(exists $gl_define_list_two{$d})
703 # print "$d already there\n";
707 $gl_define_list_two{$d} = $v;
709 # push @gl_define_list_two, $d
717 open(IN
, "grep #define $f |");
721 if($_ =~ m/(#define)[ \t]+(GL_[A-Z0-9_x]+)[ \t]+([0-9A-Fx]+)/)
723 process_define
($2, $3);
725 elsif($_ =~ m/(#define)[ \t]+(GL_[A-Z0-9_x]+)[ \t]+(GL_[A-Z0-9_]+)/)
727 process_define
($2, $3);
731 # print "Unknown $f $_";
738 processFile
("/usr/include/GL.bugle/gl.h");
739 processFile
("/usr/include/GL.bugle/glext.h");
745 foreach my $define (keys %gl_define_list_two)
747 if($gl_define_list_two{$define} =~ m/^GL_/)
749 my $v = $gl_define_list_two{$define};
751 if(exists $gl_define_list_two{$v})
753 $gl_define_list_two{$define} = $gl_define_list_two{$v};
756 FINALEXT
: foreach my $ext (@overload_ext)
758 if($define =~ m/$ext/)
763 if(exists $gl_define_list_two{$d})
765 # print "$define | $d\n";
767 $gl_define_list_one{$define} = $gl_define_list_two{$define};
769 push @delete_from_two, $define
775 # print "$define : $gl_define_list_two{$define}\n";
778 foreach my $key (@delete_from_two)
780 # print "del : $key\n";
782 delete($gl_define_list_two{$key});
785 my @k = (keys %gl_define_list_two);
789 #print "\nONE WAY \n";
791 @k = (keys %gl_define_list_one);
795 #foreach my $define (keys %gl_define_list_one)
797 # print "$define : $gl_define_list_one{$define}\n";
800 open(OUT
, "> Source/Base/Base/OSGGLDefineMapper_auto.cpp");
802 print OUT
"//#################################################\n";
803 print OUT
"// auto generated use \n";
804 print OUT
"// Tools/glEnumMapper/createGLEnumMaps.pl to rebuild\n";
805 print OUT
"//#################################################\n\n\n";
807 print OUT
"#include \"OSGGLDefineMapper.h\"\n\n\n";
808 print OUT
"OSG_BEGIN_NAMESPACE\n\n";
811 my $defsperfunc = 100;
812 my $currentdef = $defsperfunc;
814 print OUT
"#ifdef OSG_GL_DEFMAPPER\n\n";
815 print OUT
"// Break up long function into pieces to relieve compiler optimizer\n\n";
816 print OUT
"static void initMapsHelper_0(GLDefineMapperBase* mapper)\n";
820 foreach my $define (keys %gl_define_list_two)
825 print OUT
"static void initMapsHelper_$nfuncs(GLDefineMapperBase* mapper)\n";
827 $currentdef = $defsperfunc;
836 print OUT
" mapper->addToEnumPair (\"$d\", $gl_define_list_two{$define});\n";
837 print OUT
" mapper->addFromEnumPair($gl_define_list_two{$define}, \"$d\");\n";
842 foreach my $define (keys %gl_define_list_one)
847 print OUT
"static void initMapsHelper_$nfuncs(GLDefineMapperBase* mapper)\n";
849 $currentdef = $defsperfunc;
858 print OUT
" mapper->addToEnumPair (\"$d\", $gl_define_list_one{$define});\n";
862 print OUT
"#endif\n\n";
865 print OUT
"void GLDefineMapperBase::initMaps(void)\n";
867 print OUT
"#ifdef OSG_GL_DEFMAPPER\n";
869 for (my $c = 0; $c < $nfuncs; $c++)
871 print OUT
" initMapsHelper_$c(this);\n";
874 print OUT
"#endif\n";
876 print OUT
"OSG_END_NAMESPACE\n\n";