From: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/opengl32/make_opengl | 17 +++++++++++++++++ dlls/opengl32/unix_thunks.c | 13 +++++++++++++ dlls/opengl32/wgl.c | 10 ++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index 76c7eec1636..7d3431644dc 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -710,6 +710,10 @@ sub generate_null_func($$) $ret .= "static $func_ret null_$name($decl_args)\n"; $ret .= "{\n"; $ret .= " WARN( \"unsupported\\n\" );\n"; + if ($name eq "wglGetPixelFormat") + { + $ret .= " RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT );\n"; + } if ($name eq "glGetError") { $ret .= " return GL_INVALID_OPERATION;\n"; @@ -1585,6 +1589,17 @@ foreach (sort keys %wgl_functions) next if defined $manual_win_functions{$_}; print OUT generate_null_func($_, $wgl_functions{$_}); } + +printf OUT "static BOOL null_wgl_context_reset( struct wgl_context *context, HDC hdc, struct wgl_context *share, const int *attribs )\n"; +printf OUT "{\n"; +printf OUT " WARN( \"unsupported\\n\" );\n"; +printf OUT " return FALSE;\n"; +printf OUT "}\n"; +printf OUT "static BOOL null_wgl_context_flush( struct wgl_context *context, void (*flush)(void), BOOL force_swap )\n"; +printf OUT "{\n"; +printf OUT " WARN( \"unsupported\\n\" );\n"; +printf OUT " return FALSE;\n"; +printf OUT "}\n"; printf OUT "static void null_get_pixel_formats( struct wgl_pixel_format *formats, UINT max_formats,\n"; printf OUT " UINT *num_formats, UINT *num_onscreen_formats )\n"; printf OUT "{\n"; @@ -1600,6 +1615,8 @@ print OUT "\n"; print OUT "struct opengl_funcs null_opengl_funcs =\n"; print OUT "{\n"; +print OUT " .p_wgl_context_reset = null_wgl_context_reset,\n"; +print OUT " .p_wgl_context_flush = null_wgl_context_flush,\n"; print OUT " .p_get_pixel_formats = null_get_pixel_formats,\n"; foreach (sort keys %wgl_functions) { diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 4018360e5cf..4b62fd00e29 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -83833,6 +83833,7 @@ static BOOL null_wglDeleteContext( struct wgl_context * oldContext ) static int null_wglGetPixelFormat( HDC hdc ) { WARN( "unsupported\n" ); + RtlSetLastWin32Error( ERROR_INVALID_PIXEL_FORMAT ); return 0; } static PROC null_wglGetProcAddress( LPCSTR lpszProc ) @@ -83860,6 +83861,16 @@ static BOOL null_wglSwapBuffers( HDC hdc ) WARN( "unsupported\n" ); return 0; } +static BOOL null_wgl_context_reset( struct wgl_context *context, HDC hdc, struct wgl_context *share, const int *attribs ) +{ + WARN( "unsupported\n" ); + return FALSE; +} +static BOOL null_wgl_context_flush( struct wgl_context *context, void (*flush)(void), BOOL force_swap ) +{ + WARN( "unsupported\n" ); + return FALSE; +} static void null_get_pixel_formats( struct wgl_pixel_format *formats, UINT max_formats, UINT *num_formats, UINT *num_onscreen_formats ) { @@ -85221,6 +85232,8 @@ static void null_glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) struct opengl_funcs null_opengl_funcs = { + .p_wgl_context_reset = null_wgl_context_reset, + .p_wgl_context_flush = null_wgl_context_flush, .p_get_pixel_formats = null_get_pixel_formats, .p_wglCopyContext = null_wglCopyContext, .p_wglCreateContext = null_wglCreateContext, diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 2187162658a..ceac83c4c7f 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -338,6 +338,13 @@ static struct wgl_pixel_format *get_pixel_formats( HDC hdc, UINT *num_formats, NTSTATUS status; DWORD is_memdc; + *num_formats = *num_onscreen_formats = 0; + if (!NtGdiGetDCDword( hdc, NtGdiIsMemDC, &is_memdc )) + { + SetLastError( ERROR_INVALID_HANDLE ); + return NULL; + } + if (glReserved[WINE_GL_RESERVED_FORMATS_HDC] == hdc) { *num_formats = PtrToUlong( glReserved[WINE_GL_RESERVED_FORMATS_NUM] ); @@ -352,8 +359,7 @@ static struct wgl_pixel_format *get_pixel_formats( HDC hdc, UINT *num_formats, args.max_formats = args.num_formats; if ((status = UNIX_CALL( get_pixel_formats, &args ))) goto error; - if (NtGdiGetDCDword( hdc, NtGdiIsMemDC, &is_memdc ) && is_memdc) - args.num_onscreen_formats = args.num_formats; + if (is_memdc) args.num_onscreen_formats = args.num_formats; *num_formats = args.num_formats; *num_onscreen_formats = args.num_onscreen_formats; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9661