Mesa (master): wglSetPixelFormat should ignore the ppfd parameter.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Nov 2 19:51:12 UTC 2011


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

Author: Morgan Armand <morgan.devel at gmail.com>
Date:   Wed Nov  2 20:12:39 2011 +0100

wglSetPixelFormat should ignore the ppfd parameter.

Signed-off-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/state_trackers/wgl/stw_wgl.c |    6 ++++--
 src/mesa/drivers/windows/gdi/wgl.c       |   10 +++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/stw_wgl.c
index 5fbb7bf..d38bfbe 100644
--- a/src/gallium/state_trackers/wgl/stw_wgl.c
+++ b/src/gallium/state_trackers/wgl/stw_wgl.c
@@ -172,8 +172,10 @@ wglSetPixelFormat(
    int iPixelFormat,
    const PIXELFORMATDESCRIPTOR *ppfd )
 {
-   if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ))
-      return FALSE;
+    /* SetPixelFormat (hence wglSetPixelFormat) must not touch ppfd, per
+     * http://msdn.microsoft.com/en-us/library/dd369049(v=vs.85).aspx
+     */
+   (void) ppfd;
 
    return DrvSetPixelFormat( hdc, iPixelFormat );
 }
diff --git a/src/mesa/drivers/windows/gdi/wgl.c b/src/mesa/drivers/windows/gdi/wgl.c
index 33baabe..61850c2 100644
--- a/src/mesa/drivers/windows/gdi/wgl.c
+++ b/src/mesa/drivers/windows/gdi/wgl.c
@@ -335,9 +335,13 @@ WINGDIAPI BOOL GLAPIENTRY wglSetPixelFormat(HDC hdc,int iPixelFormat,
 					const PIXELFORMATDESCRIPTOR *ppfd)
 {
     (void) hdc;
-    
-    if(iPixelFormat < 1 || iPixelFormat > npfd || 
-       ppfd->nSize != sizeof(PIXELFORMATDESCRIPTOR)) {
+
+    /* SetPixelFormat (hence wglSetPixelFormat) must not touch ppfd, per
+     * http://msdn.microsoft.com/en-us/library/dd369049(v=vs.85).aspx
+     */
+    (void) ppfd;
+
+    if(iPixelFormat < 1 || iPixelFormat > npfd) {
 	SetLastError(0);
 	return(FALSE);
     }




More information about the mesa-commit mailing list