[PATCH 0/2] MR9860: opengl32: Present on flush only when rendering to the front buffer.
From: Rémi Bernon <rbernon@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59190 --- dlls/opengl32/make_opengl | 2 +- dlls/opengl32/unix_thunks.c | 2 +- dlls/opengl32/unix_wgl.c | 5 +++-- dlls/win32u/opengl.c | 11 +++++------ include/wine/opengl_driver.h | 3 ++- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl index caab4b9903c..e44e7297e8a 100755 --- a/dlls/opengl32/make_opengl +++ b/dlls/opengl32/make_opengl @@ -1609,7 +1609,7 @@ 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 "static BOOL null_wgl_context_flush( struct wgl_context *context, void (*flush)(void), UINT flags )\n"; printf OUT "{\n"; printf OUT " WARN( \"unsupported\\n\" );\n"; printf OUT " return FALSE;\n"; diff --git a/dlls/opengl32/unix_thunks.c b/dlls/opengl32/unix_thunks.c index 5e1f6f4c2e2..cac9ef8d999 100644 --- a/dlls/opengl32/unix_thunks.c +++ b/dlls/opengl32/unix_thunks.c @@ -90023,7 +90023,7 @@ static BOOL null_wgl_context_reset( struct wgl_context *context, HDC hdc, struct WARN( "unsupported\n" ); return FALSE; } -static BOOL null_wgl_context_flush( struct wgl_context *context, void (*flush)(void), BOOL force_swap ) +static BOOL null_wgl_context_flush( struct wgl_context *context, void (*flush)(void), UINT flags ) { WARN( "unsupported\n" ); return FALSE; diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index 4ad5218f19b..f7979f2666f 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1446,14 +1446,15 @@ static void flush_context( TEB *teb, void (*flush)(void) ) const struct opengl_funcs *funcs = teb->glTable; BOOL force_swap = flush && ctx && !ctx->draw_fbo && context_draws_front( ctx ) && draw->buffer_map[0] == GL_BACK_LEFT && draw->client; + UINT flags = force_swap ? GL_FLUSH_FORCE_SWAP : 0; - if (!ctx || !funcs->p_wgl_context_flush( &ctx->base, flush, force_swap )) + if (!ctx || !funcs->p_wgl_context_flush( &ctx->base, flush, flags )) { /* default implementation: call the functions directly */ if (flush) flush(); } - if (force_swap) + if (flags & GL_FLUSH_FORCE_SWAP) { GLenum mask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; RECT rect; diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 2b185e1aefd..2f7c276adfc 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -2265,27 +2265,26 @@ static BOOL flush_memory_pbuffer( void (*flush)(void) ) return flush_memory_dc( context, draw_hdc, FALSE, flush ); } -static BOOL win32u_wgl_context_flush( struct wgl_context *context, void (*flush)(void), BOOL force_swap ) +static BOOL win32u_wgl_context_flush( struct wgl_context *context, void (*flush)(void), UINT flags ) { const struct opengl_funcs *funcs = &display_funcs; struct opengl_drawable *draw = context->draw; - UINT flags = 0; int interval; if (!draw->client) return flush_memory_pbuffer( flush ); interval = get_window_swap_interval( draw->client->hwnd ); - if (force_swap) interval = 0; + if (flags & GL_FLUSH_FORCE_SWAP) interval = 0; - TRACE( "context %p, hwnd %p, interval %d, flush %p\n", context, draw->client->hwnd, interval, flush ); + TRACE( "context %p, hwnd %p, interval %d, flush %p, flags %#x\n", context, draw->client->hwnd, interval, flush, flags ); context_sync_drawables( context, 0, 0 ); if (!(draw = context->draw)) return FALSE; /* should never happen */ if (flush) flush(); if (flush == funcs->p_glFinish) flags |= GL_FLUSH_FINISHED; - if (flush && !force_swap) flags |= GL_FLUSH_PRESENT; + if (flush && !(flags & GL_FLUSH_FORCE_SWAP)) flags |= GL_FLUSH_PRESENT; opengl_drawable_flush( draw, interval, flags ); - if (force_swap) opengl_drawable_swap( draw ); + if (flags & GL_FLUSH_FORCE_SWAP) opengl_drawable_swap( draw ); return TRUE; } diff --git a/include/wine/opengl_driver.h b/include/wine/opengl_driver.h index 40b6224141d..02d5d138135 100644 --- a/include/wine/opengl_driver.h +++ b/include/wine/opengl_driver.h @@ -84,7 +84,7 @@ struct wgl_context struct opengl_funcs { BOOL (*p_wgl_context_reset)( struct wgl_context *context, HDC hdc, struct wgl_context *share, const int *attribs ); - BOOL (*p_wgl_context_flush)( struct wgl_context *context, void (*flush)(void), BOOL force_swap ); + BOOL (*p_wgl_context_flush)( struct wgl_context *context, void (*flush)(void), UINT flags ); BOOL (*p_wglCopyContext)( struct wgl_context * hglrcSrc, struct wgl_context * hglrcDst, UINT mask ); struct wgl_context * (*p_wglCreateContext)( HDC hDc ); BOOL (*p_wglDeleteContext)( struct wgl_context * oldContext ); @@ -176,6 +176,7 @@ struct opengl_drawable_funcs #define GL_FLUSH_INTERVAL 0x02 #define GL_FLUSH_UPDATED 0x04 #define GL_FLUSH_PRESENT 0x08 +#define GL_FLUSH_FORCE_SWAP 0x10 /* a driver opengl drawable, either a client surface of a pbuffer */ struct opengl_drawable -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9860
From: Rémi Bernon <rbernon@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59190 --- dlls/opengl32/unix_wgl.c | 7 ++++--- dlls/win32u/opengl.c | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/opengl32/unix_wgl.c b/dlls/opengl32/unix_wgl.c index f7979f2666f..ee899b12b42 100644 --- a/dlls/opengl32/unix_wgl.c +++ b/dlls/opengl32/unix_wgl.c @@ -1444,9 +1444,10 @@ static void flush_context( TEB *teb, void (*flush)(void) ) struct opengl_drawable *read, *draw; struct context *ctx = get_current_context( teb, &read, &draw ); const struct opengl_funcs *funcs = teb->glTable; - BOOL force_swap = flush && ctx && !ctx->draw_fbo && context_draws_front( ctx ) && - draw->buffer_map[0] == GL_BACK_LEFT && draw->client; - UINT flags = force_swap ? GL_FLUSH_FORCE_SWAP : 0; + UINT flags = 0; + + if (flush && ctx && !ctx->draw_fbo && context_draws_front( ctx ) && draw->client) flags |= GL_FLUSH_PRESENT; + if ((flags & GL_FLUSH_PRESENT) && draw->buffer_map[0] == GL_BACK_LEFT) flags |= GL_FLUSH_FORCE_SWAP; if (!ctx || !funcs->p_wgl_context_flush( &ctx->base, flush, flags )) { diff --git a/dlls/win32u/opengl.c b/dlls/win32u/opengl.c index 2f7c276adfc..8420baa0a91 100644 --- a/dlls/win32u/opengl.c +++ b/dlls/win32u/opengl.c @@ -2282,7 +2282,6 @@ static BOOL win32u_wgl_context_flush( struct wgl_context *context, void (*flush) if (flush) flush(); if (flush == funcs->p_glFinish) flags |= GL_FLUSH_FINISHED; - if (flush && !(flags & GL_FLUSH_FORCE_SWAP)) flags |= GL_FLUSH_PRESENT; opengl_drawable_flush( draw, interval, flags ); if (flags & GL_FLUSH_FORCE_SWAP) opengl_drawable_swap( draw ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9860
participants (2)
-
Rémi Bernon -
Rémi Bernon (@rbernon)