Add deleters to functions that exist both in core and extensions.

Parts of later GL versions are often published as extension too, so
these functions may be queried twice.
This commit is contained in:
Matthias Bentrup 2015-02-07 10:01:01 +01:00 committed by Nigel Stewart
parent 951cdeba89
commit 0c1a32c5e4
3 changed files with 30 additions and 5 deletions

View File

@ -113,7 +113,7 @@ $(EXT)/.dummy: $(REGISTRY)/.dummy
@echo "Creating descriptors" @echo "Creating descriptors"
@echo "--------------------------------------------------------------------" @echo "--------------------------------------------------------------------"
rm -rf $(EXT) rm -rf $(EXT)
$(BIN)/update_ext.sh $(EXT) $(REGISTRY) $(BLACKLIST) $(BIN)/update_ext.sh $(EXT) $(REGISTRY) $(BLACKLIST) $(CORE)
$(BIN)/$(FILTER) $(EXT) $(BIN)/$(FILTER) $(EXT)
ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin) ifeq ($(patsubst Darwin%,Darwin,$(SYSTEM)), Darwin)
find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \ find $(CORE) -maxdepth 1 -type f | grep -v VERSION | grep -v "~" | \
@ -199,8 +199,7 @@ $(S.DEST)/glew.c: $(EXT)/.dummy $(SRC)/glew_init_hash.c
cp -f $(SRC)/glew_license.h $@ cp -f $(SRC)/glew_license.h $@
cat $(SRC)/glew_head.c >> $@ cat $(SRC)/glew_head.c >> $@
echo -e "\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@ echo -e "\n#if !defined(_WIN32) || !defined(GLEW_MX)" >> $@
$(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) >> $@ $(BIN)/make_def_fun.pl GL $(GL_CORE_SPEC) $(GL_EXT_SPEC) >> $@
$(BIN)/make_def_fun.pl GL $(GL_EXT_SPEC) >> $@
echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@ echo -e "\n#endif /* !WIN32 || !GLEW_MX */" >> $@
echo -e "\n#if !defined(GLEW_MX)" >> $@; echo -e "\n#if !defined(GLEW_MX)" >> $@;
echo -e "\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@ echo -e "\nGLboolean __GLEW_VERSION_1_1 = GL_FALSE;" >> $@

View File

@ -307,8 +307,10 @@ sub parse_spec($)
my @speclist = (); my @speclist = ();
my %extensions = (); my %extensions = ();
my %fcn_in_core = ();
my $ext_dir = shift; my $ext_dir = shift;
my $core_dir = shift;
my $reg_http = "http://www.opengl.org/registry/specs/"; my $reg_http = "http://www.opengl.org/registry/specs/";
# Take command line arguments or read list from file # Take command line arguments or read list from file
@ -320,6 +322,24 @@ if (@ARGV)
@speclist = split "\n", (<>); @speclist = split "\n", (<>);
} }
# Get functions moved to the GL core
my %core_fnc = ();
foreach my $spec (<$core_dir/GL_VERSION_*>)
{
my $vsn = $spec;
$vsn =~ s/.*\/GL_VERSION_(\d+)_(\d+)/$1.$2/;
open SPEC, "<$spec";
while (<SPEC>)
{
if ($_ =~ qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)\s*(~.*)?$/i )
{
$core_fnc{$2} = $vsn;
}
}
close SPEC;
}
foreach my $spec (sort @speclist) foreach my $spec (sort @speclist)
{ {
my ($extname, $extnames, $tokens, $functions) = parse_spec($spec); my ($extname, $extnames, $tokens, $functions) = parse_spec($spec);
@ -371,7 +391,13 @@ foreach my $spec (sort @speclist)
{ {
if ($function =~ /^$prefix.*/i) if ($function =~ /^$prefix.*/i)
{ {
print EXT "\t" . ${$functions}{$function}{rtype} . " " . $function . " (" . ${$functions}{$function}{parms} . ")" . "\n"; my $deleter = "";
if ($core_fnc{$function})
{
$deleter = " ~ " . $core_fnc{$function};
}
print EXT "\t" . ${$functions}{$function}{rtype} . " " . $function . " (" . ${$functions}{$function}{parms} . ")" . $deleter . "\n";
} }
} }
close EXT; close EXT;

View File

@ -20,6 +20,6 @@ if [ ! -d $1 ] ; then
# Parse each of the extensions in the registry # Parse each of the extensions in the registry
find $2 -name doc -type d -prune -o -name "*.txt" -print | \ find $2 -name doc -type d -prune -o -name "*.txt" -print | \
grep -v -f $3 | sort | bin/parse_spec.pl $1 grep -v -f $3 | sort | bin/parse_spec.pl $1 $4
fi fi