Mesa (master): gallium/wgl: Allow context creation even if SetPixelFormat( ) wasn't called

Brian Paul brianp at kemper.freedesktop.org
Fri Jun 9 14:54:46 UTC 2017


Module: Mesa
Branch: master
Commit: 0ef39e588f92236f9e2fb1909a314c7eb70db8c2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0ef39e588f92236f9e2fb1909a314c7eb70db8c2

Author: Frank Richter <frank.richter at dynardo.de>
Date:   Wed Jun  7 09:43:43 2017 +0200

gallium/wgl: Allow context creation even if SetPixelFormat() wasn't called

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101326
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/state_trackers/wgl/stw_context.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index f3145a9e63..58fe3b0b6e 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -170,7 +170,13 @@ 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 );




More information about the mesa-commit mailing list