[PATCH] Fix a few small bugs in WineD3D_ChoosePixelFormat. I noticed these bugs while working on multisampling support and for some reason it didn't want to select the format I wanted and found these bugs.

Roderick Colenbrander thunderbird2k at gmx.net
Mon Apr 28 16:13:12 CDT 2008


---
 dlls/wined3d/context.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index f185c33..d80ef06 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -133,6 +133,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DF
     /* Find a pixel format which EXACTLY matches our requirements (except for depth) */
     for(i=0; i<nCfgs; i++) {
         BOOL exactDepthMatch = TRUE;
+        cfgs = &This->adapter->cfgs[i];
 
         /* For now only accept RGBA formats. Perhaps some day we will
          * allow floating point formats for pbuffers. */
@@ -194,7 +195,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DF
     if(!iPixelFormat && !findCompatible) {
         ERR("Can't find a suitable iPixelFormat\n");
         return FALSE;
-    } else {
+    } else if(!iPixelFormat) {
         PIXELFORMATDESCRIPTOR pfd;
 
         TRACE("Falling back to ChoosePixelFormat as we weren't able to find an exactly matching pixel format\n");
@@ -218,7 +219,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, WINED3DF
         }
     }
 
-    TRACE("Found iPixelFormat=%d for ColorFormat=%s, DepthStencilFormat=%s\n", cfgs->iPixelFormat, debug_d3dformat(ColorFormat), debug_d3dformat(DepthStencilFormat));
+    TRACE("Found iPixelFormat=%d for ColorFormat=%s, DepthStencilFormat=%s\n", iPixelFormat, debug_d3dformat(ColorFormat), debug_d3dformat(DepthStencilFormat));
     return iPixelFormat;
 }
 
-- 
1.5.3.4


--========GMX187161209411806255281--



More information about the wine-patches mailing list