[PATCH] Store more WGL pixel format information. Other patches of this series make use of it.

Roderick Colenbrander thunderbird2k at gmx.net
Mon Mar 3 13:31:52 CST 2008


---
 dlls/wined3d/directx.c         |   35 +++++++++++++++++++++++++----------
 dlls/wined3d/wined3d_private.h |    4 ++++
 2 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 5b7333c..4941bb1 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -3306,8 +3306,8 @@ BOOL InitAdapters(void) {
     /* For now only one default adapter */
     {
         int iPixelFormat;
-        int attribs[8];
-        int values[8];
+        int attribs[9];
+        int values[9];
         int nAttribs = 0;
         int res;
         WineD3D_PixelFormat *cfgs;
@@ -3372,12 +3372,15 @@ BOOL InitAdapters(void) {
 
         Adapters[0].cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Adapters[0].nCfgs *sizeof(WineD3D_PixelFormat));
         cfgs = Adapters[0].cfgs;
+        PUSH1(WGL_PIXEL_TYPE_ARB)
         PUSH1(WGL_RED_BITS_ARB)
         PUSH1(WGL_GREEN_BITS_ARB)
         PUSH1(WGL_BLUE_BITS_ARB)
         PUSH1(WGL_ALPHA_BITS_ARB)
         PUSH1(WGL_DEPTH_BITS_ARB)
         PUSH1(WGL_STENCIL_BITS_ARB)
+        PUSH1(WGL_AUX_BUFFERS_ARB)
+        PUSH1(WGL_DRAW_TO_WINDOW_ARB)
 
         for(iPixelFormat=1; iPixelFormat<=Adapters[0].nCfgs; iPixelFormat++) {
             res = GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0, nAttribs, attribs, values));
@@ -3387,14 +3390,26 @@ BOOL InitAdapters(void) {
 
             /* Cache the pixel format */
             cfgs->iPixelFormat = iPixelFormat;
-            cfgs->redSize = values[0];
-            cfgs->greenSize = values[1];
-            cfgs->blueSize = values[2];
-            cfgs->alphaSize = values[3];
-            cfgs->depthSize = values[4];
-            cfgs->stencilSize = values[5];
-
-            TRACE("iPixelFormat=%d, RGBA=%d/%d/%d/%d, depth=%d, stencil=%d\n", cfgs->iPixelFormat, cfgs->redSize, cfgs->greenSize, cfgs->blueSize, cfgs->alphaSize, cfgs->depthSize, cfgs->stencilSize);
+            cfgs->iPixelType = values[0];
+            cfgs->redSize = values[1];
+            cfgs->greenSize = values[2];
+            cfgs->blueSize = values[3];
+            cfgs->alphaSize = values[4];
+            cfgs->depthSize = values[5];
+            cfgs->stencilSize = values[6];
+            cfgs->auxBuffers = values[7];
+            cfgs->windowDrawable = values[8];
+
+            cfgs->pbufferDrawable = FALSE;
+            /* Check for pbuffer support when it is around as wglGetPixelFormatAttribiv fails for unknown attributes. */
+            if(GL_SUPPORT(WGL_ARB_PBUFFER)) {
+                int attrib = WGL_DRAW_TO_PBUFFER_ARB;
+                int value;
+                if(GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, iPixelFormat, 0, 1, &attrib, &value)))
+                    cfgs->pbufferDrawable = value;
+            }
+
+            TRACE("iPixelFormat=%d, iPixelType=%#x, RGBA=%d/%d/%d/%d, depth=%d, stencil=%d, aux=%d, windowDrawable=%d, pbufferDrawable=%d\n", cfgs->iPixelFormat, cfgs->iPixelType, cfgs->redSize, cfgs->greenSize, cfgs->blueSize, cfgs->alphaSize, cfgs->depthSize, cfgs->stencilSize, cfgs->auxBuffers, cfgs->windowDrawable, cfgs->pbufferDrawable);
             cfgs++;
         }
         WineD3D_ReleaseFakeGLContext();
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f6ac50c..288fdff 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -633,8 +633,12 @@ extern const WINED3DLIGHT WINED3D_default_light;
 typedef struct WineD3D_PixelFormat
 {
     int iPixelFormat; /* WGL pixel format */
+    int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
     int redSize, greenSize, blueSize, alphaSize;
     int depthSize, stencilSize;
+    int auxBuffers;
+    BOOL windowDrawable;
+    BOOL pbufferDrawable;
 } WineD3D_PixelFormat;
 
 /* The adapter structure */
-- 
1.5.3.4


--========GMX64331204584930207593--



More information about the wine-patches mailing list