From 5fa26da7a7d5af41268085fae00f8c3172cab18a Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 7 Jun 2017 09:43:43 +0200 Subject: [PATCH] gallium/wgl: Allow context creation even if SetPixelFormat() wasn't called before --- src/gallium/state_trackers/wgl/stw_context.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index f3145a9..8df6abd 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -170,7 +170,12 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, DHGLRC hShareContext, iPixelFormat = fb->iPixelFormat; stw_framebuffer_unlock(fb); } else { - return 0; + /* Applications should call SetPixelFormat before creating a context, + * but not all do, and the opengl32 runtime seems to use a default + * pixel format in some cases, so use that. + */ + iPixelFormat = GetPixelFormat( hdc ); + if (!iPixelFormat) return 0; } pfi = stw_pixelformat_get_info( iPixelFormat ); -- 2.9.4