Commits

yotis committed 9d3efcf

Fixed issue #8, removed most spec bug workarounds, removed dependend defines

Fixed missing constants from
GL_ARB_internalformat_query2
GL_VERSION_4_0

Removed dependend defines from
GL_ARB_transform_feedback
GL_EXT_framebuffer_blit
GL_EXT_vertex_weighting
GL_NV_texture_shader
GL_ARB_framebuffer_object
GL_VERSION_3_0
GL_VERSION_4_0
GLX_EXT_texture_from_pixmap

Comments (0)

Files changed (10)

generator/parse.py

     re_section_begin = re.compile(r"^(?P<extension>\w+) enum:\w*$")
     re_enum = re.compile(r"^\t(?P<name>\w+)\s+= (?P<value>\w+)")
     re_use = re.compile(r"^\tuse (?P<section>\w+)\s+(?P<name>\w+)")
+    re_hex_or_number = re.compile(r"^(0x[\dA-Fa-f]+|\d+)\w*$")
     
     blocks = {}
     block_list = []
     current_block = ''
+    all_defines = {}
     
     with open(filename) as f_in:
         for line in f_in:
             #4. Check for define line
             m = re_enum.search(line)
             if m:
-                blocks[current_block].defines.append((m.group('name'), m.group('value')))
+                define_name = m.group('name')
+                define_value = m.group('value')
+                blocks[current_block].defines.append((define_name, define_value))
+                if define_name not in all_defines:
+                    all_defines[define_name] = define_value
+                elif all_defines[define_name] != define_value:
+                    print('enumext.spec inconsistency: %s=%s (was %s)' %
+                            (define_name, define_value, all_defines[define_name]))
                 continue
             #5. Check for 'use ...' line
             m = re_use.search(line)
             if m:
                 name = m.group('name')
-                # Handle the spec bugs...
-                if current_block == 'VERSION_4_0':
-                    if name in ('TRANSFORM_FEEDBACK', 'TRANSFORM_FEEDBACK_BUFFER_PAUSED','TRANSFORM_FEEDBACK_BUFFER_ACTIVE','TRANSFORM_FEEDBACK_BINDING'):
-                        blocks[current_block].reuses.append(('ARB_transform_feedback2', name))
-                    elif name in ('MAX_TRANSFORM_FEEDBACK_BUFFERS', 'MAX_VERTEX_STREAMS'):
-                        blocks[current_block].reuses.append(('ARB_transform_feedback3', name))
-                elif current_block == 'ARB_gpu_shader5':
-                    if name == 'MAX_VERTEX_STREAMS':
-                        blocks[current_block].reuses.append(('ARB_transform_feedback3', name))
-                elif current_block == 'ARB_internalformat_query2':
-                    if name == 'RENDERBUFFER':
-                        blocks[current_block].reuses.append(('ARB_framebuffer_object', name))
-                    elif name == 'TEXTURE_CUBE_MAP_ARRAY':
-                        blocks[current_block].reuses.append(('VERSION_4_0', name))
-                # end of spec bug hunting...
-                else:
-                    blocks[current_block].reuses.append((m.group('section'), name))
+                blocks[current_block].reuses.append(name)
         
     print('Found %d blocks' % len(blocks))
 
             else: bf.write('#include "private/%s.h"\n' % include_directory)
             if blocks[block_name].defines or blocks[block_name].reuses:
                 bf.write('\n')
+            # Loop through normal #defines
             for (name, value) in blocks[block_name].defines:
-                # More spec weirdness.. 
-                # (ARB_copy_buffer - GL_VERSION_3_1)
-                if name == 'COPY_READ_BUFFER': value = '0x8F36'
-                if name == 'COPY_WRITE_BUFFER': value = '0x8F37'
-                # GL_ARB_shader_storage_buffer_object
-                if name == 'MAX_COMBINED_SHADER_OUTPUT_RESOURCES': value = '0x8F39' 
-                # ...
-                bf.write('#define %s%s %s\n' % (prefix, name, value))
-            for (section, name) in blocks[block_name].reuses:
+                the_value = value
+                defines_key = value
+                while not re_hex_or_number.match(the_value):
+                    if value.startswith('GL_'): defines_key = value[3:]
+                    elif value.startswith('GLX_'): defines_key = value[4:]
+                    if defines_key in all_defines:
+                        the_value = all_defines[defines_key]
+                    else:
+                        print ('Error, cannot find define %s in %s' % (name, block_name))
+                        break
+                    defines_key = the_value
+                bf.write('#define %s%s %s\n' % (prefix, name, the_value))
+            # Loop through reuses
+            for name in blocks[block_name].reuses:
                 the_value = ''
-                the_section = ''
-                if section in ('BlendingFactorDest', 'DrawBufferMode', 'GetPName', 'TextureGenParameter', 'ErrorCode'): the_section = 'VERSION_1_1'
-                else: the_section = section
-                for (d_name, value) in blocks[the_section].defines:
-                    if d_name == name: the_value = value
-                if not the_value and blocks.has_key(the_section + '_DEPRECATED'):
-                    for (d_name, value) in blocks[the_section + '_DEPRECATED'].defines:
-                        if d_name == name: the_value = value             
-                # More spec weirdness.. 
-                # (ARB_copy_buffer - GL_VERSION_3_1)
-                if name == 'COPY_READ_BUFFER': the_value = '0x8F36'
-                if name == 'COPY_WRITE_BUFFER': the_value = '0x8F37'
-                # GL_VERSION_4_3
-                if name == 'MAX_COMBINED_SHADER_OUTPUT_RESOURCES': the_value = '0x8F39'
-                # ...
-                if not the_value: print('SPEC Bug??: %s:%s-%s' % (block_name, the_section, name))
+                defines_key = name
+                while not re_hex_or_number.match(the_value):
+                    if defines_key.startswith('GL_'): defines_key = defines_key[3:]
+                    elif defines_key.startswith('GLX_'): defines_key = defines_key[4:]
+                    if defines_key in all_defines:
+                        the_value = all_defines[defines_key]
+                    else:
+                        print('Error! Cannot find reuse %s in %s' % (name, block_name))
+                        break
+                    defines_key = the_value
                 bf.write('#define %s%s %s\n' % (prefix, name, the_value))
 
     blocks_dict_filename = '%s.pkl' % include_directory

include/glXxx/glx_ext_texture_from_pixmap.h

 #define GLX_FRONT_RIGHT_EXT 0x20DF
 #define GLX_BACK_LEFT_EXT 0x20E0
 #define GLX_BACK_RIGHT_EXT 0x20E1
-#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT
-#define GLX_BACK_EXT GLX_BACK_LEFT_EXT
+#define GLX_FRONT_EXT 0x20DE
+#define GLX_BACK_EXT 0x20E0
 #define GLX_AUX0_EXT 0x20E2
 #define GLX_AUX1_EXT 0x20E3
 #define GLX_AUX2_EXT 0x20E4

include/glxx/gl_arb_internalformat_query2.h

 #define GL_VIEW_CLASS_RGTC2_RG 0x82D1
 #define GL_VIEW_CLASS_BPTC_UNORM 0x82D2
 #define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_NUM_SAMPLE_COUNTS 0x9380
 #define GL_RENDERBUFFER 0x8D41
+#define GL_SAMPLES 0x80A9
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_1D_ARRAY 0x8C18
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_TEXTURE_3D 0x806F
+#define GL_TEXTURE_CUBE_MAP 0x8513
 #define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_TEXTURE_COMPRESSED 0x86A1
 
 namespace gl_arb_internalformat_query2
 {

include/glxx/gl_arb_transform_feedback2.h

 
 #define GL_TRANSFORM_FEEDBACK 0x8E22
 #define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED GL_TRANSFORM_FEEDBACK_PAUSED
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
 #define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE GL_TRANSFORM_FEEDBACK_ACTIVE
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
 #define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
 
 namespace gl_arb_transform_feedback2

include/glxx/gl_ext_framebuffer_blit.h

 
 #define GL_READ_FRAMEBUFFER_EXT 0x8CA8
 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT
+#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
 #define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
 
 namespace gl_ext_framebuffer_blit

include/glxx/gl_ext_vertex_weighting.h

 
 #include "private/glxx.h"
 
-#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH
+#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3
 #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502
-#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX
+#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6
 #define GL_MODELVIEW1_MATRIX_EXT 0x8506
 #define GL_VERTEX_WEIGHTING_EXT 0x8509
-#define GL_MODELVIEW0_EXT GL_MODELVIEW
+#define GL_MODELVIEW0_EXT 0x1700
 #define GL_MODELVIEW1_EXT 0x850A
 #define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B
 #define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C

include/glxx/gl_nv_texture_shader.h

 #define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
 #define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
 #define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
-#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV
-#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV
-#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV
+#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1
+#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2
+#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3
 #define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
 #define GL_CONST_EYE_NV 0x86E5
 #define GL_PASS_THROUGH_NV 0x86E6

include/glxx/private/gl_arb_framebuffer_object.h

 #define GL_TEXTURE_DEPTH_TYPE 0x8C16
 #define GL_UNSIGNED_NORMALIZED 0x8C17
 #define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
 #define GL_RENDERBUFFER_BINDING 0x8CA7
 #define GL_READ_FRAMEBUFFER 0x8CA8
 #define GL_DRAW_FRAMEBUFFER 0x8CA9

include/glxx/private/gl_version_3_0.h

 #define GL_TEXTURE_DEPTH_TYPE 0x8C16
 #define GL_UNSIGNED_NORMALIZED 0x8C17
 #define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
 #define GL_RENDERBUFFER_BINDING 0x8CA7
 #define GL_READ_FRAMEBUFFER 0x8CA8
 #define GL_DRAW_FRAMEBUFFER 0x8CA9

include/glxx/private/gl_version_4_0.h

 #define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
 #define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
 #define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
 #define GL_MAX_VERTEX_STREAMS 0x8E71
+#define GL_DOUBLE_VEC2 0x8FFC
+#define GL_DOUBLE_VEC3 0x8FFD
+#define GL_DOUBLE_VEC4 0x8FFE
+#define GL_DOUBLE_MAT2 0x8F46
+#define GL_DOUBLE_MAT3 0x8F47
+#define GL_DOUBLE_MAT4 0x8F48
+#define GL_DOUBLE_MAT2x3 0x8F49
+#define GL_DOUBLE_MAT2x4 0x8F4A
+#define GL_DOUBLE_MAT3x2 0x8F4B
+#define GL_DOUBLE_MAT3x4 0x8F4C
+#define GL_DOUBLE_MAT4x2 0x8F4D
+#define GL_DOUBLE_MAT4x3 0x8F4E
+#define GL_ACTIVE_SUBROUTINES 0x8DE5
+#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
+#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
+#define GL_MAX_SUBROUTINES 0x8DE7
+#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
+#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
+#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
+#define GL_PATCHES 0x000E
+#define GL_PATCH_VERTICES 0x8E72
+#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
+#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
+#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
+#define GL_TESS_GEN_MODE 0x8E76
+#define GL_TESS_GEN_SPACING 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
+#define GL_TESS_GEN_POINT_MODE 0x8E79
+#define GL_ISOLINES 0x8E7A
+#define GL_FRACTIONAL_ODD 0x8E7B
+#define GL_FRACTIONAL_EVEN 0x8E7C
+#define GL_MAX_PATCH_VERTICES 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
+#define GL_TESS_EVALUATION_SHADER 0x8E87
+#define GL_TESS_CONTROL_SHADER 0x8E88
 #define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED GL_TRANSFORM_FEEDBACK_PAUSED
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE GL_TRANSFORM_FEEDBACK_ACTIVE
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
 #define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
 #define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
 #define GL_MAX_VERTEX_STREAMS 0x8E71
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.