mirror of
https://github.com/nigels-com/glew.git
synced 2025-04-21 16:12:53 +00:00
adjust generation code so that the init functions can call other extension loader functions..
- example GL_VERSION_3_0 calling GL_ARB_vertex_array_objects
This commit is contained in:
parent
b5fce8d088
commit
0b4daf6e55
@ -12,6 +12,7 @@ my %regex = (
|
|||||||
function => qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)$/i,
|
function => qr/^(.+) ([a-z][a-z0-9_]*) \((.+)\)$/i,
|
||||||
token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+|[A-Z][A-Z0-9_]*)$/,
|
token => qr/^([A-Z][A-Z0-9_x]*)\s+((?:0x)?[0-9A-Fa-f]+|[A-Z][A-Z0-9_]*)$/,
|
||||||
type => qr/^typedef\s+(.+)$/,
|
type => qr/^typedef\s+(.+)$/,
|
||||||
|
loadexts => qr/^LOAD (.*)$/,
|
||||||
exact => qr/.*;$/,
|
exact => qr/.*;$/,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ sub parse_ext($)
|
|||||||
my %tokens = ();
|
my %tokens = ();
|
||||||
my @types = ();
|
my @types = ();
|
||||||
my @exacts = ();
|
my @exacts = ();
|
||||||
|
my @loadexts = ();
|
||||||
my $extname = ""; # Full extension name GL_FOO_extension
|
my $extname = ""; # Full extension name GL_FOO_extension
|
||||||
my $exturl = ""; # Info URL
|
my $exturl = ""; # Info URL
|
||||||
my $extstring = ""; # Relevant extension string
|
my $extstring = ""; # Relevant extension string
|
||||||
@ -104,7 +106,11 @@ sub parse_ext($)
|
|||||||
chomp;
|
chomp;
|
||||||
if (s/^\s+//)
|
if (s/^\s+//)
|
||||||
{
|
{
|
||||||
if (/$regex{exact}/)
|
if (/$regex{loadexts}/)
|
||||||
|
{
|
||||||
|
push @loadexts, $1;
|
||||||
|
}
|
||||||
|
elsif (/$regex{exact}/)
|
||||||
{
|
{
|
||||||
push @exacts, $_;
|
push @exacts, $_;
|
||||||
}
|
}
|
||||||
@ -132,7 +138,7 @@ sub parse_ext($)
|
|||||||
|
|
||||||
close EXT;
|
close EXT;
|
||||||
|
|
||||||
return ($extname, $exturl, $extstring, \@types, \%tokens, \%functions, \@exacts);
|
return ($extname, $exturl, $extstring, \@types, \%tokens, \%functions, \@exacts, \@loadexts);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub output_tokens($$)
|
sub output_tokens($$)
|
||||||
@ -207,3 +213,14 @@ sub output_exacts($$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub output_loadexts($$)
|
||||||
|
{
|
||||||
|
my ($tbl, $fnc) = @_;
|
||||||
|
if (scalar @{$tbl})
|
||||||
|
{
|
||||||
|
local $, = "\n";
|
||||||
|
print "\n";
|
||||||
|
print map { &{$fnc}($_) } sort @{$tbl};
|
||||||
|
print "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -29,7 +29,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
output_decls($functions, \&make_pfn_decl);
|
output_decls($functions, \&make_pfn_decl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
my $extvar = $extname;
|
my $extvar = $extname;
|
||||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||||
print "GLboolean " . prefix_varname($extvar) . " = GL_FALSE;\n";
|
print "GLboolean " . prefix_varname($extvar) . " = GL_FALSE;\n";
|
||||||
|
@ -52,7 +52,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
|
|
||||||
make_separator($extname);
|
make_separator($extname);
|
||||||
print "#ifndef $extname\n#define $extname 1\n";
|
print "#ifndef $extname\n#define $extname 1\n";
|
||||||
|
@ -26,7 +26,7 @@ if (@ARGV)
|
|||||||
print "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" align=\"center\">\n";
|
print "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"0\" align=\"center\">\n";
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
$cur_group = $extname;
|
$cur_group = $extname;
|
||||||
$cur_group =~ s/^(?:W?)GL(?:X?)_([A-Z0-9]+?)_.*$/$1/;
|
$cur_group =~ s/^(?:W?)GL(?:X?)_([A-Z0-9]+?)_.*$/$1/;
|
||||||
$extname =~ s/^(?:W?)GL(?:X?)_(.*)$/$1/;
|
$extname =~ s/^(?:W?)GL(?:X?)_(.*)$/$1/;
|
||||||
|
@ -32,7 +32,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
my $extvar = $extname;
|
my $extvar = $extname;
|
||||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||||
my $extpre = $extname;
|
my $extpre = $extname;
|
||||||
|
@ -38,7 +38,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
|
|
||||||
print "#ifdef $extname\n";
|
print "#ifdef $extname\n";
|
||||||
print " _glewInfo_$extname();\n";
|
print " _glewInfo_$extname();\n";
|
||||||
|
@ -21,6 +21,15 @@ sub make_pfn_def_init($%)
|
|||||||
return " r = ((" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $_[0] . "\")) == NULL) || r;";
|
return " r = ((" . $_[0] . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $_[0] . "\")) == NULL) || r;";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub make_loadexts_forward($%)
|
||||||
|
{
|
||||||
|
return "static GLboolean _glewInit_" . $_[0] . "(GLEW_CONTEXT_ARG_DEF_INIT);";
|
||||||
|
}
|
||||||
|
sub make_loadexts_call($%)
|
||||||
|
{
|
||||||
|
return " r = _glewInit_" . $_[0] . "(GLEW_CONTEXT_ARG_VAR_INIT) || r;";
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
my @extlist = ();
|
my @extlist = ();
|
||||||
@ -34,7 +43,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) =
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) =
|
||||||
parse_ext($ext);
|
parse_ext($ext);
|
||||||
|
|
||||||
#make_separator($extname);
|
#make_separator($extname);
|
||||||
@ -42,11 +51,14 @@ if (@ARGV)
|
|||||||
my $extvar = $extname;
|
my $extvar = $extname;
|
||||||
my $extvardef = $extname;
|
my $extvardef = $extname;
|
||||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||||
if (keys %$functions)
|
if (keys %$functions or keys @$loadexts)
|
||||||
{
|
{
|
||||||
|
output_loadexts($loadexts, \&make_loadexts_forward);
|
||||||
|
|
||||||
print "static GLboolean _glewInit_$extname (" . $type .
|
print "static GLboolean _glewInit_$extname (" . $type .
|
||||||
"EW_CONTEXT_ARG_DEF_INIT)\n{\n GLboolean r = GL_FALSE;\n";
|
"EW_CONTEXT_ARG_DEF_INIT)\n{\n GLboolean r = GL_FALSE;\n";
|
||||||
output_decls($functions, \&make_pfn_def_init);
|
output_decls($functions, \&make_pfn_def_init);
|
||||||
|
output_loadexts($loadexts, \&make_loadexts_call);
|
||||||
print "\n return r;\n}\n\n";
|
print "\n return r;\n}\n\n";
|
||||||
}
|
}
|
||||||
#print "\nGLboolean " . prefix_varname($extvar) . " = GL_FALSE;\n\n";
|
#print "\nGLboolean " . prefix_varname($extvar) . " = GL_FALSE;\n\n";
|
||||||
|
@ -32,7 +32,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
|
|
||||||
my $extvar = $extname;
|
my $extvar = $extname;
|
||||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||||
@ -49,7 +49,7 @@ if (@ARGV)
|
|||||||
print " " . $extvar . " = _glewHashListExists(ext_hashlist, (const GLubyte *)\"$extstring\");\n";
|
print " " . $extvar . " = _glewHashListExists(ext_hashlist, (const GLubyte *)\"$extstring\");\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keys %$functions)
|
if (keys %$functions or keys @$loadexts)
|
||||||
{
|
{
|
||||||
if ($extname =~ /WGL_.*/)
|
if ($extname =~ /WGL_.*/)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ if (@ARGV)
|
|||||||
my $curexttype = "";
|
my $curexttype = "";
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
my $exttype = $extname;
|
my $exttype = $extname;
|
||||||
$exttype =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$3/;
|
$exttype =~ s/(W*?)GL(X*?)_(.*?_)(.*)/$3/;
|
||||||
my $extrem = $extname;
|
my $extrem = $extname;
|
||||||
|
@ -30,7 +30,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
output_decls($functions, \&make_pfn_decl);
|
output_decls($functions, \&make_pfn_decl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ if (@ARGV)
|
|||||||
|
|
||||||
foreach my $ext (sort @extlist)
|
foreach my $ext (sort @extlist)
|
||||||
{
|
{
|
||||||
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts) = parse_ext($ext);
|
my ($extname, $exturl, $extstring, $types, $tokens, $functions, $exacts, $loadexts) = parse_ext($ext);
|
||||||
my $extvar = $extname;
|
my $extvar = $extname;
|
||||||
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
$extvar =~ s/GL(X*)_/GL$1EW_/;
|
||||||
print $export . " GLboolean " . prefix_varname($extvar) . ";\n";
|
print $export . " GLboolean " . prefix_varname($extvar) . ";\n";
|
||||||
|
@ -161,3 +161,7 @@ https://www.opengl.org/registry/doc/glspec30.20080923.pdf
|
|||||||
void glClearBufferfv (GLenum buffer, GLint drawBuffer, const GLfloat* value)
|
void glClearBufferfv (GLenum buffer, GLint drawBuffer, const GLfloat* value)
|
||||||
void glClearBufferfi (GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
|
void glClearBufferfi (GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil)
|
||||||
const GLubyte* glGetStringi (GLenum name, GLuint index)
|
const GLubyte* glGetStringi (GLenum name, GLuint index)
|
||||||
|
LOAD GL_ARB_framebuffer_object
|
||||||
|
LOAD GL_ARB_map_buffer_range
|
||||||
|
LOAD GL_ARB_uniform_buffer_object
|
||||||
|
LOAD GL_ARB_vertex_array_object
|
||||||
|
@ -39,3 +39,4 @@ https://www.opengl.org/registry/doc/glspec31.20090528.pdf
|
|||||||
void glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount)
|
void glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount)
|
||||||
void glTexBuffer (GLenum target, GLenum internalFormat, GLuint buffer)
|
void glTexBuffer (GLenum target, GLenum internalFormat, GLuint buffer)
|
||||||
void glPrimitiveRestartIndex (GLuint buffer)
|
void glPrimitiveRestartIndex (GLuint buffer)
|
||||||
|
LOAD GL_ARB_copy_buffer
|
||||||
|
@ -26,3 +26,7 @@ https://www.opengl.org/registry/doc/glspec32.compatibility.20091207.pdf
|
|||||||
void glGetInteger64i_v (GLenum pname, GLuint index, GLint64 * data)
|
void glGetInteger64i_v (GLenum pname, GLuint index, GLint64 * data)
|
||||||
void glGetBufferParameteri64v (GLenum target, GLenum value, GLint64 * data)
|
void glGetBufferParameteri64v (GLenum target, GLenum value, GLint64 * data)
|
||||||
void glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level)
|
void glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level)
|
||||||
|
LOAD GL_ARB_draw_elements_base_vertex
|
||||||
|
LOAD GL_ARB_provoking_vertex
|
||||||
|
LOAD GL_ARB_sync
|
||||||
|
LOAD GL_ARB_texture_multisample
|
||||||
|
Loading…
Reference in New Issue
Block a user