From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 73 +++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 22 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 09531731f8d..ba1f5d7231a 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -171,41 +171,70 @@ sub ConvertType($) return $ret; }
-# -# This functions generates the thunk for a given function. -# -sub GenerateThunk($$$) +sub get_func_trace($$) { - my ($name, $func_ref, $prefix) = @_; - my $call_arg = ""; - my $trace_call_arg = ""; + my ($name, $func) = @_; + my $trace_fmt = ""; my $trace_arg = ""; - - my $ret = get_func_proto( "%s WINAPI %s(%s)", $name, $func_ref, 0 ); - foreach my $arg (@{$func_ref->[1]}) { + foreach my $arg (@{$func->[1]}) + { my $ptype = get_arg_type( $arg ); my $pname = get_arg_name( $arg ); my $param = $arg->textContent(); - $call_arg .= " " . $pname . ","; - if ($param =~ /*/ || $param =~ /[/) { - $trace_arg .= ", %p"; - $trace_call_arg .= ", " . $pname; - } elsif (defined $arg_types{$ptype}) { + if ($param =~ /*/ || $param =~ /[/) + { + $trace_fmt .= ", %p"; + $trace_arg .= ", $pname"; + } + elsif (defined $arg_types{$ptype}) + { my $format = ${$arg_types{$ptype}}[1]; - $trace_arg .= ", " . ($format =~ /^%/ ? $format : "%s"); - $trace_call_arg .= ", " . sprintf $format =~ /^%/ ? "%s" : $format, $pname; + $trace_fmt .= ", " . ($format =~ /^%/ ? $format : "%s"); + $trace_arg .= ", " . (sprintf $format =~ /^%/ ? "%s" : $format, $pname); } else { printf "Unknown type %s in %s\n", $param, $name; } } - $call_arg =~ s/,$/ /; - $trace_arg =~ s/^, //; + $trace_fmt =~ s/^, //; + return "TRACE( "($trace_fmt)\n"$trace_arg );\n"; +} + +sub get_func_args($$$) +{ + my ($func, $decl_args, $convert_args) = @_; + my $ret = ""; + foreach my $arg (@{$func->[1]}) + { + my $pname = get_arg_name( $arg ); + if ($decl_args) + { + $ret .= " " . ($convert_args ? ConvertType( $arg ) : $arg->textContent()) . ","; + } + else + { + $ret .= " $pname,"; + } + } + $ret =~ s/,$/ /; + $ret ||= "void" if $decl_args; + return $ret; +} + +# +# This functions generates the thunk for a given function. +# +sub GenerateThunk($$$) +{ + my ($name, $func_ref, $prefix) = @_; + my $call_args = get_func_args( $func_ref, 0, 0 ); + + my $ret = get_func_proto( "%s WINAPI %s(%s)", $name, $func_ref, 0 ); $ret .= "\n{\n"; # special case for functions that take an HDC as first parameter if (@{$func_ref->[1]} && get_arg_type( ${$func_ref->[1]}[0] ) eq "HDC") { my $pname = get_arg_name( ${$func_ref->[1]}[0] ); $ret .= " const struct opengl_funcs *funcs = get_dc_funcs( $pname );\n"; - $ret .= " TRACE( "($trace_arg)\n"$trace_call_arg );\n" if $gen_traces; + $ret .= " " . get_func_trace( $name, $func_ref ) if $gen_traces; $ret .= " if (!funcs || !funcs->$prefix.p_$name) return"; $ret .= " 0" unless is_void_func( $func_ref ); $ret .= ";\n"; @@ -213,11 +242,11 @@ sub GenerateThunk($$$) else { $ret .= " const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;\n"; - $ret .= " TRACE( "($trace_arg)\n"$trace_call_arg );\n" if $gen_traces; + $ret .= " " . get_func_trace( $name, $func_ref ) if $gen_traces; } $ret .= " "; $ret .= "return " unless is_void_func( $func_ref ); - $ret .= "funcs->$prefix.p_$name($call_arg);\n"; + $ret .= "funcs->$prefix.p_$name($call_args);\n"; $ret .= "}\n\n"; return $ret; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index ba1f5d7231a..fd02aceafb8 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -224,28 +224,28 @@ sub get_func_args($$$) # sub GenerateThunk($$$) { - my ($name, $func_ref, $prefix) = @_; - my $call_args = get_func_args( $func_ref, 0, 0 ); + my ($name, $func, $prefix) = @_; + my $call_args = get_func_args( $func, 0, 0 );
- my $ret = get_func_proto( "%s WINAPI %s(%s)", $name, $func_ref, 0 ); + my $ret = get_func_proto( "%s WINAPI %s(%s)", $name, $func, 0 ); $ret .= "\n{\n"; # special case for functions that take an HDC as first parameter - if (@{$func_ref->[1]} && get_arg_type( ${$func_ref->[1]}[0] ) eq "HDC") + if (@{$func->[1]} && get_arg_type( ${$func->[1]}[0] ) eq "HDC") { - my $pname = get_arg_name( ${$func_ref->[1]}[0] ); + my $pname = get_arg_name( ${$func->[1]}[0] ); $ret .= " const struct opengl_funcs *funcs = get_dc_funcs( $pname );\n"; - $ret .= " " . get_func_trace( $name, $func_ref ) if $gen_traces; + $ret .= " " . get_func_trace( $name, $func ) if $gen_traces; $ret .= " if (!funcs || !funcs->$prefix.p_$name) return"; - $ret .= " 0" unless is_void_func( $func_ref ); + $ret .= " 0" unless is_void_func( $func ); $ret .= ";\n"; } else { $ret .= " const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;\n"; - $ret .= " " . get_func_trace( $name, $func_ref ) if $gen_traces; + $ret .= " " . get_func_trace( $name, $func ) if $gen_traces; } $ret .= " "; - $ret .= "return " unless is_void_func( $func_ref ); + $ret .= "return " unless is_void_func( $func ); $ret .= "funcs->$prefix.p_$name($call_args);\n"; $ret .= "}\n\n"; return $ret; @@ -253,18 +253,18 @@ sub GenerateThunk($$$)
sub generate_null_func($$$) { - my ($name, $func_ref, $callconv) = @_; + my ($name, $func, $callconv) = @_; my $ret;
return "" if $name eq "glDebugEntry";
- $ret = get_func_proto( "static %s$callconv null_%s(%s)", $name, $func_ref, 1 ); + $ret = get_func_proto( "static %s$callconv null_%s(%s)", $name, $func, 1 ); $ret .= " {"; if ($name eq "glGetError") { $ret .= " return GL_INVALID_OPERATION;"; } - elsif (!is_void_func( $func_ref )) + elsif (!is_void_func( $func )) { $ret .= " return 0;"; } @@ -800,8 +800,8 @@ print EXT $wrappers; print EXT "\nconst OpenGL_extension extension_registry[$count] = {\n"; my $i = 0; foreach (sort keys %ext_functions) { - my $func_ref = $ext_functions{$_}; - printf EXT " { "%s", "%s", %s }", $_, join(" ", sort @{$func_ref->[2]}), $_; + my $func = $ext_functions{$_}; + printf EXT " { "%s", "%s", %s }", $_, join(" ", sort @{$func->[2]}), $_; if ($i != $count-1) { print EXT ","; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 55 ++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 24 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index fd02aceafb8..d836118a14d 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -219,6 +219,14 @@ sub get_func_args($$$) return $ret; }
+sub get_func_ret($$) +{ + my ($func, $convert_args) = @_; + my $ret = $convert_args ? ConvertType( $func->[0] ) : $func->[0]->textContent(); + $ret =~ s/ $//; + return $ret; +} + # # This functions generates the thunk for a given function. # @@ -226,8 +234,11 @@ sub GenerateThunk($$$) { my ($name, $func, $prefix) = @_; my $call_args = get_func_args( $func, 0, 0 ); + my $decl_args = get_func_args( $func, 1, 0 ); + my $func_ret = get_func_ret( $func, 0 ); + my $ret = "";
- my $ret = get_func_proto( "%s WINAPI %s(%s)", $name, $func, 0 ); + $ret .= "$func_ret WINAPI $name($decl_args)"; $ret .= "\n{\n"; # special case for functions that take an HDC as first parameter if (@{$func->[1]} && get_arg_type( ${$func->[1]}[0] ) eq "HDC") @@ -254,11 +265,13 @@ sub GenerateThunk($$$) sub generate_null_func($$$) { my ($name, $func, $callconv) = @_; - my $ret; + my $decl_args = get_func_args( $func, 1, 1 ); + my $func_ret = get_func_ret( $func, 1 ); + my $ret = "";
return "" if $name eq "glDebugEntry";
- $ret = get_func_proto( "static %s$callconv null_%s(%s)", $name, $func, 1 ); + $ret .= "static $func_ret$callconv null_$name($decl_args)"; $ret .= " {"; if ($name eq "glGetError") { @@ -313,22 +326,6 @@ sub get_arg_name($) return $name[0]->textContent(); }
-sub get_func_proto($$$$) -{ - my ($format, $name, $func, $convert_args) = @_; - die "unknown func $name" unless defined $func->[0]; - my $proto = $convert_args ? ConvertType( $func->[0] ) : $func->[0]->textContent(); - $proto =~ s/ $//; - my $args = ""; - foreach my $arg (@{$func->[1]}) - { - $args .= " " . ($convert_args ? ConvertType( $arg ) : $arg->textContent()) . ","; - } - $args =~ s/,$/ /; - $args ||= "void"; - return sprintf $format, $proto, $name, $args; -} - # # Extract and checks the number of arguments # @@ -646,7 +643,9 @@ print HEADER " struct\n {\n"; foreach (sort keys %wgl_functions) { next unless defined $supported_wgl_functions{$_}; - print HEADER get_func_proto(" %-10s (WINAPI *p_%s)(%s);\n", $_, $wgl_functions{$_}, 1); + my $decl_args = get_func_args( $wgl_functions{$_}, 1, 1 ); + my $func_ret = get_func_ret( $wgl_functions{$_}, 1 ); + printf HEADER " %-10s (WINAPI *p_$_)($decl_args);\n", $func_ret; } print HEADER " } wgl;\n\n";
@@ -654,14 +653,18 @@ print HEADER " struct\n {\n"; foreach (sort keys %norm_functions) { next if $_ eq "glDebugEntry"; - print HEADER get_func_proto(" %-10s (WINE_GLAPI *p_%s)(%s);\n", $_, $norm_functions{$_}, 1); + my $decl_args = get_func_args( $norm_functions{$_}, 1, 1 ); + my $func_ret = get_func_ret( $norm_functions{$_}, 1 ); + printf HEADER " %-10s (WINE_GLAPI *p_$_)($decl_args);\n", $func_ret; } print HEADER " } gl;\n\n";
print HEADER " struct\n {\n"; foreach (sort keys %ext_functions) { - print HEADER get_func_proto(" %-10s (WINE_GLAPI *p_%s)(%s);\n", $_, $ext_functions{$_}, 1); + my $decl_args = get_func_args( $ext_functions{$_}, 1, 1 ); + my $func_ret = get_func_ret( $ext_functions{$_}, 1 ); + printf HEADER " %-10s (WINE_GLAPI *p_$_)($decl_args);\n", $func_ret; } print HEADER " } ext;\n"; print HEADER "};\n\n"; @@ -708,7 +711,9 @@ print HEADER "\n";
foreach (sort keys %norm_functions) { - printf HEADER "%s;\n", get_func_proto("%-10s GLAPIENTRY %s(%s)", $_, $norm_functions{$_}, 0); + my $decl_args = get_func_args( $norm_functions{$_}, 1, 0 ); + my $func_ret = get_func_ret( $norm_functions{$_}, 0 ); + printf HEADER "%-10s GLAPIENTRY $_($decl_args);\n", $func_ret; }
print HEADER "\n#endif /* __WINE_WGL_H */\n"; @@ -787,7 +792,9 @@ print EXT "const int extension_registry_size = $count;\n\n"; foreach (sort keys %ext_functions) { if (needs_wrapper( $_, $ext_functions{$_} )) { - $wrappers .= get_func_proto("extern %s WINAPI %s(%s) DECLSPEC_HIDDEN;\n", $_, $ext_functions{$_}, 0); + my $decl_args = get_func_args( $ext_functions{$_}, 1, 0 ); + my $func_ret = get_func_ret( $ext_functions{$_}, 0 ); + $wrappers .= "extern $func_ret WINAPI $_($decl_args) DECLSPEC_HIDDEN;\n"; } else {
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/opengl32/make_opengl | 71 ++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 24 deletions(-)
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index d836118a14d..cb6882b3774 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -381,18 +381,23 @@ my %wgl_functions; my %gl_enums; my (%gl_types, @gl_types); # also use an array to preserve declaration order
-my %supported_wgl_functions = +my %manual_win_functions = ( - "wglCopyContext" => 1, - "wglCreateContext" => 1, - "wglDeleteContext" => 1, - "wglDescribePixelFormat" => 1, - "wglGetPixelFormat" => 1, - "wglGetProcAddress" => 1, - "wglMakeCurrent" => 1, - "wglSetPixelFormat" => 1, - "wglShareLists" => 1, - "wglSwapBuffers" => 1, + "glDebugEntry" => 1, + "wglChoosePixelFormat" => 1, + "wglCreateLayerContext" => 1, + "wglDescribeLayerPlane" => 1, + "wglGetCurrentContext" => 1, + "wglGetCurrentDC" => 1, + "wglGetDefaultProcAddress" => 1, + "wglGetLayerPaletteEntries" => 1, + "wglRealizeLayerPalette" => 1, + "wglSetLayerPaletteEntries" => 1, + "wglSwapLayerBuffers" => 1, + "wglUseFontBitmapsA" => 1, + "wglUseFontBitmapsW" => 1, + "wglUseFontOutlinesA" => 1, + "wglUseFontOutlinesW" => 1, );
my %remapped_wgl_functions = @@ -642,7 +647,7 @@ print HEADER "struct opengl_funcs\n{\n"; print HEADER " struct\n {\n"; foreach (sort keys %wgl_functions) { - next unless defined $supported_wgl_functions{$_}; + next if defined $manual_win_functions{$_}; my $decl_args = get_func_args( $wgl_functions{$_}, 1, 1 ); my $func_ret = get_func_ret( $wgl_functions{$_}, 1 ); printf HEADER " %-10s (WINAPI *p_$_)($decl_args);\n", $func_ret; @@ -652,7 +657,7 @@ print HEADER " } wgl;\n\n"; print HEADER " struct\n {\n"; foreach (sort keys %norm_functions) { - next if $_ eq "glDebugEntry"; + next if defined $manual_win_functions{$_}; my $decl_args = get_func_args( $norm_functions{$_}, 1, 1 ); my $func_ret = get_func_ret( $norm_functions{$_}, 1 ); printf HEADER " %-10s (WINE_GLAPI *p_$_)($decl_args);\n", $func_ret; @@ -662,6 +667,7 @@ print HEADER " } gl;\n\n"; print HEADER " struct\n {\n"; foreach (sort keys %ext_functions) { + next if defined $manual_win_functions{$_}; my $decl_args = get_func_args( $ext_functions{$_}, 1, 1 ); my $func_ret = get_func_ret( $ext_functions{$_}, 1 ); printf HEADER " %-10s (WINE_GLAPI *p_$_)($decl_args);\n", $func_ret; @@ -672,7 +678,7 @@ print HEADER "};\n\n"; print HEADER "#define ALL_WGL_FUNCS"; foreach (sort keys %norm_functions) { - next if $_ eq "glDebugEntry"; + next if defined $manual_win_functions{$_}; printf HEADER " \\n USE_GL_FUNC(%s)", $_; } print HEADER "\n\n"; @@ -724,10 +730,12 @@ close HEADER; # open(SPEC, ">$spec_file") or die "cannot create $spec_file";
-foreach (sort keys %norm_functions) { +foreach (sort keys %norm_functions) +{ printf SPEC "%s\n", generate_spec_entry( $_, $norm_functions{$_} ); } -foreach (sort keys %wgl_functions) { +foreach (sort keys %wgl_functions) +{ printf SPEC "%s\n", generate_spec_entry( $_, $wgl_functions{$_} ); }
@@ -749,32 +757,47 @@ $file_header .= "WINE_DEFAULT_DEBUG_CHANNEL(opengl);\n\n" if $gen_traces; open(NORM, ">$norm_file") or die "cannot create $norm_file"; print NORM $file_header;
-foreach (sort keys %norm_functions) { +foreach (sort keys %norm_functions) +{ + next if defined $manual_win_functions{$_}; next if needs_wrapper( $_, $norm_functions{$_} ); print NORM GenerateThunk($_, $norm_functions{$_}, "gl"); }
-foreach (sort keys %wgl_functions) { - next unless defined $supported_wgl_functions{$_}; +foreach (sort keys %wgl_functions) +{ + next if defined $manual_win_functions{$_}; print NORM generate_null_func($_, $wgl_functions{$_}, " WINAPI"); } -foreach (sort keys %norm_functions) { +foreach (sort keys %norm_functions) +{ + next if defined $manual_win_functions{$_}; print NORM generate_null_func($_, $norm_functions{$_}, ""); } -foreach (sort keys %ext_functions) { +foreach (sort keys %ext_functions) +{ + next if defined $manual_win_functions{$_}; print NORM generate_null_func($_, $ext_functions{$_}, ""); }
print NORM "\nstruct opengl_funcs null_opengl_funcs =\n{\n {\n"; foreach (sort keys %wgl_functions) { - next unless defined $supported_wgl_functions{$_}; + next if defined $manual_win_functions{$_}; print NORM " null_$_,\n"; } print NORM " },\n {\n"; -foreach (sort keys %norm_functions) { print NORM " null_$_,\n" unless $_ eq "glDebugEntry"; } +foreach (sort keys %norm_functions) +{ + next if defined $manual_win_functions{$_}; + print NORM " null_$_,\n"; +} print NORM " },\n {\n"; -foreach (sort keys %ext_functions) { print NORM " null_$_,\n"; } +foreach (sort keys %ext_functions) +{ + next if defined $manual_win_functions{$_}; + print NORM " null_$_,\n"; +} print NORM " }\n};\n";
close(NORM);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=124945
Your paranoid android.
=== debian11 (32 bit report) ===
ddraw: ddraw1.c:14319: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw1.c:14333: Test failed: Expect clip rect (0,0)-(640,480), got (0,0)-(1664,737). ddraw1.c:14343: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw2.c:15302: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw2.c:15316: Test failed: Expect clip rect (0,0)-(640,480), got (0,0)-(1664,737). ddraw2.c:15326: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw4.c:18352: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw4.c:18366: Test failed: Expect clip rect (0,0)-(640,480), got (0,0)-(1664,737). ddraw4.c:18376: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw7.c:18619: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737). ddraw7.c:18633: Test failed: Expect clip rect (0,0)-(640,480), got (0,0)-(1664,737). ddraw7.c:18643: Test failed: Expect clip rect (0,0)-(1024,737), got (0,0)-(2048,737).
=== debian11 (build log) ===
Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24856. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24856. Use of uninitialized value $Flaky in addition (+) at /home/testbot/lib/WineTestBot/LogUtils.pm line 720, <$LogFile> line 24856.