opengl32: Ensure extension tables generated by make_opengl contain earliest GL_VERSION for each function.

Matteo Bruni matteo.mystral at gmail.com
Mon Feb 15 09:14:44 CST 2016


2016-02-13 0:21 GMT+01:00 Sebastian Lackner <sebastian at fds-team.de>:
> Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
> ---
>
> A couple of functions (glBindBufferBase, glBindBufferRange, glGetIntegeri_v) are listed
> in multiple feature levels. The current implementation of ./make_opengl does not handle
> this correctly, so depending on the order of elements in the hash table, a different
> GL_VERSION_* string is added to the extension registry. Spotted by accident when I noticed
> that the output changes each time I regenerate OpenGL files. ;)
>
> The good news: Luckily the hash tables were sorted "correctly" when Matteo bumped the
> version the last time, so the version in the Wine source tree is fine.

Actually at the time there was only one version token listed for those
functions. This weird thing with two functions (not sure why both 3.0
and 3.1 are specified) appeared in the XML shortly after our latest
update IIRC.

>
> If some perl experts out there know a better way to fix it, or if I'm violating any perl
> style rules I'm not aware of, feel free to send an improved version. ;)
>
>  dlls/opengl32/make_opengl |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl
> index 2b15f58..ec782ed 100755
> --- a/dlls/opengl32/make_opengl
> +++ b/dlls/opengl32/make_opengl
> @@ -692,12 +692,14 @@ sub parse_file($$)
>      }
>
>      # generate extension functions from norm functions, if they are newer than the category
> -    while (my ($k, $v) = each(%{$data->{feature}})) {
> +    my %features = %{$data->{feature}};
> +    foreach (sort keys %features) {
> +        my ($k, $v) = %features{$_};
>          if (!$norm_categories{$k} && $v->{api} =~ /^gl(\||$)/)
>          {
>              for my $req (@{$v->{require}}) {
>                  for (keys %{$req->{command}}) {
> -                    if (!$norm_functions{$_}) {
> +                    if (!$ext_functions{$_} && !$norm_functions{$_}) {
>                          $ext_functions{$_} = [ $functions{$_}[0], $functions{$_}[1], [ $k ] ];
>                      }
>                  }
> --
> 2.7.1

I'm not a perl expert by any means but I guess it's fine. BTW I had
tackled this in a slightly different way:

diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl
index 2b15f58..64e3bc6 100755
--- a/dlls/opengl32/make_opengl
+++ b/dlls/opengl32/make_opengl
@@ -698,7 +698,12 @@ sub parse_file($$)
             for my $req (@{$v->{require}}) {
                 for (keys %{$req->{command}}) {
                     if (!$norm_functions{$_}) {
-                        $ext_functions{$_} = [ $functions{$_}[0],
$functions{$_}[1], [ $k ] ];
+                        if (!$ext_functions{$_}) {
+                            $ext_functions{$_} = [ $functions{$_}[0],
$functions{$_}[1], [ $k ] ];
+                        }
+                        else {
+                            push @{$ext_functions{$_}->[2]}, $k;
+                        }
                     }
                 }
             }

I.e. store all the versions in the table. I guess your version is a
bit better in that it avoids multiple version tokens.

AFAICS there is another problem with make_opengl and the current XML
files though: type GLint64 is not handled and that breaks the traces
inside the wrapper functions. That's trivially fixed by adding an
entry for GLint64 in the %debug_conv array.

FWIW I didn't send my version of the patch at the time I wrote it
because I had in mind to send it together with a fix for bug 38402. Of
course I never got around to complete it and well... I had a very
quick look at your fix for that bug and it looks okay, thank you.



More information about the wine-devel mailing list