From b015ee91380afcde026b101a9598a50e82827938 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 6 Nov 2016 01:28:58 +0200 Subject: [PATCH] Be smarter when detecting the core version of extensions --- extensions/arb_fragment_shader.glext | 1 - extensions/arb_pixel_buffer_object.glext | 1 - extensions/arb_texture_cube_map.glext | 1 - extensions/arb_texture_float.glext | 1 - extensions/arb_texture_rg.glext | 1 - extensions/arb_uniform_buffer_object.glext | 1 - extensions/ext_bgra.glext | 1 - extensions/ext_blend_subtract.glext | 1 - extensions/msp_texture1d.glext | 1 + scripts/extgen.py | 16 ++++++++++++++-- 10 files changed, 15 insertions(+), 10 deletions(-) diff --git a/extensions/arb_fragment_shader.glext b/extensions/arb_fragment_shader.glext index 30961f56..e632db21 100644 --- a/extensions/arb_fragment_shader.glext +++ b/extensions/arb_fragment_shader.glext @@ -1,2 +1 @@ extension ARB_fragment_shader -core_version gl 2.0 diff --git a/extensions/arb_pixel_buffer_object.glext b/extensions/arb_pixel_buffer_object.glext index b36e7f12..eb267ebc 100644 --- a/extensions/arb_pixel_buffer_object.glext +++ b/extensions/arb_pixel_buffer_object.glext @@ -1,2 +1 @@ extension ARB_pixel_buffer_object -core_version gl 2.1 diff --git a/extensions/arb_texture_cube_map.glext b/extensions/arb_texture_cube_map.glext index 3dd14981..892b8393 100644 --- a/extensions/arb_texture_cube_map.glext +++ b/extensions/arb_texture_cube_map.glext @@ -1,3 +1,2 @@ extension ARB_texture_cube_map -core_version gl 1.3 backport none diff --git a/extensions/arb_texture_float.glext b/extensions/arb_texture_float.glext index 55aa32d1..4eea1fc1 100644 --- a/extensions/arb_texture_float.glext +++ b/extensions/arb_texture_float.glext @@ -1,3 +1,2 @@ extension ARB_texture_float -core_version gl 3.0 backport none diff --git a/extensions/arb_texture_rg.glext b/extensions/arb_texture_rg.glext index 567cea12..68495ec2 100644 --- a/extensions/arb_texture_rg.glext +++ b/extensions/arb_texture_rg.glext @@ -1,2 +1 @@ extension ARB_texture_rg -core_version gl 3.0 diff --git a/extensions/arb_uniform_buffer_object.glext b/extensions/arb_uniform_buffer_object.glext index 8e0e9310..1ceadce7 100644 --- a/extensions/arb_uniform_buffer_object.glext +++ b/extensions/arb_uniform_buffer_object.glext @@ -1,2 +1 @@ extension ARB_uniform_buffer_object -core_version gl 3.0 diff --git a/extensions/ext_bgra.glext b/extensions/ext_bgra.glext index d8522175..bda98696 100644 --- a/extensions/ext_bgra.glext +++ b/extensions/ext_bgra.glext @@ -1,3 +1,2 @@ extension EXT_bgra -core_version gl 1.2 backport none diff --git a/extensions/ext_blend_subtract.glext b/extensions/ext_blend_subtract.glext index cbd8b416..e8af79ad 100644 --- a/extensions/ext_blend_subtract.glext +++ b/extensions/ext_blend_subtract.glext @@ -1,3 +1,2 @@ extension EXT_blend_subtract -core_version gl 1.2 backport none diff --git a/extensions/msp_texture1d.glext b/extensions/msp_texture1d.glext index 00cd9120..fd77cdc9 100644 --- a/extensions/msp_texture1d.glext +++ b/extensions/msp_texture1d.glext @@ -1 +1,2 @@ extension MSP_texture1D +core_version gl 1.1 diff --git a/scripts/extgen.py b/scripts/extgen.py index 45094a4d..7526b271 100755 --- a/scripts/extgen.py +++ b/scripts/extgen.py @@ -325,18 +325,30 @@ enums = filter(is_relevant, enums) enums.sort(key=(lambda e: e.value)) # Some final preparations for creating the files +core_version_candidates = {} backport_ext_candidates = [] for t in itertools.chain(funcs, enums): if target_api in t.supported_apis and t.supported_apis[target_api]!="ext": t.version = t.supported_apis[target_api] - if not core_version: - core_version = t.version + if t.version: + ver_tuple = tuple(t.version) + core_version_candidates[ver_tuple] = core_version_candidates.get(ver_tuple, 0)+1 # Things in backport extensions don't acquire an extension suffix if t.extension and not t.name.endswith(ext_type) and target_api in t.supported_apis: if t.extension not in backport_ext_candidates: backport_ext_candidates.append(t.extension) +if not core_version and core_version_candidates: + core_version_candidates = list((v, k) for k, v in core_version_candidates.items()) + if len(core_version_candidates)>1: + core_version_candidates.sort(reverse=True) + if core_version_candidates[1][0]+1>=core_version_candidates[0][0]: + ver0 = core_version_candidates[0][1] + ver1 = core_version_candidates[1][1] + print "Warning: multiple likely core version candidates: %d.%d %d.%d"%(ver0[0], ver0[1], ver1[0], ver1[1]) + core_version = core_version_candidates[0][1] + if backport_ext: if backport_ext=="none": backport_ext = None -- 2.45.2