[PATCH 2/2] winex11.drv: Make the GL context current even if no drawables were given.
Charles Davis
cdavis5x at gmail.com
Thu Feb 18 03:17:45 CST 2016
Signed-off-by: Charles Davis <cdavis5x at gmail.com>
---
Unfortunately, I can't really test this, because XQuartz doesn't yet support
GLX_ARB_create_context.
dlls/opengl32/tests/opengl.c | 2 +-
dlls/winex11.drv/opengl.c | 44 ++++++++++++++++++++++----------------------
2 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index e5e1507..c058c19 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -975,7 +975,7 @@ static void test_opengl3(HDC hdc)
* expect drivers to ever offer it.
*/
res = wglMakeCurrent(0, gl3Ctx);
- ok(res == FALSE, "Wow, OpenGL 3.0 windowless rendering passed while it was expected not to!\n");
+ ok(res || broken(!res), "OpenGL 3.0 windowless rendering failed!\n");
if(res)
wglMakeCurrent(0, 0);
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 704d62a..4f0e579 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1833,26 +1833,29 @@ static BOOL glxdrv_wglMakeCurrent(HDC hdc, struct wgl_context *ctx)
return TRUE;
}
- if ((gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
+ if (!hdc || (gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
{
- if (ctx->fmt != gl->format)
+ if (gl && ctx->fmt != gl->format)
{
WARN( "mismatched pixel format hdc %p %p ctx %p %p\n", hdc, gl->format, ctx, ctx->fmt );
SetLastError( ERROR_INVALID_PIXEL_FORMAT );
goto done;
}
- TRACE("hdc %p drawable %lx fmt %p ctx %p %s\n", hdc, gl->drawable, gl->format, ctx->ctx,
- debugstr_fbconfig( gl->format->fbconfig ));
+ if (gl)
+ TRACE("hdc %p drawable %lx fmt %p ctx %p %s\n", hdc, gl->drawable, gl->format, ctx->ctx,
+ debugstr_fbconfig( gl->format->fbconfig ));
+ else
+ TRACE("ctx %p (no drawable)\n", ctx->ctx);
- ret = pglXMakeCurrent(gdi_display, gl->drawable, ctx->ctx);
+ ret = pglXMakeCurrent(gdi_display, gl ? gl->drawable : None, ctx->ctx);
if (ret)
{
NtCurrentTeb()->glContext = ctx;
ctx->has_been_current = TRUE;
ctx->hdc = hdc;
- ctx->drawables[0] = gl->drawable;
- ctx->drawables[1] = gl->drawable;
+ ctx->drawables[0] = gl ? gl->drawable : 0;
+ ctx->drawables[1] = gl ? gl->drawable : 0;
ctx->refresh_drawables = FALSE;
goto done;
}
@@ -1883,22 +1886,19 @@ static BOOL X11DRV_wglMakeContextCurrentARB( HDC draw_hdc, HDC read_hdc, struct
}
if (!pglXMakeContextCurrent) return FALSE;
-
- if ((draw_gl = get_gl_drawable( WindowFromDC( draw_hdc ), draw_hdc )))
+ draw_gl = get_gl_drawable( WindowFromDC( draw_hdc ), draw_hdc );
+ read_gl = get_gl_drawable( WindowFromDC( read_hdc ), read_hdc );
+ ret = pglXMakeContextCurrent(gdi_display, draw_gl ? draw_gl->drawable : 0,
+ read_gl ? read_gl->drawable : 0, ctx->ctx);
+ if (ret)
{
- read_gl = get_gl_drawable( WindowFromDC( read_hdc ), read_hdc );
- ret = pglXMakeContextCurrent(gdi_display, draw_gl->drawable,
- read_gl ? read_gl->drawable : 0, ctx->ctx);
- if (ret)
- {
- ctx->has_been_current = TRUE;
- ctx->hdc = draw_hdc;
- ctx->drawables[0] = draw_gl->drawable;
- ctx->drawables[1] = read_gl ? read_gl->drawable : 0;
- ctx->refresh_drawables = FALSE;
- NtCurrentTeb()->glContext = ctx;
- goto done;
- }
+ ctx->has_been_current = TRUE;
+ ctx->hdc = draw_hdc;
+ ctx->drawables[0] = draw_gl ? draw_gl->drawable : 0;
+ ctx->drawables[1] = read_gl ? read_gl->drawable : 0;
+ ctx->refresh_drawables = FALSE;
+ NtCurrentTeb()->glContext = ctx;
+ goto done;
}
SetLastError( ERROR_INVALID_HANDLE );
done:
--
2.7.1
More information about the wine-patches
mailing list