2000-06-12 03:21:18 +02:00
|
|
|
#!/usr/bin/perl -w
|
2005-05-20 20:58:10 +02:00
|
|
|
use strict;
|
2013-11-01 18:18:26 +01:00
|
|
|
use XML::Simple;
|
2000-06-12 03:21:18 +02:00
|
|
|
|
|
|
|
# This script is called thus :
|
|
|
|
#
|
2009-01-08 12:29:39 +01:00
|
|
|
# make_opengl [opengl_version]
|
|
|
|
#
|
2012-07-17 00:00:55 +02:00
|
|
|
# - It needs files from the OpenGL extension registry:
|
2000-06-12 03:21:18 +02:00
|
|
|
#
|
2013-11-01 18:18:26 +01:00
|
|
|
# https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml
|
|
|
|
# https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml
|
2007-08-17 19:22:12 +02:00
|
|
|
#
|
2009-01-08 12:29:39 +01:00
|
|
|
# If they are not found in the current directory the script will
|
|
|
|
# attempt to download them from there.
|
|
|
|
#
|
2000-06-12 03:21:18 +02:00
|
|
|
# - opengl_version is the OpenGL version emulated by the library
|
2009-06-11 11:53:40 +02:00
|
|
|
# (can be 1.0 to 1.5). The default is 1.1.
|
2000-06-12 03:21:18 +02:00
|
|
|
#
|
|
|
|
# This script generates the three following files :
|
|
|
|
#
|
|
|
|
# - opengl32.spec : the spec file giving all the exported functions
|
|
|
|
# of the OpenGL32.DLL library. These functions are the one an
|
|
|
|
# application can directly link to (and are all the functions
|
|
|
|
# defined in the OpenGL core for the version defined by
|
|
|
|
# 'opengl_version').
|
|
|
|
#
|
|
|
|
# - opengl_norm.c : this file contains the thunks for all OpenGL
|
|
|
|
# functions that are defined in 'opengl32.spec'. The corresponding
|
|
|
|
# functions NEED to be defined in Linux's libGL or the library
|
|
|
|
# won't be able to be linked in.
|
|
|
|
#
|
|
|
|
# - opengl_ext.c : in this file are stored thunks for ALL possible
|
|
|
|
# OpenGL extensions (at least, all the extensions that are defined
|
|
|
|
# in the OpenGL extension registry). Contrary to 'opengl_norm.c',
|
|
|
|
# you do not need to have these extensions in your libGL to have
|
|
|
|
# OpenGL work (as they are resolved at run-time using
|
|
|
|
# glXGetProcAddressARB).
|
|
|
|
#
|
2012-07-16 23:21:53 +02:00
|
|
|
# - include/wine/wgl_driver.h: definitions for the tables of OpenGL functions.
|
|
|
|
#
|
|
|
|
#
|
2002-03-10 00:29:33 +01:00
|
|
|
# Copyright 2000 Lionel Ulmer
|
2012-07-16 23:21:53 +02:00
|
|
|
# Copyright 2012 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This library is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# Lesser General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
|
|
# License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
#
|
2000-06-12 03:21:18 +02:00
|
|
|
|
2001-03-04 02:05:20 +01:00
|
|
|
#
|
|
|
|
# Files to generate
|
|
|
|
#
|
2005-05-20 20:58:10 +02:00
|
|
|
my $spec_file = "opengl32.spec";
|
|
|
|
my $norm_file = "opengl_norm.c";
|
|
|
|
my $ext_file = "opengl_ext.c";
|
2013-11-01 18:18:05 +01:00
|
|
|
my $wgl_driver_file = "../../include/wine/wgl_driver.h";
|
|
|
|
my $wgl_file = "../../include/wine/wgl.h";
|
2001-03-04 02:05:20 +01:00
|
|
|
|
|
|
|
# Set to 0 for removing the ENTER / LEAVE GL calls
|
2012-06-26 15:23:05 +02:00
|
|
|
my $gen_thread_safe = 0;
|
2001-03-04 02:05:20 +01:00
|
|
|
# Prefix used for the local variables
|
2005-05-20 20:58:10 +02:00
|
|
|
my $ext_prefix = "func_";
|
2001-03-04 02:05:20 +01:00
|
|
|
# If set to 1, generate TRACEs for each OpenGL function
|
2005-05-20 20:58:10 +02:00
|
|
|
my $gen_traces = 1;
|
2001-03-04 02:05:20 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# List of categories to put in the 'opengl_norm.c' file
|
|
|
|
#
|
2013-11-01 18:18:26 +01:00
|
|
|
my %cat_1_0 = ( "GL_VERSION_1_0" => 1 );
|
|
|
|
my %cat_1_1 = ( %cat_1_0, "GL_VERSION_1_1" => 1 );
|
|
|
|
my %cat_1_2 = ( %cat_1_1, "GL_VERSION_1_2" => 1 );
|
|
|
|
my %cat_1_3 = ( %cat_1_2, "GL_VERSION_1_3" => 1 );
|
|
|
|
my %cat_1_4 = ( %cat_1_3, "GL_VERSION_1_4" => 1 );
|
|
|
|
my %cat_1_5 = ( %cat_1_4, "GL_VERSION_1_5" => 1 );
|
2001-03-04 02:05:20 +01:00
|
|
|
|
2005-05-20 20:58:10 +02:00
|
|
|
my %norm_categories = ();
|
2001-03-04 02:05:20 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# This hash table gives the conversion between OpenGL types and what
|
|
|
|
# is used by the TRACE printfs
|
|
|
|
#
|
2005-05-20 20:58:10 +02:00
|
|
|
my %debug_conv =
|
2001-03-04 02:05:20 +01:00
|
|
|
("GLbitfield" => "%d",
|
|
|
|
"GLboolean" => "%d",
|
|
|
|
"GLbyte" => "%d",
|
|
|
|
"GLclampd" => "%f",
|
|
|
|
"GLclampf" => "%f",
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLclampx" => "%d",
|
2001-03-04 02:05:20 +01:00
|
|
|
"GLdouble" => "%f",
|
|
|
|
"GLenum" => "%d",
|
|
|
|
"GLfloat" => "%f",
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLfixed" => "%d",
|
2001-03-04 02:05:20 +01:00
|
|
|
"GLint" => "%d",
|
|
|
|
"GLshort" => "%d",
|
|
|
|
"GLsizei" => "%d",
|
|
|
|
"GLstring" => "%s",
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLsync" => "%p",
|
2001-03-04 02:05:20 +01:00
|
|
|
"GLubyte" => "%d",
|
|
|
|
"GLuint" => "%d",
|
|
|
|
"GLushort" => "%d",
|
2003-06-13 18:31:17 +02:00
|
|
|
"GLhalfNV" => "%d",
|
2009-01-08 12:15:47 +01:00
|
|
|
"GLintptrARB" => "%ld",
|
|
|
|
"GLsizeiptrARB" => "%ld",
|
|
|
|
"GLintptr" => "%ld",
|
|
|
|
"GLsizeiptr" => "%ld",
|
2004-03-02 21:54:17 +01:00
|
|
|
"GLhandleARB" => "%d",
|
|
|
|
"GLcharARB" => "%c",
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLuint64" => "%s,wine_dbgstr_longlong(%s)",
|
|
|
|
"GLuint64EXT" => "%s,wine_dbgstr_longlong(%s)",
|
|
|
|
"GLint64EXT" => "%s,wine_dbgstr_longlong(%s)",
|
2001-03-04 02:05:20 +01:00
|
|
|
"GLvoid" => "(void)",
|
2009-05-28 15:23:10 +02:00
|
|
|
"_GLfuncptr" => "%p",
|
2012-09-07 20:53:06 +02:00
|
|
|
"GLDEBUGPROC" => "%p",
|
2010-08-31 22:19:54 +02:00
|
|
|
"GLDEBUGPROCARB" => "%p",
|
|
|
|
"GLDEBUGPROCAMD" => "%p",
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLDEBUGPROCKHR" => "%p",
|
2010-08-31 22:19:54 +02:00
|
|
|
"GLvdpauSurfaceNV" => "%ld",
|
2012-07-17 00:00:55 +02:00
|
|
|
"int" => "%d",
|
|
|
|
"unsigned int" => "%u",
|
|
|
|
"UINT" => "%u",
|
|
|
|
"DWORD" => "%u",
|
|
|
|
"BOOL" => "%u",
|
2010-08-31 22:19:54 +02:00
|
|
|
"INT64" => "%s,wine_dbgstr_longlong(%s)",
|
2012-07-17 00:00:55 +02:00
|
|
|
"UINT64" => "%s,wine_dbgstr_longlong(%s)",
|
|
|
|
"LPVOID" => "%p",
|
|
|
|
"HANDLE" => "%p",
|
|
|
|
"HDC" => "%p",
|
|
|
|
"HGLRC" => "%p",
|
|
|
|
"HPBUFFERARB" => "%p",
|
|
|
|
"HPBUFFEREXT" => "%p",
|
2009-05-28 15:23:10 +02:00
|
|
|
);
|
2001-03-04 02:05:20 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# This hash table gives the conversion between OpenGL types and what
|
2012-11-07 13:14:58 +01:00
|
|
|
# is used in the .spec and header files.
|
2001-03-04 02:05:20 +01:00
|
|
|
#
|
2005-05-20 20:58:10 +02:00
|
|
|
my %arg_conv =
|
2012-11-07 13:14:58 +01:00
|
|
|
("GLbitfield" => [ "long", "unsigned int" ],
|
|
|
|
"GLboolean" => [ "long", "unsigned char" ],
|
|
|
|
"GLbyte" => [ "long", "signed char" ],
|
|
|
|
"GLchar" => [ "long", "char" ],
|
|
|
|
"GLclampd" => [ "double", "double" ],
|
|
|
|
"GLclampf" => [ "float", "float" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLclampx" => [ "long", "int" ],
|
2012-11-07 13:14:58 +01:00
|
|
|
"GLdouble" => [ "double", "double" ],
|
|
|
|
"GLenum" => [ "long", "unsigned int" ],
|
|
|
|
"GLfloat" => [ "float", "float" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLfixed" => [ "long", "int" ],
|
2012-11-07 13:14:58 +01:00
|
|
|
"GLint" => [ "long", "int" ],
|
|
|
|
"GLint64" => [ "int64", "INT64" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLint64EXT" => [ "int64", "INT64" ],
|
2012-11-07 13:14:58 +01:00
|
|
|
"GLintptr" => [ "long", "INT_PTR" ],
|
|
|
|
"GLshort" => [ "long", "short" ],
|
|
|
|
"GLsizei" => [ "long", "int" ],
|
|
|
|
"GLsizeiptr" => [ "long", "INT_PTR" ],
|
|
|
|
"GLstring" => [ "str", "const unsigned char *" ],
|
|
|
|
"GLsync" => [ "ptr", "struct __GLsync *" ],
|
|
|
|
"GLubyte" => [ "long", "unsigned char" ],
|
|
|
|
"GLuint" => [ "long", "unsigned int" ],
|
|
|
|
"GLuint64" => [ "int64", "UINT64" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLuint64EXT" => [ "int64", "UINT64" ],
|
2012-11-07 13:14:58 +01:00
|
|
|
"GLushort" => [ "long", "unsigned short" ],
|
|
|
|
"GLvoid" => [ "void", "void" ],
|
|
|
|
"GLcharARB" => [ "long", "char" ],
|
|
|
|
"GLhandleARB" => [ "long", "unsigned int" ],
|
|
|
|
"GLintptrARB" => [ "long", "INT_PTR" ],
|
|
|
|
"GLsizeiptrARB" => [ "long", "INT_PTR" ],
|
|
|
|
"GLhalfNV" => [ "long", "unsigned short" ],
|
|
|
|
"GLvdpauSurfaceNV" => [ "long", "INT_PTR" ]);
|
2001-03-04 02:05:20 +01:00
|
|
|
|
2003-06-20 23:29:28 +02:00
|
|
|
#
|
|
|
|
# Used to convert some types
|
|
|
|
#
|
2005-05-20 20:58:10 +02:00
|
|
|
sub ConvertType($)
|
|
|
|
{
|
2003-06-20 23:29:28 +02:00
|
|
|
my ($type) = @_;
|
|
|
|
|
2012-11-07 18:06:42 +01:00
|
|
|
my %hash = (
|
2010-08-31 22:19:54 +02:00
|
|
|
"struct _cl_context" => "void",
|
|
|
|
"struct _cl_event" => "void",
|
2012-07-17 00:00:55 +02:00
|
|
|
"HGLRC" => "struct wgl_context *",
|
2012-09-07 20:53:06 +02:00
|
|
|
"GLDEBUGPROC" => "void *",
|
2010-08-31 22:19:54 +02:00
|
|
|
"GLDEBUGPROCARB" => "void *",
|
2012-07-17 00:00:55 +02:00
|
|
|
"GLDEBUGPROCAMD" => "void *",
|
2013-11-01 18:18:26 +01:00
|
|
|
"GLDEBUGPROCKHR" => "void *",
|
2012-07-20 12:25:01 +02:00
|
|
|
"HPBUFFERARB" => "struct wgl_pbuffer *",
|
|
|
|
"HPBUFFEREXT" => "struct wgl_pbuffer *",
|
2012-07-17 00:00:55 +02:00
|
|
|
);
|
2003-06-20 23:29:28 +02:00
|
|
|
|
2005-05-20 20:58:10 +02:00
|
|
|
foreach my $org (reverse sort keys %hash) {
|
2013-11-01 18:18:14 +01:00
|
|
|
if ($type =~ /^(.*)$org(.*)$/) {
|
|
|
|
return "$1$hash{$org}$2";
|
|
|
|
}
|
2003-06-20 23:29:28 +02:00
|
|
|
}
|
|
|
|
return $type;
|
|
|
|
}
|
|
|
|
|
2004-03-02 21:54:17 +01:00
|
|
|
#
|
|
|
|
# Used to convert some variable names
|
|
|
|
#
|
2005-05-20 20:58:10 +02:00
|
|
|
sub ConvertVarName($)
|
|
|
|
{
|
2004-03-02 21:54:17 +01:00
|
|
|
my ($type) = @_;
|
|
|
|
|
2005-05-20 20:58:10 +02:00
|
|
|
my %hash = ( "near" => "nearParam",
|
|
|
|
"far" => "farParam" );
|
2004-03-02 21:54:17 +01:00
|
|
|
|
2005-05-20 20:58:10 +02:00
|
|
|
foreach my $org (keys %hash) {
|
2013-11-01 18:18:14 +01:00
|
|
|
if ($type =~ /^(.*)$org(.*)$/) {
|
|
|
|
return "$1$hash{$org}$2";
|
|
|
|
}
|
2004-03-02 21:54:17 +01:00
|
|
|
}
|
|
|
|
return $type;
|
|
|
|
}
|
|
|
|
|
2000-06-12 03:21:18 +02:00
|
|
|
#
|
|
|
|
# This functions generates the thunk for a given function.
|
|
|
|
#
|
2012-07-17 00:00:55 +02:00
|
|
|
sub GenerateThunk($$$$)
|
2005-05-20 20:58:10 +02:00
|
|
|
{
|
2012-07-17 00:00:55 +02:00
|
|
|
my ($name, $func_ref, $comment, $prefix) = @_;
|
2005-05-20 20:58:10 +02:00
|
|
|
my $ret = "";
|
|
|
|
my $call_arg = "";
|
2009-05-28 15:23:10 +02:00
|
|
|
my $trace_call_arg = "";
|
2005-05-20 20:58:10 +02:00
|
|
|
my $trace_arg = "";
|
2006-12-12 17:59:44 +01:00
|
|
|
|
2012-07-17 00:00:55 +02:00
|
|
|
return "" if $name eq "glDebugEntry";
|
2015-02-10 20:13:44 +01:00
|
|
|
return "" if $name eq "glGetIntegerv";
|
2012-07-17 00:00:55 +02:00
|
|
|
return "" if $name eq "glGetString";
|
2013-11-01 18:18:26 +01:00
|
|
|
return "" if $func_ref->[2] && $func_ref->[2]->[0] =~ /WGL_/;
|
2000-06-12 03:21:18 +02:00
|
|
|
|
|
|
|
# If for opengl_norm.c, generate a nice heading otherwise Patrik won't be happy :-)
|
2001-07-31 02:08:05 +02:00
|
|
|
# Patrik says: Well I would be even happier if a (OPENGL32.@) was added as well. Done. :-)
|
2000-06-12 03:21:18 +02:00
|
|
|
if ($comment eq 1) {
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= "/***********************************************************************\n";
|
|
|
|
$ret .= " * $name (OPENGL32.\@)\n";
|
|
|
|
$ret .= " */\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= ConvertType($func_ref->[0]) . " WINAPI $name( ";
|
2012-07-17 00:00:55 +02:00
|
|
|
for (my $i = 0; $i < @{$func_ref->[1]}; $i++) {
|
2013-11-01 18:18:14 +01:00
|
|
|
my $type = $func_ref->[1]->[$i]->[0];
|
|
|
|
my $name = ConvertVarName($func_ref->[1]->[$i]->[1]);
|
2015-01-15 20:00:02 +01:00
|
|
|
my ($base_type, $type_specifier, $name_specifier) = ($type, $type, $name);
|
|
|
|
if ($type =~ /(.*) (.*)/) {
|
|
|
|
$base_type = $2;
|
|
|
|
} elsif ($type =~ /(.*)(\[.*)/) {
|
|
|
|
$base_type = $1;
|
|
|
|
$type_specifier = $1;
|
|
|
|
$name_specifier = $name . $2
|
|
|
|
}
|
|
|
|
$ret .= ConvertType($type_specifier) . " $name_specifier";
|
2013-11-01 18:18:14 +01:00
|
|
|
$call_arg .= $name;
|
2015-01-15 20:00:02 +01:00
|
|
|
if ($type =~ /\*/ || $type =~ /\[/) {
|
2013-11-01 18:18:14 +01:00
|
|
|
$trace_arg .= "%p";
|
2009-05-28 15:23:10 +02:00
|
|
|
$trace_call_arg .= $name;
|
2015-01-15 20:00:02 +01:00
|
|
|
} elsif (defined $debug_conv{$base_type}) {
|
|
|
|
if ($debug_conv{$base_type} =~ /(.*),(.*)/) {
|
2009-05-28 15:23:10 +02:00
|
|
|
$trace_arg .= $1;
|
|
|
|
$trace_call_arg .= sprintf $2, $name;
|
2015-01-15 20:00:02 +01:00
|
|
|
} else {
|
|
|
|
$trace_arg .= $debug_conv{$base_type};
|
2009-05-28 15:23:10 +02:00
|
|
|
$trace_call_arg .= $name;
|
|
|
|
}
|
2013-11-01 18:18:14 +01:00
|
|
|
}
|
|
|
|
else { printf "Unknown type %s\n", $type; }
|
|
|
|
if ($i+1 < @{$func_ref->[1]}) {
|
|
|
|
$ret .= ", ";
|
|
|
|
$call_arg .= ", ";
|
|
|
|
$trace_call_arg .= ", ";
|
|
|
|
$trace_arg .= ", ";
|
|
|
|
} else {
|
|
|
|
$ret .= " ";
|
|
|
|
$call_arg .= " ";
|
|
|
|
$trace_call_arg .= " ";
|
|
|
|
}
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret .= 'void ' if (!@{$func_ref->[1]});
|
2015-02-10 20:13:44 +01:00
|
|
|
return "$ret) DECLSPEC_HIDDEN;\n" if $name eq "glGetStringi";
|
2012-07-16 23:39:31 +02:00
|
|
|
$ret .= ") {\n";
|
2012-07-18 13:07:08 +02:00
|
|
|
$ret .= " const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;\n";
|
2012-07-17 00:00:55 +02:00
|
|
|
if ($func_ref->[0] ne "void" && $gen_thread_safe) {
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= " " . ConvertType($func_ref->[0]) . " ret_value;\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2001-03-04 02:05:20 +01:00
|
|
|
if ($gen_traces) {
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= " TRACE(\"($trace_arg)\\n\"";
|
|
|
|
if ($trace_arg ne "") {
|
|
|
|
$ret .= ", $trace_call_arg";
|
|
|
|
}
|
|
|
|
$ret .= ");\n";
|
2001-03-04 02:05:20 +01:00
|
|
|
}
|
2012-07-16 23:39:31 +02:00
|
|
|
if ($gen_thread_safe) {
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= " ENTER_GL();\n";
|
2012-06-26 15:23:05 +02:00
|
|
|
$ret .= " ";
|
2012-07-17 00:00:55 +02:00
|
|
|
if ($func_ref->[0] ne "void") {
|
2012-06-26 15:23:05 +02:00
|
|
|
$ret .= "ret_value = ";
|
|
|
|
}
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret .= "funcs->$prefix.p_$name( $call_arg);\n";
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= " LEAVE_GL();\n";
|
2012-07-17 00:00:55 +02:00
|
|
|
if ($func_ref->[0] ne "void") {
|
2012-06-26 15:23:05 +02:00
|
|
|
$ret .= " return ret_value;\n"
|
|
|
|
}
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2012-06-26 15:23:05 +02:00
|
|
|
else {
|
|
|
|
$ret .= " ";
|
2012-07-17 00:00:55 +02:00
|
|
|
if ($func_ref->[0] ne "void") {
|
2012-06-26 15:23:05 +02:00
|
|
|
$ret .= "return ";
|
|
|
|
}
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret .= "funcs->$prefix.p_$name( $call_arg);\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= "}\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
|
|
|
|
# Return this string....
|
2005-05-20 20:58:10 +02:00
|
|
|
return $ret;
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
|
|
|
|
2012-07-17 00:00:55 +02:00
|
|
|
sub generate_null_func($$)
|
2012-07-16 23:34:45 +02:00
|
|
|
{
|
2012-07-17 00:00:55 +02:00
|
|
|
my ($name, $func_ref) = @_;
|
2012-07-16 23:34:45 +02:00
|
|
|
my $ret;
|
|
|
|
|
2012-07-17 00:00:55 +02:00
|
|
|
return "" if $name eq "glDebugEntry";
|
2012-07-16 23:34:45 +02:00
|
|
|
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret = "static " . ConvertType($func_ref->[0]) . " null_$name( ";
|
|
|
|
for (my $i = 0; $i < @{$func_ref->[1]}; $i++) {
|
2013-11-01 18:18:14 +01:00
|
|
|
my $type = $func_ref->[1]->[$i]->[0];
|
|
|
|
my $name = ConvertVarName($func_ref->[1]->[$i]->[1]);
|
2015-01-15 20:00:02 +01:00
|
|
|
my $base_type;
|
|
|
|
if ($type =~ /(.*)(\[.*)/) {
|
|
|
|
$base_type = $1;
|
|
|
|
$name .= $2;
|
|
|
|
} else {
|
|
|
|
$base_type = $type;
|
|
|
|
}
|
|
|
|
$ret .= ConvertType($base_type) . " $name";
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= "," if ($i+1 < @{$func_ref->[1]});
|
2012-07-16 23:34:45 +02:00
|
|
|
$ret .= " ";
|
|
|
|
}
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret .= 'void ' if (!@{$func_ref->[1]});
|
2012-07-16 23:34:45 +02:00
|
|
|
$ret .= ") {";
|
2012-07-17 00:00:55 +02:00
|
|
|
if ($name eq "glGetError")
|
2012-07-16 23:34:45 +02:00
|
|
|
{
|
|
|
|
$ret .= " return GL_INVALID_OPERATION;";
|
|
|
|
}
|
2012-07-17 00:00:55 +02:00
|
|
|
elsif ($func_ref->[0] ne "void")
|
2012-07-16 23:34:45 +02:00
|
|
|
{
|
|
|
|
$ret .= " return 0;";
|
|
|
|
}
|
|
|
|
$ret .= " }\n";
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
2012-11-07 13:14:58 +01:00
|
|
|
sub get_func_proto($$$)
|
2012-07-16 23:21:53 +02:00
|
|
|
{
|
2012-11-07 13:14:58 +01:00
|
|
|
my ($format, $name, $func) = @_;
|
2012-07-17 00:00:55 +02:00
|
|
|
my $ret = sprintf "%-10s", ConvertType($func->[0]);
|
2012-11-07 13:14:58 +01:00
|
|
|
$ret .= " " . sprintf($format,$name) . "(";
|
2012-07-17 00:00:55 +02:00
|
|
|
for (my $i = 0; $i < @{$func->[1]}; $i++)
|
2012-07-16 23:21:53 +02:00
|
|
|
{
|
2013-11-01 18:18:14 +01:00
|
|
|
$ret .= ConvertType($func->[1]->[$i]->[0]);
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret .= "," if ($i+1 < @{$func->[1]});
|
2012-07-16 23:21:53 +02:00
|
|
|
}
|
2012-07-17 00:00:55 +02:00
|
|
|
$ret .= "void" unless @{$func->[1]};
|
2012-07-16 23:21:53 +02:00
|
|
|
$ret .= ")";
|
|
|
|
return $ret;
|
|
|
|
}
|
|
|
|
|
2000-06-12 03:21:18 +02:00
|
|
|
#
|
|
|
|
# Extract and checks the number of arguments
|
|
|
|
#
|
2009-01-08 12:29:39 +01:00
|
|
|
if (@ARGV > 1) {
|
2005-05-20 20:58:10 +02:00
|
|
|
my $name0=$0;
|
|
|
|
$name0=~s%^.*/%%;
|
2009-01-08 12:29:39 +01:00
|
|
|
die "Usage: $name0 [version]\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2009-06-11 11:53:40 +02:00
|
|
|
my $version = $ARGV[0] || "1.1";
|
2000-06-12 03:21:18 +02:00
|
|
|
if ($version eq "1.0") {
|
|
|
|
%norm_categories = %cat_1_0;
|
|
|
|
} elsif ($version eq "1.1") {
|
|
|
|
%norm_categories = %cat_1_1;
|
|
|
|
} elsif ($version eq "1.2") {
|
|
|
|
%norm_categories = %cat_1_2;
|
2004-03-02 21:54:17 +01:00
|
|
|
} elsif ($version eq "1.3") {
|
|
|
|
%norm_categories = %cat_1_3;
|
|
|
|
} elsif ($version eq "1.4") {
|
|
|
|
%norm_categories = %cat_1_4;
|
|
|
|
} elsif ($version eq "1.5") {
|
|
|
|
%norm_categories = %cat_1_5;
|
2000-06-12 03:21:18 +02:00
|
|
|
} else {
|
2004-03-02 21:54:17 +01:00
|
|
|
die "Incorrect OpenGL version.\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
|
|
|
|
2009-01-08 12:29:39 +01:00
|
|
|
#
|
|
|
|
# Fetch the registry files
|
|
|
|
#
|
2014-01-15 20:46:52 +01:00
|
|
|
-f "gl.xml" || system "wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml" || die "cannot download gl.xml";
|
|
|
|
-f "wgl.xml" || system "wget --no-check-certificate https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml" || die "cannot download wgl.xml";
|
2000-06-12 03:21:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
#
|
2013-11-01 18:18:26 +01:00
|
|
|
# Then, create the list of all OpenGL functions using the registry
|
|
|
|
# files. This will create two hash-tables, one with all the function
|
2000-06-12 03:21:18 +02:00
|
|
|
# whose category matches the one listed in '@norm_categories', the other
|
|
|
|
# with all other functions.
|
|
|
|
#
|
|
|
|
# An element of the hash table is a reference to an array with these
|
|
|
|
# elements :
|
|
|
|
#
|
|
|
|
# - function name
|
|
|
|
#
|
|
|
|
# - return type
|
|
|
|
#
|
|
|
|
# - reference to an array giving the list of arguments (an empty array
|
|
|
|
# for a 'void' function).
|
|
|
|
#
|
|
|
|
# The list of arguments is itself an array of reference to arrays. Each
|
|
|
|
# of these arrays represents the argument type and the argument name.
|
|
|
|
#
|
|
|
|
# An example :
|
|
|
|
#
|
|
|
|
# void glBitmap( GLsizei width, GLsizei height,
|
|
|
|
# GLfloat xorig, GLfloat yorig,
|
|
|
|
# GLfloat xmove, GLfloat ymove,
|
|
|
|
# const GLubyte *bitmap );
|
|
|
|
#
|
|
|
|
# Would give something like that :
|
|
|
|
#
|
|
|
|
# [ "glBitmap",
|
|
|
|
# "void",
|
|
|
|
# [ [ "GLsizei", "width" ],
|
|
|
|
# [ "GLsizei", "height" ],
|
|
|
|
# [ "GLfloat", "xorig" ],
|
|
|
|
# [ "GLfloat", "yorig" ],
|
|
|
|
# [ "GLfloat", "xmove" ],
|
|
|
|
# [ "GLfloat", "ymove" ],
|
|
|
|
# [ "GLubyte *", "bitmap"] ] ];
|
|
|
|
#
|
2012-07-17 00:00:55 +02:00
|
|
|
my %norm_functions = ( "glDebugEntry" => [ "GLint", [[ "GLint", "unknown1" ],
|
|
|
|
[ "GLint", "unknown2" ]] ] );
|
2003-03-04 03:17:04 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# This stores various extensions NOT part of the GL extension registry but still
|
|
|
|
# implemented by most OpenGL libraries out there...
|
|
|
|
#
|
2005-05-20 20:58:10 +02:00
|
|
|
|
|
|
|
my %ext_functions =
|
2012-07-17 00:00:55 +02:00
|
|
|
(
|
2013-11-01 18:18:26 +01:00
|
|
|
"glDeleteBufferRegion" => [ "void", [ [ "GLenum", "region" ] ], [ "GL_KTX_buffer_region" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glReadBufferRegion" => [ "void", [ [ "GLenum", "region" ],
|
|
|
|
[ "GLint", "x" ],
|
|
|
|
[ "GLint", "y" ],
|
|
|
|
[ "GLsizei", "width" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLsizei", "height" ] ], [ "GL_KTX_buffer_region" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glDrawBufferRegion" => [ "void", [ [ "GLenum", "region" ],
|
|
|
|
[ "GLint", "x" ],
|
|
|
|
[ "GLint", "y" ],
|
|
|
|
[ "GLsizei", "width" ],
|
|
|
|
[ "GLsizei", "height" ],
|
|
|
|
[ "GLint", "xDest" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint", "yDest" ] ], [ "GL_KTX_buffer_region" ] ],
|
|
|
|
"glBufferRegionEnabled" => [ "GLuint", [ ], [ "GL_KTX_buffer_region" ] ],
|
|
|
|
"glNewBufferRegion" => [ "GLuint", [ [ "GLenum", "type" ] ], [ "GL_KTX_buffer_region" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMTexCoord2fSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLfloat", "s" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat", "t" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMTexCoord2fvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1dSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble", "s" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1dvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1fSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat", "s" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1fvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "const GLfloat *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1iSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint", "s" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1ivSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1sSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort", "s" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord1svSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2dSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLdouble", "s"],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble", "t" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2dvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2fSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLfloat", "s" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat", "t" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2fvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2iSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLint", "s" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint", "t" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2ivSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2sSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLshort", "s" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort", "t" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord2svSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3dSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLdouble", "s" ],
|
|
|
|
[ "GLdouble", "t" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble", "r" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3dvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3fSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLfloat", "s" ],
|
|
|
|
[ "GLfloat", "t" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat", "r" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3fvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3iSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLint", "s" ],
|
|
|
|
[ "GLint", "t" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint", "r" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3ivSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3sSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLshort", "s" ],
|
|
|
|
[ "GLshort", "t" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort", "r" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord3svSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4dSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLdouble", "s" ],
|
|
|
|
[ "GLdouble", "t" ],
|
|
|
|
[ "GLdouble", "r" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble", "q" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4dvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLdouble *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4fSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLfloat", "s" ],
|
|
|
|
[ "GLfloat", "t" ],
|
|
|
|
[ "GLfloat", "r" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat", "q" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4fvSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLfloat *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4iSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLint", "s" ],
|
|
|
|
[ "GLint", "t" ],
|
|
|
|
[ "GLint", "r" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint", "q" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4ivSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLint *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4sSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLshort", "s" ],
|
|
|
|
[ "GLshort", "t" ],
|
|
|
|
[ "GLshort", "r" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort", "q" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoord4svSGIS" => [ "void", [ [ "GLenum", "target" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLshort *", "v" ] ], [ "GL_SGIS_multitexture" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"glMultiTexCoordPointerSGIS" => [ "void", [ [ "GLenum", "target" ],
|
|
|
|
[ "GLint", "size" ],
|
|
|
|
[ "GLenum", "type" ],
|
|
|
|
[ "GLsizei", "stride" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "GLvoid *", "pointer" ] ], [ "GL_SGIS_multitexture" ] ],
|
|
|
|
"glSelectTextureSGIS" => [ "void", [ [ "GLenum", "target" ] ], [ "GL_SGIS_multitexture" ] ],
|
|
|
|
"glSelectTextureCoordSetSGIS" => [ "void", [ [ "GLenum", "target" ] ], [ "GL_SGIS_multitexture" ] ],
|
|
|
|
"glDeleteObjectBufferATI" => [ "void", [ [ "GLuint", "buffer" ] ], [ "GL_ATI_vertex_array_object" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
"wglSetPixelFormatWINE" => [ "BOOL", [ [ "HDC", "hdc" ],
|
2013-11-01 18:18:26 +01:00
|
|
|
[ "int", "format" ] ], [ "WGL_WINE_pixel_format_passthrough" ] ],
|
2012-07-17 00:00:55 +02:00
|
|
|
);
|
2001-07-31 02:08:05 +02:00
|
|
|
|
2012-07-18 23:58:41 +02:00
|
|
|
|
|
|
|
my %wgl_functions =
|
|
|
|
(
|
|
|
|
"wglCopyContext" => [ "BOOL", [ [ "struct wgl_context *", "src" ],
|
|
|
|
[ "struct wgl_context *", "dst" ],
|
|
|
|
[ "UINT", "mask" ] ] ],
|
|
|
|
"wglCreateContext" => [ "struct wgl_context *", [ [ "HDC", "hdc" ] ] ],
|
|
|
|
"wglDeleteContext" => [ "void", [ [ "struct wgl_context *", "context" ] ] ],
|
2012-07-30 21:53:37 +02:00
|
|
|
"wglDescribePixelFormat" => [ "INT", [ [ "HDC", "hdc" ],
|
|
|
|
[ "INT", "format" ],
|
|
|
|
[ "UINT", "size" ],
|
|
|
|
[ "PIXELFORMATDESCRIPTOR *", "descr" ] ] ],
|
2012-07-18 23:58:41 +02:00
|
|
|
"wglGetPixelFormat" => [ "INT", [ [ "HDC", "hdc" ] ] ],
|
|
|
|
"wglGetProcAddress" => [ "PROC", [ [ "LPCSTR", "name" ] ] ],
|
|
|
|
"wglMakeCurrent" => [ "BOOL", [ [ "HDC", "hdc" ],
|
|
|
|
[ "struct wgl_context *", "context" ] ] ],
|
2012-07-30 21:53:37 +02:00
|
|
|
"wglSetPixelFormat" => [ "BOOL", [ [ "HDC", "hdc" ],
|
|
|
|
[ "INT", "format" ],
|
|
|
|
[ "const PIXELFORMATDESCRIPTOR *", "descr" ] ] ],
|
2012-07-18 23:58:41 +02:00
|
|
|
"wglShareLists" => [ "BOOL", [ [ "struct wgl_context *", "org" ],
|
|
|
|
[ "struct wgl_context *", "dst" ] ] ],
|
2012-09-07 21:11:55 +02:00
|
|
|
"wglSwapBuffers" => [ "BOOL", [ [ "HDC", "hdc" ] ] ],
|
2012-07-18 23:58:41 +02:00
|
|
|
);
|
|
|
|
|
2012-07-17 00:00:55 +02:00
|
|
|
my %supported_wgl_extensions =
|
|
|
|
(
|
|
|
|
"WGL_ARB_create_context" => 1,
|
|
|
|
"WGL_ARB_extensions_string" => 1,
|
|
|
|
"WGL_ARB_make_current_read" => 1,
|
|
|
|
"WGL_ARB_pbuffer" => 1,
|
|
|
|
"WGL_ARB_pixel_format" => 1,
|
|
|
|
"WGL_ARB_render_texture" => 1,
|
|
|
|
"WGL_EXT_extensions_string" => 1,
|
|
|
|
"WGL_EXT_swap_control" => 1,
|
|
|
|
"WGL_NV_vertex_array_range" => 1,
|
|
|
|
"WGL_WINE_pixel_format_passthrough" => 1,
|
|
|
|
);
|
|
|
|
|
2013-11-01 18:18:26 +01:00
|
|
|
my %enums = ();
|
|
|
|
|
|
|
|
sub parse_variable($)
|
2012-07-17 00:00:55 +02:00
|
|
|
{
|
2013-11-01 18:18:26 +01:00
|
|
|
my $p = shift;
|
|
|
|
my $ptype = '';
|
|
|
|
my $pname = '';
|
|
|
|
my $pnamebefore = '';
|
|
|
|
my $pnameafter = '';
|
|
|
|
|
2014-01-15 20:47:04 +01:00
|
|
|
while (my ($k, $v) = each(%$p)){
|
2013-11-01 18:18:26 +01:00
|
|
|
if ($k eq 'ptype') {
|
|
|
|
$ptype = ${$v}[0];
|
|
|
|
} elsif ($k eq 'name') {
|
|
|
|
$pname = ${$v}[0];
|
|
|
|
} elsif ($k eq 'content') {
|
|
|
|
if (ref($v) eq 'ARRAY') {
|
|
|
|
my @n = @{$v};
|
|
|
|
$pnamebefore = $n[0];
|
|
|
|
$pnameafter = $n[1] if (@n > 0);
|
2015-01-15 20:00:02 +01:00
|
|
|
} elsif ($v eq 'const ') {
|
|
|
|
$pnamebefore = $v;
|
2013-11-01 18:18:26 +01:00
|
|
|
} else {
|
|
|
|
$pnameafter = $v;
|
2012-07-17 00:00:55 +02:00
|
|
|
}
|
2013-11-01 18:18:26 +01:00
|
|
|
}
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2013-11-01 18:18:26 +01:00
|
|
|
$ptype = $pnamebefore . $ptype . $pnameafter;
|
|
|
|
$ptype =~ s/ \*/\*/g;
|
|
|
|
$ptype =~ s/ $//g;
|
|
|
|
return [ $ptype, $pname ];
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
|
|
|
|
2013-11-01 18:18:26 +01:00
|
|
|
sub parse_file($$)
|
2012-11-07 13:14:58 +01:00
|
|
|
{
|
2013-11-01 18:18:26 +01:00
|
|
|
my ($file, $generate_enums) = @_;
|
|
|
|
my $xml = new XML::Simple;
|
|
|
|
my $data = $xml->XMLin($file, ForceArray => 1);
|
|
|
|
my %functions;
|
|
|
|
|
|
|
|
# save all functions
|
|
|
|
for my $command ( @{${$data->{commands}}[0]->{'command'}} ) {
|
|
|
|
my $name = '';
|
|
|
|
my $ret = '';
|
|
|
|
my $params = [];
|
|
|
|
my @alias = '';
|
2014-01-15 20:47:04 +01:00
|
|
|
while (my ($k, $v) = each(%$command)){
|
2013-11-01 18:18:26 +01:00
|
|
|
if ($k eq 'param') {
|
|
|
|
push(@$params, parse_variable($_)) for (@{$v});
|
|
|
|
} elsif ($k eq 'proto') {
|
|
|
|
($ret, $name) = @{parse_variable(${$v}[0])};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$functions{$name} = [ $ret, $params ];
|
|
|
|
}
|
|
|
|
|
|
|
|
# save all enums (only GL)
|
|
|
|
if ($generate_enums) {
|
|
|
|
for my $enum ( @{$data->{'enums'}} ) {
|
|
|
|
if (ref($enum->{'enum'}) eq "HASH") {
|
2014-01-15 20:47:04 +01:00
|
|
|
while (my ($k, $v) = each(%{$enum->{'enum'}})){
|
2013-11-01 18:18:26 +01:00
|
|
|
$enums{$k} = $v->{'value'};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# generate norm functions
|
2014-01-15 20:47:04 +01:00
|
|
|
while (my ($k, $v) = each(%{$data->{feature}})) {
|
2013-11-01 18:18:26 +01:00
|
|
|
if ($norm_categories{$k}) {
|
|
|
|
for my $req (@{$v->{require}}) {
|
|
|
|
for(keys %{$req->{command}}) {
|
|
|
|
$norm_functions{$_} = $functions{$_};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# generate extension functions from norm functions, if they are newer than the category
|
2014-01-15 20:47:04 +01:00
|
|
|
while (my ($k, $v) = each(%{$data->{feature}})) {
|
2013-11-01 18:18:26 +01:00
|
|
|
if (!$norm_categories{$k} && $v->{api} =~ /^gl(\||$)/)
|
2012-11-07 13:14:58 +01:00
|
|
|
{
|
2013-11-01 18:18:26 +01:00
|
|
|
for my $req (@{$v->{require}}) {
|
|
|
|
for (keys %{$req->{command}}) {
|
|
|
|
if (!$norm_functions{$_}) {
|
|
|
|
$ext_functions{$_} = [ $functions{$_}[0], $functions{$_}[1], [ $k ] ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-07 13:14:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-01 18:18:26 +01:00
|
|
|
# generate extension functions
|
2014-01-15 20:47:04 +01:00
|
|
|
while (my ($k, $v) = each(%{${$data->{extensions}}[0]->{extension}})) {
|
2013-11-01 18:18:26 +01:00
|
|
|
if ($v->{supported} =~ /^gl(\||$)/) {
|
|
|
|
for my $req (@{$v->{require}}) {
|
|
|
|
if (!defined $req->{api} || $req->{api} =~ /^gl(\||$)/) {
|
|
|
|
for (keys %{$req->{command}}) {
|
|
|
|
if (!$ext_functions{$_} && !$norm_functions{$_}) {
|
|
|
|
$ext_functions{$_} = [$functions{$_}[0], $functions{$_}[1], [ $k ]];
|
|
|
|
}
|
|
|
|
elsif ($ext_functions{$_}) {
|
|
|
|
push @{$ext_functions{$_}->[2]}, $k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($v->{supported} =~ /^wgl$/) {
|
|
|
|
for (keys %{${$v->{require}}[0]->{command}}) {
|
|
|
|
if (defined $supported_wgl_extensions{$k}) {
|
|
|
|
$ext_functions{$_} = [ $functions{$_}[0], $functions{$_}[1], [ $k ] ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-06-12 03:21:18 +02:00
|
|
|
|
2013-11-01 18:18:26 +01:00
|
|
|
parse_file( "gl.xml", 1 );
|
|
|
|
parse_file( "wgl.xml", 0 );
|
2012-11-07 13:14:58 +01:00
|
|
|
|
2012-07-16 23:21:53 +02:00
|
|
|
#
|
|
|
|
# Get the current wgl_driver.h version
|
|
|
|
#
|
|
|
|
my $wgl_version = 0;
|
2013-11-01 18:18:05 +01:00
|
|
|
open HEADER, "<$wgl_driver_file" or die "cannot open $wgl_driver_file";
|
2012-07-16 23:21:53 +02:00
|
|
|
while (<HEADER>)
|
|
|
|
{
|
|
|
|
next unless /^#define WINE_WGL_DRIVER_VERSION (\d+)/;
|
|
|
|
$wgl_version = $1;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
close HEADER;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Generate the wgl_driver.h file
|
|
|
|
#
|
2013-11-01 18:18:05 +01:00
|
|
|
open HEADER, ">$wgl_driver_file" or die "cannot create $wgl_driver_file";
|
|
|
|
print HEADER "/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */\n\n";
|
2012-07-16 23:21:53 +02:00
|
|
|
print HEADER "#ifndef __WINE_WGL_DRIVER_H\n";
|
|
|
|
print HEADER "#define __WINE_WGL_DRIVER_H\n\n";
|
|
|
|
print HEADER "#ifndef WINE_GLAPI\n";
|
|
|
|
print HEADER "#define WINE_GLAPI\n";
|
|
|
|
print HEADER "#endif\n\n";
|
|
|
|
|
|
|
|
printf HEADER "#define WINE_WGL_DRIVER_VERSION %u\n\n", $wgl_version + 1;
|
|
|
|
|
2012-07-20 12:25:01 +02:00
|
|
|
print HEADER "struct wgl_context;\n";
|
|
|
|
print HEADER "struct wgl_pbuffer;\n\n";
|
2012-07-18 23:58:41 +02:00
|
|
|
|
2012-07-16 23:21:53 +02:00
|
|
|
print HEADER "struct opengl_funcs\n{\n";
|
2012-07-18 23:58:41 +02:00
|
|
|
print HEADER " struct\n {\n";
|
|
|
|
foreach (sort keys %wgl_functions)
|
|
|
|
{
|
2012-11-07 13:14:58 +01:00
|
|
|
printf HEADER " %s;\n", get_func_proto("(WINE_GLAPI *p_%s)", $_, $wgl_functions{$_});
|
2012-07-18 23:58:41 +02:00
|
|
|
}
|
|
|
|
print HEADER " } wgl;\n\n";
|
|
|
|
|
2012-07-16 23:21:53 +02:00
|
|
|
print HEADER " struct\n {\n";
|
|
|
|
foreach (sort keys %norm_functions)
|
|
|
|
{
|
|
|
|
next if $_ eq "glDebugEntry";
|
2012-11-07 13:14:58 +01:00
|
|
|
printf HEADER " %s;\n", get_func_proto("(WINE_GLAPI *p_%s)", $_, $norm_functions{$_});
|
2012-07-16 23:21:53 +02:00
|
|
|
}
|
|
|
|
print HEADER " } gl;\n\n";
|
|
|
|
|
|
|
|
print HEADER " struct\n {\n";
|
|
|
|
foreach (sort keys %ext_functions)
|
|
|
|
{
|
2012-11-07 13:14:58 +01:00
|
|
|
printf HEADER " %s;\n", get_func_proto("(WINE_GLAPI *p_%s)", $_, $ext_functions{$_});
|
2012-07-16 23:21:53 +02:00
|
|
|
}
|
|
|
|
print HEADER " } ext;\n";
|
|
|
|
print HEADER "};\n\n";
|
|
|
|
|
|
|
|
print HEADER "#define ALL_WGL_FUNCS";
|
|
|
|
foreach (sort keys %norm_functions)
|
|
|
|
{
|
|
|
|
next if $_ eq "glDebugEntry";
|
|
|
|
printf HEADER " \\\n USE_GL_FUNC(\%s)", $_;
|
|
|
|
}
|
|
|
|
print HEADER "\n\n";
|
|
|
|
|
2012-11-05 00:28:51 +01:00
|
|
|
print HEADER "extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );\n";
|
|
|
|
print HEADER "extern BOOL CDECL __wine_set_pixel_format( HWND hwnd, int format );\n\n";
|
2012-07-16 23:21:53 +02:00
|
|
|
print HEADER "#endif /* __WINE_WGL_DRIVER_H */\n";
|
|
|
|
close HEADER;
|
|
|
|
|
2012-11-07 13:14:58 +01:00
|
|
|
#
|
|
|
|
# Generate the wgl.h file
|
|
|
|
#
|
2013-11-01 18:18:05 +01:00
|
|
|
open HEADER, ">$wgl_file" or die "cannot create $wgl_file";
|
|
|
|
print HEADER "/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */\n\n";
|
2012-11-07 13:14:58 +01:00
|
|
|
print HEADER "#ifndef __WINE_WGL_H\n";
|
|
|
|
print HEADER "#define __WINE_WGL_H\n\n";
|
|
|
|
|
|
|
|
print HEADER "#ifndef GLAPIENTRY\n";
|
|
|
|
print HEADER "#define GLAPIENTRY __stdcall\n";
|
|
|
|
print HEADER "#endif\n\n";
|
|
|
|
|
|
|
|
foreach (sort keys %arg_conv)
|
|
|
|
{
|
|
|
|
printf HEADER "typedef %-22s %s;\n", $arg_conv{$_}[1], $_;
|
|
|
|
}
|
|
|
|
print HEADER "\n";
|
|
|
|
|
|
|
|
my $maxlen = 1;
|
|
|
|
foreach (keys %enums) { $maxlen = length($_) if length($_) > $maxlen; }
|
|
|
|
foreach (sort keys %enums)
|
|
|
|
{
|
|
|
|
printf HEADER "#define %-*s %s\n", $maxlen, $_, $enums{$_};
|
|
|
|
}
|
|
|
|
print HEADER "\n";
|
|
|
|
|
|
|
|
foreach (sort keys %norm_functions)
|
|
|
|
{
|
|
|
|
printf HEADER "%s;\n", get_func_proto("GLAPIENTRY %s", $_, $norm_functions{$_});
|
|
|
|
}
|
|
|
|
|
|
|
|
print HEADER "\n#endif /* __WINE_WGL_H */\n";
|
|
|
|
close HEADER;
|
|
|
|
|
2000-06-12 03:21:18 +02:00
|
|
|
#
|
|
|
|
# Now, generate the output files. First, the spec file.
|
|
|
|
#
|
2013-11-01 18:18:26 +01:00
|
|
|
open(SPEC, ">$spec_file") or die "cannot create $spec_file";
|
2000-06-12 03:21:18 +02:00
|
|
|
|
|
|
|
foreach (sort keys %norm_functions) {
|
2012-11-08 13:45:03 +01:00
|
|
|
my $args=" ";
|
2012-07-17 00:00:55 +02:00
|
|
|
for (my $i = 0; $i < @{$norm_functions{$_}->[1]}; $i++) {
|
2013-11-01 18:18:14 +01:00
|
|
|
my $type = $norm_functions{$_}->[1]->[$i]->[0];
|
|
|
|
if ($type =~ /\*/) {
|
|
|
|
$args .= "ptr ";
|
|
|
|
} elsif (defined($arg_conv{$type})) {
|
|
|
|
$args .= "$@$arg_conv{$type}[0] ";
|
|
|
|
} else {
|
|
|
|
die "No conversion for GL type $type...\n";
|
|
|
|
}
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2012-11-08 13:45:03 +01:00
|
|
|
$args = substr($args,1,-1);
|
|
|
|
print SPEC "@ stdcall $_($args)\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2006-12-12 17:59:44 +01:00
|
|
|
|
2012-11-08 13:45:03 +01:00
|
|
|
print SPEC "@ stdcall wglChoosePixelFormat(long ptr)
|
|
|
|
@ stdcall wglCopyContext(long long long)
|
|
|
|
@ stdcall wglCreateContext(long)
|
|
|
|
@ stdcall wglCreateLayerContext(long long)
|
|
|
|
@ stdcall wglDeleteContext(long)
|
|
|
|
@ stdcall wglDescribeLayerPlane(long long long long ptr)
|
|
|
|
@ stdcall wglDescribePixelFormat(long long long ptr)
|
|
|
|
@ stdcall wglGetCurrentContext()
|
|
|
|
@ stdcall wglGetCurrentDC()
|
|
|
|
@ stub wglGetDefaultProcAddress
|
|
|
|
@ stdcall wglGetLayerPaletteEntries(long long long long ptr)
|
|
|
|
@ stdcall wglGetPixelFormat(long)
|
|
|
|
@ stdcall wglGetProcAddress(str)
|
|
|
|
@ stdcall wglMakeCurrent(long long)
|
|
|
|
@ stdcall wglRealizeLayerPalette(long long long)
|
|
|
|
@ stdcall wglSetLayerPaletteEntries(long long long long ptr)
|
|
|
|
@ stdcall wglSetPixelFormat(long long ptr)
|
|
|
|
@ stdcall wglShareLists(long long)
|
|
|
|
@ stdcall wglSwapBuffers(long)
|
|
|
|
@ stdcall wglSwapLayerBuffers(long long)
|
|
|
|
@ stdcall wglUseFontBitmapsA(long long long long)
|
|
|
|
@ stdcall wglUseFontBitmapsW(long long long long)
|
|
|
|
@ stdcall wglUseFontOutlinesA(long long long long long long long ptr)
|
|
|
|
@ stdcall wglUseFontOutlinesW(long long long long long long long ptr)
|
2006-12-12 17:59:44 +01:00
|
|
|
";
|
|
|
|
|
2000-06-12 03:21:18 +02:00
|
|
|
close(SPEC);
|
|
|
|
|
|
|
|
#
|
|
|
|
# After the spec file, the opengl_norm.c file
|
|
|
|
#
|
2013-11-01 18:18:26 +01:00
|
|
|
open(NORM, ">$norm_file") or die "cannot create $norm_file";
|
2000-06-12 03:21:18 +02:00
|
|
|
print NORM "
|
|
|
|
/* Auto-generated file... Do not edit ! */
|
|
|
|
|
|
|
|
#include \"config.h\"
|
2012-07-16 23:34:45 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include \"winternl.h\"
|
2012-07-30 21:53:37 +02:00
|
|
|
#include \"wingdi.h\"
|
2012-11-07 13:15:24 +01:00
|
|
|
#include \"wine/wgl.h\"
|
2012-07-16 23:34:45 +02:00
|
|
|
#include \"wine/wgl_driver.h\"
|
2002-03-20 01:58:40 +01:00
|
|
|
#include \"wine/debug.h\"
|
2000-06-12 03:21:18 +02:00
|
|
|
|
2002-03-20 01:58:40 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(opengl);
|
2000-06-12 03:21:18 +02:00
|
|
|
";
|
|
|
|
|
2012-07-16 23:39:31 +02:00
|
|
|
foreach (sort keys %norm_functions) {
|
2012-07-17 00:00:55 +02:00
|
|
|
my $string = GenerateThunk($_, $norm_functions{$_}, 1, "gl");
|
2006-12-12 17:59:44 +01:00
|
|
|
print NORM "\n$string" if $string;
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
2012-07-16 23:34:45 +02:00
|
|
|
|
2012-07-18 23:58:41 +02:00
|
|
|
foreach (sort keys %wgl_functions) {
|
|
|
|
print NORM generate_null_func($_, $wgl_functions{$_});
|
|
|
|
}
|
2012-07-16 23:34:45 +02:00
|
|
|
foreach (sort keys %norm_functions) {
|
2012-07-17 00:00:55 +02:00
|
|
|
print NORM generate_null_func($_, $norm_functions{$_});
|
2012-07-16 23:34:45 +02:00
|
|
|
}
|
2012-08-23 21:23:09 +02:00
|
|
|
foreach (sort keys %ext_functions) {
|
|
|
|
print NORM generate_null_func($_, $ext_functions{$_});
|
|
|
|
}
|
2012-07-16 23:34:45 +02:00
|
|
|
|
2012-07-18 23:58:41 +02:00
|
|
|
print NORM "\nstruct opengl_funcs null_opengl_funcs =\n{\n {\n";
|
|
|
|
foreach (sort keys %wgl_functions) { print NORM " null_$_,\n"; }
|
2012-08-23 21:23:09 +02:00
|
|
|
print NORM " },\n {\n";
|
|
|
|
foreach (sort keys %norm_functions) { print NORM " null_$_,\n" unless $_ eq "glDebugEntry"; }
|
|
|
|
print NORM " },\n {\n";
|
|
|
|
foreach (sort keys %ext_functions) { print NORM " null_$_,\n"; }
|
|
|
|
print NORM " }\n};\n";
|
2012-07-16 23:34:45 +02:00
|
|
|
|
2000-06-12 03:21:18 +02:00
|
|
|
close(NORM);
|
|
|
|
|
|
|
|
#
|
|
|
|
# Finally, more complex, the opengl_ext.c file
|
|
|
|
#
|
2013-11-01 18:18:26 +01:00
|
|
|
open(EXT, ">$ext_file") or die "cannot create $ext_file";
|
2000-06-12 03:21:18 +02:00
|
|
|
print EXT "
|
|
|
|
/* Auto-generated file... Do not edit ! */
|
|
|
|
|
|
|
|
#include \"config.h\"
|
2012-07-18 13:07:08 +02:00
|
|
|
#include <stdarg.h>
|
2002-09-25 02:29:56 +02:00
|
|
|
#include \"opengl_ext.h\"
|
2012-07-18 13:07:08 +02:00
|
|
|
#include \"winternl.h\"
|
2012-07-30 21:53:37 +02:00
|
|
|
#include \"wingdi.h\"
|
2012-11-07 13:15:24 +01:00
|
|
|
#include \"wine/wgl.h\"
|
2012-07-17 00:00:55 +02:00
|
|
|
#define WGL_WGLEXT_PROTOTYPES
|
|
|
|
#include \"wine/wglext.h\"
|
2012-07-18 13:07:08 +02:00
|
|
|
#include \"wine/wgl_driver.h\"
|
2002-03-20 01:58:40 +01:00
|
|
|
#include \"wine/debug.h\"
|
2000-06-12 03:21:18 +02:00
|
|
|
|
2002-03-20 01:58:40 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(opengl);
|
2001-03-04 02:05:20 +01:00
|
|
|
|
2000-06-12 03:21:18 +02:00
|
|
|
";
|
|
|
|
|
2006-06-09 18:13:09 +02:00
|
|
|
# The thunks themselves....
|
|
|
|
my $count = keys %ext_functions;
|
2012-07-18 13:07:08 +02:00
|
|
|
print EXT "const int extension_registry_size = $count;\n";
|
2000-06-12 03:21:18 +02:00
|
|
|
foreach (sort keys %ext_functions) {
|
2012-07-17 00:00:55 +02:00
|
|
|
my $string = GenerateThunk($_, $ext_functions{$_}, 0, "ext");
|
2015-02-10 20:13:44 +01:00
|
|
|
if ($string =~ /DECLSPEC_HIDDEN/) {
|
|
|
|
print EXT "\n$string";
|
|
|
|
} else {
|
|
|
|
print EXT "\nstatic $string" if $string;
|
|
|
|
}
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
|
|
|
|
2007-12-07 21:01:34 +01:00
|
|
|
# Then the table giving the string <-> function correspondence */
|
2012-07-17 00:00:55 +02:00
|
|
|
print EXT "\nconst OpenGL_extension extension_registry[$count] = {\n";
|
2005-05-20 20:58:10 +02:00
|
|
|
my $i = 0;
|
2000-06-12 03:21:18 +02:00
|
|
|
foreach (sort keys %ext_functions) {
|
2005-05-20 20:58:10 +02:00
|
|
|
my $func_ref = $ext_functions{$_};
|
2013-11-01 18:18:26 +01:00
|
|
|
printf EXT " { \"%s\", \"%s\", %s }", $_, join(" ", sort @{$func_ref->[2]}), $_;
|
2006-06-09 18:13:09 +02:00
|
|
|
if ($i != $count-1) {
|
2013-11-01 18:18:14 +01:00
|
|
|
print EXT ",";
|
2000-06-12 03:21:18 +02:00
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
print EXT "\n";
|
|
|
|
}
|
|
|
|
print EXT "};\n";
|
|
|
|
|
|
|
|
close(EXT);
|