Updated GLX -> WGL d3d9 patch

Nick Burns adger44 at hotmail.com
Sat Jul 16 04:21:23 CDT 2005


--As promised on the a few days ago--

NOTE: you may want to run "fromdos" on these to convert the new line 
characters

Initial window resizing implemented  (incorrect but at least does something)
Initial vsync choosing (PresentationInterval) implemented
Initial swap effects (SwapEffects) implemented
Synced with wine HEAD (thats the fun part...)

GLX is still supported
#define __WIN32_OPENGL__
to use WGL instead of GLX (this is done automatically if either __CYGWIN__ 
or WIN32 is defined)

Makefile.in and Makefile have been modified for cimpiling (under cygwin -- 
dunno about any other)...
needs "/usr/include/w32api" to exist and have "/usr/include/w32api/GL/gl.h", 
"/usr/include/w32api/GL/glext.h"
this has to be done manually now (link to opengl32 instead of using the GLX 
libs)
configure would have to be changed to accomadate this patch... (kind of 
annoying I think...)
As such the Makefile has been included with this patch (for people with 
Cygwin/MinGW32? to build)

(if this patch is too large tell me and I will not post large patches (80KB) 
... or instead I will Zip it ... or just email to people interested...)

Nick

-------------- next part --------------
cvs -z4 diff -u -wb -d -p (in directory C:\cvs_stuff\wine\)
? dlls/wined3d/Makefile
? dlls/wined3d/win_X_utils.c
? dlls/wined3d/win_X_utils.h
...
Index: dlls/wined3d/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/Makefile.in,v
retrieving revision 1.16
diff -u -w -b -d -p -r1.16 Makefile.in
--- dlls/wined3d/Makefile.in	23 Jun 2005 11:05:24 -0000	1.16
+++ dlls/wined3d/Makefile.in	16 Jul 2005 09:00:57 -0000
@@ -4,9 +4,12 @@ SRCDIR    = @srcdir@
VPATH     = @srcdir@
MODULE    = wined3d.dll
IMPORTLIB = libwined3d.$(IMPLIBEXT)
-IMPORTS   = user32 gdi32 advapi32 kernel32
-EXTRAINCL = @X_CFLAGS@
-EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ 
@OPENGL_LIBS@
+#IMPORTS   = user32 gdi32 advapi32 kernel32
+#EXTRAINCL = @X_CFLAGS@
+#EXTRALIBS = -ldxguid -luuid @X_LIBS@ @X_PRE_LIBS@ @XLIB@ @X_EXTRA_LIBS@ 
@OPENGL_LIBS@
+IMPORTS   = user32 gdi32 advapi32 kernel32 opengl32 msvcrt winmm
+EXTRAINCL = -I/usr/include/w32api
+EXTRALIBS = -ldxguid -luuid

C_SRCS = \
	basetexture.c \
@@ -27,6 +30,7 @@ C_SRCS = \
	vertexshader.c \
	volume.c \
	volumetexture.c \
+		win_X_utils.c \
	wined3d_main.c

@MAKE_DLL_RULES@
Index: dlls/wined3d/device.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/device.c,v
retrieving revision 1.49
diff -u -w -b -d -p -r1.49 device.c
--- dlls/wined3d/device.c	15 Jul 2005 16:32:25 -0000	1.49
+++ dlls/wined3d/device.c	16 Jul 2005 09:00:57 -0000
@@ -30,25 +30,6 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_fps);
WINE_DECLARE_DEBUG_CHANNEL(d3d_shader);
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info

-/* x11drv GDI escapes */
-#define X11DRV_ESCAPE 6789
-enum x11drv_escape_codes
-{
-    X11DRV_GET_DISPLAY,   /* get X11 display for a DC */
-    X11DRV_GET_DRAWABLE,  /* get current drawable for a DC */
-    X11DRV_GET_FONT,      /* get current X font for a DC */
-};
-
-/* retrieve the X display to use on a given DC */
-inline static Display *get_display( HDC hdc )
-{
-    Display *display;
-    enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
-
-    if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
-                    sizeof(display), (LPSTR)&display )) display = NULL;
-    return display;
-}

/* Memory tracking and object counting */
static unsigned int emulated_textureram = 64*1024*1024;
@@ -988,10 +969,61 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
         object->win_handle = This->createParms.hFocusWindow;
     }

+#ifndef __WIN32_OPENGL__
     object->win        = (Window)GetPropA(object->win_handle, 
"__wine_x11_whole_window" );
     hDc                = GetDC(object->win_handle);
     object->display    = get_display(hDc);
     ReleaseDC(object->win_handle, hDc);
+#else/*__WIN32_OPENGL__*/
+    object->win        = object->win_handle;
+    hDc                = GetDC(object->win_handle);
+    object->display    = get_display(hDc);
+
+#if 0
+{/*this would be better if it worked*/
+    GLboolean cfgs = GL_FALSE;
+    int pixelFormat;
+    float fAttributes[] = {0,0};
+    int nCfgs = 0;
+    int attribs[256];
+    int nAttribs = 0;
+#define PUSH1(att)        attribs[nAttribs++] = (att);
+#define PUSH2(att,value)  attribs[nAttribs++] = (att); attribs[nAttribs++] 
= (value);
+
+    PUSH2(WGL_DRAW_TO_WINDOW_ARB, *(pPresentationParameters->Windowed));
+    /*PUSH2(WGL_ACCELERATION_ARB,   WGL_FULL_ACCELERATION_ARB);*/
+    PUSH2(GLX_X_RENDERABLE,       TRUE);
+    PUSH2(GLX_DOUBLEBUFFER,       TRUE);
+    TRACE("calling makeglcfg\n");
+    if (*(pPresentationParameters->EnableAutoDepthStencil)) {
+        D3DFmtMakeGlCfg(*(pPresentationParameters->BackBufferFormat), 
*(pPresentationParameters->AutoDepthStencilFormat), attribs, &nAttribs, 
FALSE /* alternate */);
+    } else {
+        D3DFmtMakeGlCfg(*(pPresentationParameters->BackBufferFormat), 0, 
attribs, &nAttribs, FALSE /* alternate */);
+    }
+
+    PUSH1(None);
+#undef PUSH1
+#undef PUSH2
+
+
+    TRACE("calling chooseFGConfig\n");
+    cfgs = GL_EXTCALL(wglChoosePixelFormatARB)(object->display, attribs, 
fAttributes, 1, &pixelFormat, &nCfgs);
+    pfd.nSize = sizeof(pfd);
+    if (SetPixelFormat(object->display, pixelFormat, &pfd)) {
+    } else {
+        return D3DERR_NOTAVAILABLE;
+    }
+}
+#else
+{/*this works but I think the above is better (if it worked)*/
+    PIXELFORMATDESCRIPTOR pfd;
+    D3DFmtMakePFD(pPresentationParameters, &pfd, FALSE);
+    if (SetPixelFormat(object->display, ChoosePixelFormat(object->display, 
&pfd), &pfd) == FALSE) {
+        return D3DERR_NOTAVAILABLE;
+    }
+}
+#endif
+#endif/*__WIN32_OPENGL__*/
     TRACE("Using a display of %p %p  \n", object->display, hDc);

     if (NULL == object->display || NULL == hDc) {
@@ -1014,6 +1046,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
     /** FIXME: Handle stencil appropriately via EnableAutoDepthStencil / 
AutoDepthStencilFormat **/
     ENTER_GL();

+#ifndef __WIN32_OPENGL__
     /* Create a new context for this swapchain */
     template.visualid = (VisualID)GetPropA(GetDesktopWindow(), 
"__wine_x11_visual_id");
     /* TODO: change this to find a similar visual, but one with a 
stencil/zbuffer buffer that matches the request
@@ -1062,6 +1095,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create
         }
         /* Now choose a simila visual ID*/
     }
+#else/*__WIN32_OPENGL__*/
+#endif/*__WIN32_OPENGL__*/
#ifdef USE_CONTEXT_MANAGER

     /** TODO: use a context mamager **/
@@ -1308,6 +1343,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_Create

         This->swapchains[This->numberOfSwapChains++] = (IWineD3DSwapChain 
*)object;
         TRACE("Set swapchain to %p\n", object);
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+/*hook the window*/
+{/*one hook will suffice*/
+    if (GetWindowLongA(object->win_handle, GWL_WNDPROC) != 
(LONG)WindowResizeProc) {
+        SetPropA(object->win_handle, WINED3D_SWAPCHAIN_PROPERTY, 
(HANDLE)object);
+#if 0 /*remove window resizing*/
+object->oldFunc = GetWindowLongA(object->win_handle, GWL_WNDPROC);
+#else
+        object->oldFunc = SetWindowLongA(object->win_handle, GWL_WNDPROC, 
(LONG)WindowResizeProc);
+#endif
+        SetWindowPos(object->win_handle, 0, 0, 0, 0, 0, SWP_NOMOVE | 
SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+    }
+    SwapInterval(pPresentationParameters);
+}
+#endif/*__WIN32_OPENGL__*/
     } else { /* something went wrong so clean up */
         IUnknown* bufferParent;
         if (object->frontBuffer) {
@@ -2689,7 +2740,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen
                 FIXME("Unrecognized/Unhandled D3DBLENDOP value %ld\n", 
Value);
             }
             TRACE("glBlendEquation(%x)\n", glParm);
-            glBlendEquation(glParm);
+            GL_EXTCALL(glBlendEquation)(glParm);
             checkGLcall("glBlendEquation");
         }
         break;
@@ -2703,7 +2754,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRen
             float col[4];
             D3DCOLORTOGLFLOAT4(Value, col);
             /* Set the default alpha blend color */
-            glBlendColor(col[0], col[1], col[2], col[3]);
+            GL_EXTCALL(glBlendColor)(col[0], col[1], col[2], col[3]);
             checkGLcall("glBlendColor");

             /* And now the default texture color as well */
@@ -5202,7 +5253,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_Active
#if defined(GL_VERSION_1_3)

     /** TODO: we only need to look up the configuration !IF! we are setting 
the target to a texture **/
+#ifndef __WIN32_OPENGL__
     GLXFBConfig* cfgs = NULL;
+#else/*__WIN32_OPENGL__*/
+    GLboolean cfgs = GL_FALSE;
+    int pixelFormat;
+    int iAttributes[] = {0,0};
+    float fAttributes[] = {0,0};
+#endif/*__WIN32_OPENGL__*/
     int nCfgs = 0;
     int attribs[256];
     int nAttribs = 0;
@@ -5238,7 +5296,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_Active

     ENTER_GL();

+#ifndef __WIN32_OPENGL__
     PUSH2(GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT);
+#else/*__WIN32_OPENGL__*/
+    /*PUSH2(WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB);*/
+    PUSH2(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+#endif/*__WIN32_OPENGL__*/
     PUSH2(GLX_X_RENDERABLE,  TRUE);
     PUSH2(GLX_DOUBLEBUFFER, TRUE);
     TRACE("calling makeglcfg\n");
@@ -5248,32 +5311,52 @@ HRESULT WINAPI IWineD3DDeviceImpl_Active


     TRACE("calling chooseFGConfig\n");
+#ifndef __WIN32_OPENGL__
     cfgs = glXChooseFBConfig(impSwapChain->display, 
DefaultScreen(impSwapChain->display),
                                                      attribs, &nCfgs);
+#else/*__WIN32_OPENGL__*/
+    cfgs = GL_EXTCALL(wglChoosePixelFormatARB)(impSwapChain->display, 
attribs, fAttributes, 1, &pixelFormat, &nCfgs);
+#endif/*__WIN32_OPENGL__*/

     if (!cfgs) { /* OK we didn't find the exact config, so use any 
reasonable match */
         /* TODO: fill in the 'requested' and 'current' depths, also make 
sure that's
            why we failed and only show this message once! */
         MESSAGE("Failed to find exact match, finding alternative but you 
may suffer performance issues, try changing xfree's depth to match the 
requested depth\n"); /**/
         nAttribs = 0;
+#ifndef __WIN32_OPENGL__
         PUSH2(GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT | GLX_WINDOW_BIT);
+#else/*__WIN32_OPENGL__*/
+        /*PUSH2(WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB);*/
+        PUSH2(WGL_DRAW_TO_PBUFFER_ARB, TRUE);
+        PUSH2(WGL_DRAW_TO_WINDOW_ARB, TRUE);
+#endif/*__WIN32_OPENGL__*/
        /* PUSH2(GLX_X_RENDERABLE,  TRUE); */
         PUSH2(GLX_RENDER_TYPE,   GLX_RGBA_BIT);
         PUSH2(GLX_DOUBLEBUFFER, FALSE);
         TRACE("calling makeglcfg\n");
         D3DFmtMakeGlCfg(BackBufferFormat, StencilBufferFormat, attribs, 
&nAttribs, TRUE /* alternate */);
         PUSH1(None);
+#ifndef __WIN32_OPENGL__
         cfgs = glXChooseFBConfig(impSwapChain->display, 
DefaultScreen(impSwapChain->display),
                                                         attribs, &nCfgs);
+#else/*__WIN32_OPENGL__*/
+        cfgs = GL_EXTCALL(wglChoosePixelFormatARB)(impSwapChain->display, 
attribs, fAttributes, 1, &pixelFormat, &nCfgs);
+#endif/*__WIN32_OPENGL__*/
     }

#if 0
#ifdef EXTRA_TRACES
         int i;
         for (i = 0; i < nCfgs; ++i) {
+#ifndef __WIN32_OPENGL__
             TRACE("for (%u,%s)/(%u,%s) found config[%d]@%p\n", 
BackBufferFormat,
             debug_d3dformat(BackBufferFormat), StencilBufferFormat,
             debug_d3dformat(StencilBufferFormat), i, cfgs[i]);
+#else/*__WIN32_OPENGL__*/
+            TRACE("for (%u,%s)/(%u,%s) found config[%d]@__\n", 
BackBufferFormat,
+            debug_d3dformat(BackBufferFormat), StencilBufferFormat,
+            debug_d3dformat(StencilBufferFormat), i);
+#endif/*__WIN32_OPENGL__*/
         }
#endif
#endif
@@ -5391,7 +5474,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_Active
#endif

         PUSH1(None);
+#ifndef __WIN32_OPENGL__
         newDrawable = glXCreatePbuffer(impSwapChain->display, cfgs[0], 
attribs);
+#else/*__WIN32_OPENGL__*/
+        newDrawable = 
GL_EXTCALL(wglCreatePbufferARB)(impSwapChain->display, pixelFormat, Width, 
Height, iAttributes);
+#endif/*__WIN32_OPENGL__*/

         /** ****************************************
         *GLX1.3 isn't supported by XFree 'yet' untill that point ATI 
emulates pBuffers
@@ -5402,12 +5489,16 @@ HRESULT WINAPI IWineD3DDeviceImpl_Active
          ********************************************/


+#ifndef __WIN32_OPENGL__
             visinfo = glXGetVisualFromFBConfig(impSwapChain->display, 
cfgs[0]);
             if (!visinfo) {
                 ERR("Error: couldn't get an RGBA, double-buffered 
visual\n");
             }
             newContext = glXCreateContext(impSwapChain->display, visinfo, 
impSwapChain->glCtx,  GL_TRUE);
             XFree(visinfo);
+#else/*__WIN32_OPENGL__*/
+            newContext = glXCreateContext(impSwapChain->display, visinfo, 
impSwapChain->glCtx,  GL_TRUE);
+#endif/*__WIN32_OPENGL__*/

         /* Make sure that the sorface exists as a glTexture */
         IWineD3DSurface_PreLoad(RenderSurface);
Index: dlls/wined3d/directx.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/directx.c,v
retrieving revision 1.41
diff -u -w -b -d -p -r1.41 directx.c
--- dlls/wined3d/directx.c	13 Jul 2005 19:38:40 -0000	1.41
+++ dlls/wined3d/directx.c	16 Jul 2005 09:00:58 -0000
@@ -34,30 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
#define GLINFO_LOCATION This->gl_info

-/**********************************************************
- * Utility functions follow
- **********************************************************/
-
-/* x11drv GDI escapes */
-#define X11DRV_ESCAPE 6789
-enum x11drv_escape_codes
-{
-    X11DRV_GET_DISPLAY,   /* get X11 display for a DC */
-    X11DRV_GET_DRAWABLE,  /* get current drawable for a DC */
-    X11DRV_GET_FONT,      /* get current X font for a DC */
-};
-
-/* retrieve the X display to use on a given DC */
-inline static Display *get_display( HDC hdc )
-{
-    Display *display;
-    enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
-
-    if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
-                    sizeof(display), (LPSTR)&display )) display = NULL;
-    return display;
-}
-
/**
  * Note: GL seems to trap if GetDeviceCaps is called before any HWND's 
created
  * ie there is no GL Context - Get a default rendering context to enable 
the
@@ -79,15 +55,37 @@ static WineD3D_Context* WineD3D_CreateFa

        TRACE_(d3d_caps)("Creating Fake GL Context\n");

+#ifndef __WIN32_OPENGL__
        ctx.drawable = (Drawable) GetPropA(GetDesktopWindow(), 
"__wine_x11_whole_window");
+#else/*__WIN32_OPENGL__*/
+       /*ctx.drawable = GetDesktopWindow();*/
+       ctx.drawable = CreateWindowA("BUTTON", "fake", 0, 0, 0, 10, 10, 
NULL, NULL, GetModuleHandleA(NULL), NULL);
+#endif/*__WIN32_OPENGL__*/

        /* Get the display */
+#ifndef __WIN32_OPENGL__
        device_context = GetDC(0);
        ctx.display = get_display(device_context);
        ReleaseDC(0, device_context);
+#else/*__WIN32_OPENGL__*/
+{
+    PIXELFORMATDESCRIPTOR pfd;
+    ctx.display    = GetDC(ctx.drawable);
+    ZeroMemory(&pfd, sizeof(pfd));
+    pfd.nSize      = sizeof(pfd);
+    pfd.nVersion   = 1;
+    pfd.dwFlags    = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | 
PFD_DRAW_TO_WINDOW;/*PFD_GENERIC_ACCELERATED*/
+    pfd.iPixelType = PFD_TYPE_RGBA;
+    pfd.cColorBits = 32;
+    pfd.cDepthBits = 0;
+    pfd.iLayerType = PFD_MAIN_PLANE;
+    SetPixelFormat(ctx.display, ChoosePixelFormat(ctx.display, &pfd), 
&pfd);
+}
+#endif/*__WIN32_OPENGL__*/

        /* Get the X visual */
        ENTER_GL();
+#ifndef __WIN32_OPENGL__
        if (XGetWindowAttributes(ctx.display, ctx.drawable, &win_attr)) {
            visual = win_attr.visual;
        } else {
@@ -100,12 +98,19 @@ static WineD3D_Context* WineD3D_CreateFa
            WARN_(d3d_caps)("Error creating visual info for capabilities 
initialization\n");
            failed = TRUE;
        }
+#else/*__WIN32_OPENGL__*/
+#endif/*__WIN32_OPENGL__*/

        /* Create a GL context */
        if (!failed) {
            ctx.glCtx = glXCreateContext(ctx.display, ctx.visInfo, NULL, 
GL_TRUE);

            if (ctx.glCtx == NULL) {
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+               ReleaseDC(ctx.drawable,ctx.display);
+               DestroyWindow(ctx.drawable);
+#endif/*__WIN32_OPENGL__*/
                LEAVE_GL();
                WARN_(d3d_caps)("Error creating default context for 
capabilities initialization\n");
                failed = TRUE;
@@ -143,6 +148,11 @@ static void WineD3D_ReleaseFakeGLContext
         if (0 == InterlockedDecrement(&ctx->ref)) {
             glXMakeCurrent(ctx->display, None, NULL);
             glXDestroyContext(ctx->display, ctx->glCtx);
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+            ReleaseDC(ctx->drawable,ctx->display);
+            DestroyWindow(ctx->drawable);
+#endif/*__WIN32_OPENGL__*/
             ctx->display = NULL;
             ctx->glCtx = NULL;
             LEAVE_GL();
@@ -251,7 +261,21 @@ static BOOL IWineD3DImpl_FillGLCaps(Wine
         switch (gl_info->gl_vendor) {
         case VENDOR_NVIDIA:
             gl_string_cursor = strstr(gl_string, "NVIDIA");
+/*PLEASE PEOPLE BE STRING SAFE SHEESH!!!*/
+            if(gl_string_cursor == NULL)
+            {
+                gl_string_cursor = gl_string;
+            }
+            else
+            {
+                const char *gl_string_tmp = NULL;
+                gl_string_tmp = gl_string_cursor;
             gl_string_cursor = strstr(gl_string_cursor, " ");
+                if(gl_string_cursor == NULL)
+                {
+                    gl_string_cursor = gl_string_tmp;
+                }
+            }
             while (*gl_string_cursor && ' ' == *gl_string_cursor) 
++gl_string_cursor;
             if (*gl_string_cursor) {
                 char tmp[16];
@@ -566,6 +590,7 @@ static BOOL IWineD3DImpl_FillGLCaps(Wine
     GL_EXT_FUNCS_GEN;
#undef USE_GL_FUNC

+#ifndef __WIN32_OPENGL__
     if (display != NULL) {
         GLX_Extensions = glXQueryExtensionsString(display, 
DefaultScreen(display));
         TRACE_(d3d_caps)("GLX_Extensions reported:\n");
@@ -587,6 +612,8 @@ static BOOL IWineD3DImpl_FillGLCaps(Wine
             }
         }
     }
+#else/*__WIN32_OPENGL__*/
+#endif/*__WIN32_OPENGL__*/

#define USE_GL_FUNC(type, pfn) gl_info->pfn = (type) 
glXGetProcAddressARB(#pfn);
     GLX_EXT_FUNCS_GEN;
@@ -720,7 +747,7 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterM
             DEVMODEW DevModeWtmp;


-            while (i<(Mode+1) && EnumDisplaySettingsExW(NULL, j, 
&DevModeWtmp, 0)) {
+            while (i<(Mode/*+1*/) && EnumDisplaySettingsExW(NULL, j, 
&DevModeWtmp, 0)) {
                 j++;
                 switch (Format)
                 {
@@ -822,7 +849,11 @@ HRESULT WINAPI IWineD3DImpl_GetAdapterDi
         case  8: pMode->Format       = D3DFMT_R3G3B2;   break;
         case 16: pMode->Format       = D3DFMT_R5G6B5;   break;
         case 24: pMode->Format       = D3DFMT_X8R8G8B8; break; /* Robots 
needs 24bit to be X8R8G8B8 */
+#if 0
         case 32: pMode->Format       = D3DFMT_A8R8G8B8; break;
+#else
+case 32: pMode->Format       = D3DFMT_X8R8G8B8; break;
+#endif
         default: pMode->Format       = D3DFMT_UNKNOWN;
         }

@@ -919,12 +950,24 @@ static BOOL IWineD3DImpl_IsGLXFBConfigCo
   int gl_test;
   int rb, gb, bb, ab, type, buf_sz;

+#ifndef __WIN32_OPENGL__
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_RED_SIZE,   &rb);
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_GREEN_SIZE, &gb);
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_BLUE_SIZE,  &bb);
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_ALPHA_SIZE, &ab);
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_RENDER_TYPE, 
&type);
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_BUFFER_SIZE, 
&buf_sz);
+#else/*__WIN32_OPENGL__*/
+  PIXELFORMATDESCRIPTOR pfd;
+  pfd.nSize = sizeof(pfd);
+  gl_test = DescribePixelFormat(ctx->display, cfgs, sizeof(pfd), &pfd);
+  rb = pfd.cRedBits;
+  gb = pfd.cGreenBits;
+  bb = pfd.cBlueBits;
+  ab = pfd.cAlphaBits;
+  type = pfd.iPixelType;
+  buf_sz = pfd.cColorBits;
+#endif/*__WIN32_OPENGL__*/

   switch (Format) {
   case WINED3DFMT_X8R8G8B8:
@@ -963,8 +1006,16 @@ static BOOL IWineD3DImpl_IsGLXFBConfigCo
   int gl_test;
   int db, sb;

+#ifndef __WIN32_OPENGL__
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_DEPTH_SIZE, &db);
   gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_STENCIL_SIZE, 
&sb);
+#else/*__WIN32_OPENGL__*/
+  PIXELFORMATDESCRIPTOR pfd;
+  pfd.nSize = sizeof(pfd);
+  gl_test = DescribePixelFormat(ctx->display, cfgs, sizeof(pfd), &pfd);
+  db = pfd.cDepthBits;
+  sb = pfd.cStencilBits;
+#endif/*__WIN32_OPENGL__*/

   switch (Format) {
   case WINED3DFMT_D16:
@@ -1019,6 +1070,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDepthSt
       HRESULT hr = D3DERR_NOTAVAILABLE;

       WineD3D_Context* ctx = WineD3D_CreateFakeGLContext();
+#ifndef __WIN32_OPENGL__
       if (NULL != ctx) {
         cfgs = glXGetFBConfigs(ctx->display, DefaultScreen(ctx->display), 
&nCfgs);
         for (it = 0; it < nCfgs; ++it) {
@@ -1034,6 +1086,23 @@ HRESULT WINAPI IWineD3DImpl_CheckDepthSt
         WineD3D_ReleaseFakeGLContext(ctx);
         return hr;
       }
+#else/*__WIN32_OPENGL__*/
+    if(ctx != NULL) {
+        PIXELFORMATDESCRIPTOR pfd;
+        pfd.nSize = sizeof(pfd);
+        nCfgs = DescribePixelFormat(ctx->display, 0, 0, NULL);
+        for (it = 1; it <= nCfgs; ++it) {
+            if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(ctx, it, 
RenderTargetFormat)) {
+                if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(ctx, 
it, DepthStencilFormat)) {
+                    hr = D3D_OK;
+                    break ;
+                }
+            }
+        }
+    }
+	WineD3D_ReleaseFakeGLContext(ctx);
+	return hr;
+#endif/*__WIN32_OPENGL__*/
     }

     return D3DERR_NOTAVAILABLE;
@@ -1093,6 +1162,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceT
       HRESULT hr = D3DERR_NOTAVAILABLE;

       WineD3D_Context* ctx = WineD3D_CreateFakeGLContext();
+#ifndef __WIN32_OPENGL__
       if (NULL != ctx) {
         cfgs = glXGetFBConfigs(ctx->display, DefaultScreen(ctx->display), 
&nCfgs);
         for (it = 0; it < nCfgs; ++it) {
@@ -1106,6 +1176,21 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceT
         WineD3D_ReleaseFakeGLContext(ctx);
         return hr;
       }
+#else/*__WIN32_OPENGL__*/
+    if(ctx != NULL) {
+        PIXELFORMATDESCRIPTOR pfd;
+        pfd.nSize = sizeof(pfd);
+        nCfgs = DescribePixelFormat(ctx->display, 0, 0, NULL);
+        for (it = 1; it <= nCfgs; ++it) {
+            if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(ctx, it, 
DisplayFormat)) {
+                hr = D3D_OK;
+                break ;
+            }
+        }
+        WineD3D_ReleaseFakeGLContext(ctx);
+        return hr;
+    }
+#endif/*__WIN32_OPENGL__*/
     }

     return D3DERR_NOTAVAILABLE;
Index: dlls/wined3d/swapchain.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/swapchain.c,v
retrieving revision 1.3
diff -u -w -b -d -p -r1.3 swapchain.c
--- dlls/wined3d/swapchain.c	13 Jul 2005 14:15:54 -0000	1.3
+++ dlls/wined3d/swapchain.c	16 Jul 2005 09:00:58 -0000
@@ -24,27 +24,6 @@
#include "wined3d_private.h"


-/* TODO: move to shared header (or context manager )*/
-/* x11drv GDI escapes */
-#define X11DRV_ESCAPE 6789
-enum x11drv_escape_codes
-{
-    X11DRV_GET_DISPLAY,   /* get X11 display for a DC */
-    X11DRV_GET_DRAWABLE,  /* get current drawable for a DC */
-    X11DRV_GET_FONT,      /* get current X font for a DC */
-};
-
-/* retrieve the X display to use on a given DC */
-inline static Display *get_display( HDC hdc )
-{
-    Display *display;
-    enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
-
-    if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
-                    sizeof(display), (LPSTR)&display )) display = NULL;
-    return display;
-}
-
/*TODO: some of the additional parameters may be required to
     set the gamma ramp (for some weird reason microsoft have left swap 
gammaramp in device
     but it operates on a swapchain, it may be a good idea to move it to 
IWineD3DSwapChain for IWineD3D)*/
@@ -104,6 +83,15 @@ ULONG WINAPI IWineD3DSwapChainImpl_Relea
             glXMakeCurrent(This->display, None, NULL);
         }
         glXDestroyContext(This->display, This->glCtx);
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+        ReleaseDC(This->win_handle, This->display);
+/*NOT NEEDED*/
+        RemovePropA(This->win_handle, WINED3D_SWAPCHAIN_PROPERTY);
+        SetWindowLongA(This->win_handle, GWL_WNDPROC, (LONG)This->oldFunc);
+        SetWindowPos(This->win_handle, 0, 0, 0, 0, 0, SWP_NOMOVE | 
SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+/*not needed*/
+#endif/*__WIN32_OPENGL__*/
         /* IUnknown_Release(This->parent); This should only apply to the 
primary swapchain,
          all others are crated by the caller, so releasing the parent 
should cause
          the child to be released, not the other way around!
@@ -155,9 +143,24 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Pre
                 IUnknown*         tmp;
                 GLXContext        currentContext;
                 Drawable          currentDrawable;
+#ifndef __WIN32_OPENGL__
                 hDc                          = GetDC(hDestWindowOverride);
                 This->win_handle             = hDestWindowOverride;
                 This->win                    = (Window)GetPropA( 
hDestWindowOverride, "__wine_x11_whole_window" );
+#else/*__WIN32_OPENGL__*/
+                hDc                          = This->display;
+                This->win_handle             = hDestWindowOverride;
+                This->win                    = hDestWindowOverride;
+if (GetPixelFormat(This->display) == 0) {
+    PIXELFORMATDESCRIPTOR pfd;
+    pfd.nSize = sizeof(pfd);
+    DescribePixelFormat(This->display, 1, sizeof(pfd), &pfd);
+    SetPixelFormat(This->display, 1, &pfd);
+    /*THIS SHOULD NOT HAPPEN*/
+    FIXME("A swapchain was presented with an invalid HDC this is 
bad...\n");
+    FIXME("If this happens to you or a loved one... pray...");
+}
+#endif/*__WIN32_OPENGL__*/

                 TRACE("Creating a new context for the window %p \n", 
hDestWindowOverride);
                 ENTER_GL();
@@ -170,6 +173,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Pre

                 This->display    = get_display(hDc);
                 TRACE("Got display%p  for  %p %p\n",  This->display, hDc, 
hDestWindowOverride);
+#ifndef __WIN32_OPENGL__
                 ReleaseDC(hDestWindowOverride, hDc);
                 template.visualid = (VisualID)GetPropA(GetDesktopWindow(), 
"__wine_x11_visual_id");
                 This->visInfo   = XGetVisualInfo(This->display, 
VisualIDMask, &template, &num);
@@ -178,6 +182,8 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Pre
                     LEAVE_GL();
                     return D3DERR_NOTAVAILABLE;
                 }
+#else/*__WIN32_OPENGL__*/
+#endif/*__WIN32_OPENGL__*/
                 /* Now we have problems? well not really we just need to 
know what the implicit context is */
                 /* now destroy the old context and create a new one (we 
should really copy the buffers over, and do the whole make current thing! */
                 /* destroy the active context?*/
@@ -420,9 +426,13 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Set
     IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
     HDC hDC;
     TRACE("(%p) : pRamp@%p flags(%ld) \n", This, pRamp, Flags);
+#ifndef __WIN32_OPENGL__
     hDC = GetDC(This->win_handle);
     SetDeviceGammaRamp(hDC, (LPVOID)pRamp);
     ReleaseDC(This->win_handle, hDC);
+#else/*__WIN32_OPENGL__*/
+    SetDeviceGammaRamp(This->display, (LPVOID)pRamp);
+#endif/*__WIN32_OPENGL__*/
     return D3D_OK;

}
@@ -432,9 +442,13 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Get
     IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
     HDC hDC;
     TRACE("(%p) : pRamp@%p\n", This, pRamp);
+#ifndef __WIN32_OPENGL__
     hDC = GetDC(This->win_handle);
     GetDeviceGammaRamp(hDC, pRamp);
     ReleaseDC(This->win_handle, hDC);
+#else/*__WIN32_OPENGL__*/
+    GetDeviceGammaRamp(This->display, pRamp);
+#endif/*__WIN32_OPENGL__*/
     return D3D_OK;

}
Index: dlls/wined3d/volume.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/volume.c,v
retrieving revision 1.6
diff -u -w -b -d -p -r1.6 volume.c
--- dlls/wined3d/volume.c	13 Jul 2005 14:15:54 -0000	1.6
+++ dlls/wined3d/volume.c	16 Jul 2005 09:00:58 -0000
@@ -24,7 +24,10 @@
#include "wined3d_private.h"

WINE_DEFAULT_DEBUG_CHANNEL(d3d);
-#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl 
*)This->wineD3DDevice)->wineD3D))->gl_info
+/*that below glinfo is wrong*/
+/*#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl 
*)This->wineD3DDevice)->wineD3D))->gl_info*/
+/*correction*/
+#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl 
*)This->resource.wineD3DDevice)->wineD3D))->gl_info

/* *******************************************
    IWineD3DVolume IUnknown parts follow
@@ -255,7 +258,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_LoadTe
             D3DFmt2GLFmt(myDevice, This->currentDesc.Format),
             D3DFmt2GLType(myDevice, This->currentDesc.Format),
             This->resource.allocatedMemory);
-    glTexImage3D(GL_TEXTURE_3D,
+    GL_EXTCALL(glTexImage3D)(GL_TEXTURE_3D,
                     gl_level,
                     D3DFmt2GLIntFmt(myDevice, This->currentDesc.Format),
                     This->currentDesc.Width,
Index: dlls/wined3d/wined3d_main.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/wined3d_main.c,v
retrieving revision 1.10
diff -u -w -b -d -p -r1.10 wined3d_main.c
--- dlls/wined3d/wined3d_main.c	13 Jul 2005 14:15:54 -0000	1.10
+++ dlls/wined3d/wined3d_main.c	16 Jul 2005 09:00:58 -0000
@@ -86,12 +86,15 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL,

        DisableThreadLibraryCalls(hInstDLL);

+#ifndef __WIN32_OPENGL__
        mod = GetModuleHandleA( "winex11.drv" );
        if (mod)
        {
            wine_tsx11_lock_ptr   = (void *)GetProcAddress( mod, 
"wine_tsx11_lock" );
            wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, 
"wine_tsx11_unlock" );
        }
+#else/*__WIN32_OPENGL__*/
+#endif/*__WIN32_OPENGL__*/
        /* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
        if ( !RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", 
&hkey) )
        {
Index: dlls/wined3d/wined3d_private.h
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/wined3d_private.h,v
retrieving revision 1.40
diff -u -w -b -d -p -r1.40 wined3d_private.h
--- dlls/wined3d/wined3d_private.h	15 Jul 2005 09:54:57 -0000	1.40
+++ dlls/wined3d/wined3d_private.h	16 Jul 2005 09:00:58 -0000
@@ -40,6 +40,9 @@
#include "d3d9.h"
#include "d3d9types.h"
#include "wine/wined3d_interface.h"
+  /*NEW*//*This is a bad solution but it changes very little*/
+  #include "win_X_utils.h"
+  /*new*/
#include "wine/wined3d_gl.h"

/* Device caps */
@@ -79,6 +82,7 @@ extern int ps_mode;
#define PS_NONE 0
#define PS_HW   1

+#ifndef __WIN32_OPENGL__
/* X11 locking */

extern void (*wine_tsx11_lock_ptr)(void);
@@ -94,6 +98,10 @@ extern int num_lock;
#define ENTER_GL() wine_tsx11_lock_ptr()
#define LEAVE_GL() wine_tsx11_unlock_ptr()
#endif
+#else/*__WIN32_OPENGL__*/
+#define ENTER_GL()
+#define LEAVE_GL()
+#endif/*__WIN32_OPENGL__*/

/*****************************************************************************
  * Defines
@@ -118,6 +126,7 @@ extern int num_lock;

/* Note: The following is purely to keep the source code as clear from 
#ifdefs as possible */
#if defined(GL_VERSION_1_3)
+#ifndef __WIN32_OPENGL__
#define GLACTIVETEXTURE(textureNo)                          \
             glActiveTexture(GL_TEXTURE0 + textureNo);       \
             checkGLcall("glActiveTexture");
@@ -132,6 +141,23 @@ extern int num_lock;
#define GLMULTITEXCOORD4F(a,b,c,d,e)                        \
             glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
#define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
+#else/*__WIN32_OPENGL__*/
+#define GLACTIVETEXTURE(textureNo)                          \
+            GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + textureNo));       \
+            checkGLcall("glActiveTexture");
+#define GLCLIENTACTIVETEXTURE(textureNo)                    \
+            GL_EXTCALL(glClientActiveTexture(GL_TEXTURE0 + textureNo));
+#define GLMULTITEXCOORD1F(a,b)                              \
+            GL_EXTCALL(glMultiTexCoord1f(GL_TEXTURE0 + a, b));
+#define GLMULTITEXCOORD2F(a,b,c)                            \
+            GL_EXTCALL(glMultiTexCoord2f(GL_TEXTURE0 + a, b, c));
+#define GLMULTITEXCOORD3F(a,b,c,d)                          \
+            GL_EXTCALL(glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d));
+#define GLMULTITEXCOORD4F(a,b,c,d,e)                        \
+            GL_EXTCALL(glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e));
+#define GLTEXTURECUBEMAP GL_TEXTURE_CUBE_MAP
+#endif/*__WIN32_OPENGL__*/
+
#else
#define GLACTIVETEXTURE(textureNo)                             \
             glActiveTextureARB(GL_TEXTURE0_ARB + textureNo);   \
@@ -868,6 +894,10 @@ typedef struct IWineD3DSwapChainImpl
     GLXContext              render_ctx;
     /* This has been left in device for now, but needs moving off into a 
rendertarget management class and separated out from swapchains and devices. 
*/
     Drawable                drawable;
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+	WNDPROC                 oldFunc;
+#endif/*__WIN32_OPENGL__*/
} IWineD3DSwapChainImpl;

extern IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
...
Index: include/wine/wined3d_gl.h
===================================================================
RCS file: /home/wine/wine/include/wine/wined3d_gl.h,v
retrieving revision 1.8
diff -u -w -b -d -p -r1.8 wined3d_gl.h
--- include/wine/wined3d_gl.h	13 Jul 2005 11:34:55 -0000	1.8
+++ include/wine/wined3d_gl.h	16 Jul 2005 09:00:58 -0000
@@ -36,15 +36,25 @@
#define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
#include <GL/gl.h>
#define GL_GLEXT_PROTOTYPES
+#ifndef __WIN32_OPENGL__
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
+#else/*__WIN32_OPENGL__*/
+#endif/*__WIN32_OPENGL__*/
#ifdef HAVE_GL_GLEXT_H
# include <GL/glext.h>
#endif
#undef  XMD_H

+#ifndef __WIN32_OPENGL__
#undef APIENTRY
#define APIENTRY
+#else/*__WIN32_OPENGL__*/
+ #undef APIENTRY
+ #define CALLBACK    __stdcall
+ #define WINAPI      __stdcall
+ #define APIENTRY    WINAPI
+#endif/*__WIN32_OPENGL__*/

/****************************************************
  * OpenGL Extensions (EXT and ARB)
@@ -713,6 +723,20 @@ typedef void          (APIENTRY * PGLXFN


/****************************************************
+ * Needed for Windows
+ ****************************************************/
+typedef void (APIENTRY * PGLFNMULTITEXCOORD1FPROC) (GLenum target, GLfloat 
s);
+typedef void (APIENTRY * PGLFNMULTITEXCOORD2FPROC) (GLenum target, GLfloat 
s, GLfloat t);
+typedef void (APIENTRY * PGLFNMULTITEXCOORD3FPROC) (GLenum target, GLfloat 
s, GLfloat t, GLfloat r);
+typedef void (APIENTRY * PGLFNMULTITEXCOORD4FPROC) (GLenum target, GLfloat 
s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRY * PGLFNCLIENTACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRY * PGLFNACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRY * PGLFNBLENDEQUATION) ( GLenum mode );
+typedef void (APIENTRY * PGLFNBLENDCOLOR) ( GLclampf red,GLclampf 
green,GLclampf blue,GLclampf alpha );
+typedef void (APIENTRY * PGLFNTEXIMAGE3D) ( GLenum target,GLint 
level,GLenum internalformat,GLsizei width,GLsizei height,GLsizei depth,GLint 
border,GLenum format,GLenum type,const GLvoid *pixels );
+
+
+/****************************************************
  * Enumerated types
  ****************************************************/
typedef enum _GL_Vendors {
@@ -855,6 +879,21 @@ typedef enum _GL_SupportedExt {
     USE_GL_FUNC(PGLFNVERTEXATTRIBPOINTERARBPROC,      
glVertexAttribPointerARB); \
     USE_GL_FUNC(PGLFNENABLEVERTEXATTRIBARRAYARBPROC,  
glEnableVertexAttribArrayARB); \
     USE_GL_FUNC(PGLFNDISABLEVERTEXATTRIBARRAYARBPROC, 
glDisableVertexAttribArrayARB); \
+/* For Windows */\
+    USE_GL_FUNC(PGLFNMULTITEXCOORD1FPROC,            glMultiTexCoord1f); \
+    USE_GL_FUNC(PGLFNMULTITEXCOORD2FPROC,            glMultiTexCoord2f); \
+    USE_GL_FUNC(PGLFNMULTITEXCOORD3FPROC,            glMultiTexCoord3f); \
+    USE_GL_FUNC(PGLFNMULTITEXCOORD4FPROC,            glMultiTexCoord4f); \
+    USE_GL_FUNC(PGLFNCLIENTACTIVETEXTUREPROC,        
glClientActiveTexture); \
+    USE_GL_FUNC(PGLFNACTIVETEXTUREPROC,              glActiveTexture); \
+    USE_GL_FUNC(PGLFNBLENDEQUATION,                  glBlendEquation); \
+    USE_GL_FUNC(PGLFNBLENDCOLOR,                     glBlendColor); \
+    USE_GL_FUNC(PGLFNTEXIMAGE3D,                     glTexImage3D); \
+    USE_GL_FUNC(PFNWGLCHOOSEPIXELFORMATARBPROC,      
wglChoosePixelFormatARB); \
+    USE_GL_FUNC(PFNWGLCREATEPBUFFERARBPROC,          wglCreatePbufferARB); 
\
+    USE_GL_FUNC(PFNWGLDESTROYPBUFFERARBPROC,         wglDestroyPbufferARB); 
\
+    USE_GL_FUNC(PFNWGLSWAPINTERVALEXTPROC,           wglSwapIntervalEXT); \
+

#define GLX_EXT_FUNCS_GEN \
     /** GLX_VERSION_1_3 **/ \
...--- /dev/null	2005-07-16 02:04:28.760000000 -0700
+++ dlls/wined3d/Makefile	2005-07-16 01:56:40.000000000 -0700
@@ -0,0 +1,469 @@
+TOPSRCDIR = ../..
+TOPOBJDIR = ../..
+SRCDIR    = .
+
+MODULE    = wined3d.dll
+IMPORTLIB = libwined3d.$(IMPLIBEXT)
+#IMPORTS   = user32 gdi32 advapi32 kernel32
+#EXTRAINCL =  -I/usr/X11R6/include
+#EXTRALIBS = -ldxguid -luuid  -L/usr/X11R6/lib  -lSM -lICE -lXext -lX11  
-lGL -lGLU
+IMPORTS   = user32 gdi32 advapi32 kernel32 opengl32 msvcrt winmm
+EXTRAINCL = -I/usr/include/w32api
+EXTRALIBS = -ldxguid -luuid
+
+C_SRCS = \
+	basetexture.c \
+	cubetexture.c \
+	device.c \
+	directx.c \
+	drawprim.c \
+	indexbuffer.c \
+	query.c \
+	resource.c \
+	stateblock.c \
+	surface.c \
+	swapchain.c \
+	texture.c \
+	utils.c \
+	vertexbuffer.c \
+	vertexdeclaration.c \
+	vertexshader.c \
+	volume.c \
+	volumetexture.c \
+		win_X_utils.c \
+	wined3d_main.c
+#	pixelshader.c \
+#	snoop.c \
+
+
+# Global rules for building dlls     -*-Makefile-*-
+#
+# Each individual makefile should define the following variables:
+# MODULE       : name of the main module being built
+# EXTRALIBS    : extra libraries to link in (optional)
+# SPEC_SRCS16  : interface definition files for 16-bit dlls (optional)
+# SUBSYSTEM    : (optional) subsystem (for native dlls)
+#
+# plus all variables required by the global Make.rules.in
+#
+
+DLLDEFS     =
+DLLFLAGS    = -D_REENTRANT
+DLLEXT      =
+IMPLIBEXT   = a
+DEFS        = -D__WINESRC__ $(DLLDEFS) $(EXTRADEFS)
+BASEMODULE  = $(MODULE:%.dll=%)
+MAINSPEC    = $(BASEMODULE).spec
+SPEC_DEF    = lib$(BASEMODULE).def
+WIN16_FILES = $(SPEC_SRCS16:.spec=.spec.o) $(C_SRCS16:.c=.o) 
$(EXTRA_OBJS16)
+ALL_OBJS    =  $(OBJS) $(MODULE).dbg.o $(RC_SRCS:.rc=.res)
+#ALL_OBJS    =  $(OBJS) $(RC_SRCS:.rc=.res)
+ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
+#ALL_LIBS    = $(EXTRALIBS) $(LIBPORT) $(LDFLAGS) $(LIBS)
+ALL_IMPORTS = $(DELAYIMPORTS) $(IMPORTS)
+IMPLIB_OBJS = $(IMPLIB_SRCS:.c=.o)
+STATICIMPLIB= $(IMPORTLIB:.def=.def.a)
+DLL_LDPATH  = -L$(DLLDIR) $(ALL_IMPORTS:%=-L$(DLLDIR)/%)
+
+all: $(MODULE)$(DLLEXT) $(SUBDIRS)
+
+
+# Global rules shared by all makefiles     -*-Makefile-*-
+#
+# Each individual makefile must define the following variables:
+# TOPSRCDIR    : top-level source directory
+# TOPOBJDIR    : top-level object directory
+# SRCDIR       : source directory for this module
+# MODULE       : name of the module being built
+#
+# Each individual makefile may define the following additional variables:
+# C_SRCS       : C sources for the module
+# C_SRCS16     : 16-bit C sources for the module
+# RC_SRCS      : resource source files
+# EXTRA_SRCS   : extra source files for make depend
+# EXTRA_OBJS   : extra object files
+# IMPORTS      : dlls to import
+# DELAYIMPORTS : dlls to import in delayed mode
+# SUBDIRS      : subdirectories that contain a Makefile
+# EXTRASUBDIRS : subdirectories that do not contain a Makefile
+# INSTALLSUBDIRS : subdirectories to run make install/uninstall into
+
+# First some useful definitions
+
+SHELL     = /bin/sh
+CC        = gcc
+CFLAGS    = -g -O2
+#CFLAGS    = -O2
+CPPFLAGS  =
+LIBS      =
+BISON     = bison
+YACC      = $(BISON) -y
+LEX       = flex
+LEXLIB    = -lfl
+EXEEXT    = .exe
+OBJEXT    = o
+LIBEXT    = dll
+DLLEXT    =
+IMPLIBEXT = a
+LDSHARED  =
+DLLTOOL   = dlltool
+DLLWRAP   = dllwrap
+AR        = ar rc
+RANLIB    = ranlib
+STRIP     = strip
+WINDRES   = windres
+LN        = ln
+LN_S      = ln -s
+TOOLSDIR  = $(TOPOBJDIR)
+AS        = as
+LD        = ld
+LDFLAGS   =
+RM        = rm -f
+MV        = mv
+LINT      =
+LINTFLAGS =
+FONTFORGE = false
+INCLUDES     = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include 
-I$(TOPOBJDIR)/include $(EXTRAINCL)
+EXTRACFLAGS  = -Wall -pipe -mpreferred-stack-boundary=2 
-fno-strict-aliasing -gstabs+ -Wpointer-arith
+#EXTRACFLAGS  = -Wall -pipe -mpreferred-stack-boundary=2 
-fno-strict-aliasing -Wpointer-arith
+ALLCFLAGS    = $(INCLUDES) $(DEFS) $(DLLFLAGS) $(EXTRACFLAGS) $(CPPFLAGS) 
$(CFLAGS)
+ALLLINTFLAGS = $(INCLUDES) $(DEFS) $(LINTFLAGS)
+IDLFLAGS     = $(INCLUDES) $(DEFS) $(EXTRAIDLFLAGS)
+MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs -m 755
+WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi/winapi_check
+WINEWRAPPER  = $(TOPSRCDIR)/tools/winewrapper
+C2MAN        = $(TOPSRCDIR)/tools/c2man.pl
+RUNTEST      = $(TOPSRCDIR)/tools/runtest
+WINEBUILD    = $(TOOLSDIR)/tools/winebuild/winebuild
+MAKEDEP      = $(TOOLSDIR)/tools/makedep
+MAKECTESTS   = $(TOOLSDIR)/tools/make_ctests
+WRC          = $(TOOLSDIR)/tools/wrc/wrc
+BIN2RES      = $(TOOLSDIR)/tools/bin2res
+WMC          = $(TOOLSDIR)/tools/wmc/wmc
+WIDL         = $(TOOLSDIR)/tools/widl/widl
+WINEGCC      = $(TOOLSDIR)/tools/winegcc/winegcc
+SFNT2FNT     = $(TOOLSDIR)/tools/sfnt2fnt
+FNT2FON      = $(TOOLSDIR)/tools/fnt2fon
+RC           = $(WRC)
+RC16         = $(WRC)
+RCFLAGS      = --nostdinc $(INCLUDES) $(DEFS) $(EXTRARCFLAGS)
+RC16FLAGS    = -O res16 $(RCFLAGS)
+LDPATH       = PATH="$(TOOLSDIR)/libs/unicode:$$PATH"
+DLLDIR       = $(TOPOBJDIR)/dlls
+LIBDIR       = $(TOPOBJDIR)/libs
+LIBPORT      = -L$(TOPOBJDIR)/libs/port -lwine_port
+LIBUNICODE   = -L$(TOPOBJDIR)/libs/unicode -lwine_unicode
+LIBWINE      = -L$(TOPOBJDIR)/libs/wine -lwine
+
+
+
+# Installation infos
+
+INSTALL         = /usr/bin/install -c $(INSTALL_FLAGS)
+INSTALL_PROGRAM = ${INSTALL} $(INSTALL_PROGRAM_FLAGS)
+INSTALL_SCRIPT  = ${INSTALL} $(INSTALL_SCRIPT_FLAGS)
+INSTALL_DATA    = ${INSTALL} -m 644 $(INSTALL_DATA_FLAGS)
+prefix          = /usr/local
+exec_prefix     = ${prefix}
+bindir          = ${exec_prefix}/bin
+libdir          = ${exec_prefix}/lib
+datadir         = ${prefix}/share
+infodir         = ${prefix}/info
+mandir          = ${prefix}/man
+sysconfdir      = ${prefix}/etc
+includedir      = ${prefix}/include/wine
+dlldir          = ${exec_prefix}/lib/wine
+prog_manext     = 1
+api_manext      = 3w
+conf_manext     = 5
+CLEAN_FILES     = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* 
*.bak *.orig *.rej \
+                  *.flc *.spec.c *.dbg.c *.tab.c *.tab.h lex.yy.c core
+
+OBJS = $(C_SRCS:.c=.o) $(EXTRA_OBJS)
+
+RCOBJS = $(RC_SRCS:.rc=.res.o)
+LINTS  = $(C_SRCS:.c=.ln)
+
+# Implicit rules
+
+.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .idl .tlb .h .ok .sfd 
.ttf
+
+.c.o:
+	$(CC) -c $(ALLCFLAGS) -o $@ $<
+
+.s.o:
+	$(AS) -o $@ $<
+
+.mc.mc.rc:
+	$(LDPATH) $(WMC) -i -U -H /dev/null -o $@ $<
+
+.rc.res:
+	$(LDPATH) $(RC) $(RCFLAGS) -fo$@ $<
+
+.res.res.o:
+	$(WINDRES) -i $< -o $@
+
+.spec.spec.c:
+	$(WINEBUILD) $(DEFS) --dll -o $@ --main-module $(MODULE) --export $<
+
+.idl.h:
+	$(WIDL) $(IDLFLAGS) -h -H $@ $<
+
+.idl.tlb:
+	$(WIDL) $(IDLFLAGS) -t -T $@ $<
+
+.c.ln:
+	$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
+
+.c.ok:
+	$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
+
+.sfd.ttf:
+	$(FONTFORGE) -script $(TOPSRCDIR)/fonts/genttf.ff $<
+
+# 'all' target first in case the enclosing Makefile didn't define any 
target
+
+all: Makefile
+
+filter:
+	@$(TOPSRCDIR)/tools/winapi/make_filter --make $(MAKE) all
+
+.PHONY: all filter
+
+# Rules for resources
+
+$(RC_BINARIES): $(BIN2RES) $(RC_BINSRC)
+	$(BIN2RES) -f -o $@ $(SRCDIR)/$(RC_BINSRC)
+
+$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC) $(RC_BINARIES) $(RC_TLB)
+
+# Rule for main module debug channels
+
+$(MODULE).dbg.c: $(C_SRCS) $(C_SRCS16) $(WINEBUILD)
+	$(WINEBUILD) $(DEFS) -o $@ --debug -C$(SRCDIR) $(C_SRCS) $(C_SRCS16)
+
+# Rules for makefile
+
+Makefile: Makefile.in $(TOPSRCDIR)/configure
+	@echo Makefile is older than $?, please rerun $(TOPSRCDIR)/configure
+	@exit 1
+
+# Rule for linting
+
+$(MODULE).ln : $(LINTS)
+	if test "$(LINTS)" ; \
+	then \
+		$(LINT) $(ALLLINTFLAGS) -o$(MODULE) $(LINTS) ; \
+	        $(MV) llib-l$(MODULE).ln $(MODULE).ln ; \
+	else \
+		$(LINT) $(ALLLINTFLAGS) -C$(MODULE) /dev/null ; \
+	fi
+
+lint:: $(MODULE).ln
+
+# Rules for Windows API checking
+
+winapi_check:: dummy
+	$(WINAPI_CHECK) $(WINAPI_CHECK_FLAGS) $(WINAPI_CHECK_EXTRA_FLAGS) .
+
+.PHONY: winapi_check
+
+# Rules for dependencies
+
+$(SUBDIRS:%=%/__depend__): dummy
+	cd `dirname $@` && $(MAKE) depend
+
+depend: $(IDL_SRCS:.idl=.h) $(SUBDIRS:%=%/__depend__)
+	$(MAKEDEP) $(INCLUDES) -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) 
$(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(EXTRA_SRCS)
+
+.PHONY: depend $(SUBDIRS:%=%/__depend__)
+
+# Rules for cleaning
+
+$(SUBDIRS:%=%/__clean__): dummy
+	cd `dirname $@` && $(MAKE) clean
+
+$(SUBDIRS:%=%/__testclean__): dummy
+	cd `dirname $@` && $(MAKE) testclean
+
+$(EXTRASUBDIRS:%=%/__clean__): dummy
+	-cd `dirname $@` && $(RM) $(CLEAN_FILES)
+
+testclean:: $(SUBDIRS:%=%/__testclean__)
+
+clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
+	$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) 
$(MC_SRCS:.mc=.mc.rc) $(IDL_SRCS:.idl=.h) $(PROGRAMS) $(RC_BINARIES) 
$(RC_TLB)
+
+.PHONY: clean testclean $(SUBDIRS:%=%/__clean__) 
$(SUBDIRS:%=%/__testclean__) $(EXTRASUBDIRS:%=%/__clean__)
+
+# Rules for installing
+
+$(SUBDIRS:%=%/__install__): dummy
+	cd `dirname $@` && $(MAKE) install
+
+$(SUBDIRS:%=%/__install-lib__): dummy
+	cd `dirname $@` && $(MAKE) install-lib
+
+$(SUBDIRS:%=%/__install-dev__): dummy
+	cd `dirname $@` && $(MAKE) install-dev
+
+$(SUBDIRS:%=%/__uninstall__): dummy
+	cd `dirname $@` && $(MAKE) uninstall
+
+install:: $(INSTALLSUBDIRS:%=%/__install__)
+
+uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
+
+.PHONY: install install-lib install-dev uninstall \
+	$(SUBDIRS:%=%/__install__) $(SUBDIRS:%=%/__uninstall__) \
+	$(SUBDIRS:%=%/__install-lib__) $(SUBDIRS:%=%/__install-dev__)
+
+# Rules for checking that no imports are missing
+
+$(SUBDIRS:%=%/__checklink__): dummy
+	@cd `dirname $@` && $(MAKE) checklink
+
+.PHONY: checklink $(SUBDIRS:%=%/__checklink__)
+
+# Rules for testing
+
+$(SUBDIRS:%=%/__test__): dummy
+	@cd `dirname $@` && $(MAKE) test
+
+$(SUBDIRS:%=%/__crosstest__): dummy
+	@cd `dirname $@` && $(MAKE) crosstest
+
+.PHONY: check test crosstest $(SUBDIRS:%=%/__test__) 
$(SUBDIRS:%=%/__crosstest__)
+
+# Misc. rules
+
+$(MC_SRCS:.mc=.mc.rc): $(WMC)
+
+$(IDL_SRCS:.idl=.h): $(WIDL)
+
+$(RC_TLB:.idl=.tlb): $(WIDL)
+
+$(SUBDIRS): dummy
+	@cd $@ && $(MAKE)
+
+dummy:
+
+.PHONY: dummy $(SUBDIRS)
+
+# End of global rules
+
+# Rules for .so files
+
+$(MODULE).so: $(MAINSPEC) $(ALL_OBJS) Makefile.in
+	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -shared $(SRCDIR)/$(MAINSPEC) 
$(ALL_OBJS) $(SUBSYSTEM:%=-Wb,--subsystem,%) -o $@ $(DLL_LDPATH) 
$(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-Wb,-d%) $(ALL_LIBS)
+
+# Rules for .dll files
+
+$(MODULE): $(RCOBJS) $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in
+	$(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(MODULE).dbg.o 
$(DLL_LDPATH) $(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
+#$(MODULE): $(RCOBJS) $(OBJS) $(SPEC_DEF) Makefile.in
+#	$(DLLWRAP) -k --def $(SPEC_DEF) -o $@ $(RCOBJS) $(OBJS) $(DLL_LDPATH) 
$(ALL_IMPORTS:%=-l%) $(ALL_LIBS)
+
+# Rules for import libraries
+
+.PHONY: implib static_implib $(IMPLIB_OBJS:%=__static_implib__%)
+
+all implib: $(IMPORTLIB) $(IMPLIB_OBJS:%=__static_implib__%)
+
+$(IMPLIB_OBJS:%=__static_implib__%): $(STATICIMPLIB)
+
+lib$(BASEMODULE).def: $(MAINSPEC)
+	$(WINEBUILD) -w --def -o $@ --export $(SRCDIR)/$(MAINSPEC)
+
+lib$(BASEMODULE).def.a: $(IMPLIB_OBJS)
+	$(RM) $@
+	$(AR) $@ $(IMPLIB_OBJS)
+	$(RANLIB) $@
+
+lib$(BASEMODULE).a: $(SPEC_DEF) $(IMPLIB_OBJS)
+	$(DLLTOOL) -k -l $@ -d $(SPEC_DEF)
+	$(AR) $@ $(IMPLIB_OBJS)
+	$(RANLIB) $@
+
+# Rules for checking that no imports are missing
+
+.PHONY: checklink16 $(WIN16_FILES:%=__checklink16__%)
+
+$(WIN16_FILES:%=__checklink16__%): checklink16
+
+checklink16:: $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o dummy
+	$(CC) -o checklink -Wl,-rpath,$(TOPOBJDIR)/libs 
$(TOPSRCDIR)/dlls/checklink.c $(MAINSPEC).o $(OBJS) $(MODULE).dbg.o 
-L$(DLLDIR) $(ALL_LIBS) -lm && $(RM) checklink $(MAINSPEC).c $(MAINSPEC).o
+
+checklink:: $(WIN16_FILES:%=__checklink16__%)
+
+# Rules for testing
+
+check test:: $(SUBDIRS:%=%/__test__)
+
+crosstest:: $(SUBDIRS:%=%/__crosstest__)
+
+# Rule to explicitly generate the .spec.c for debugging
+
+$(MAINSPEC).c: $(MAINSPEC) $(ALL_OBJS)
+	$(WINEBUILD) $(DEFS) $(DLLFLAGS) --dll -o $@ --export 
$(SRCDIR)/$(MAINSPEC) $(SUBSYSTEM:%=--subsystem %) $(ALL_OBJS) $(DLL_LDPATH) 
$(ALL_IMPORTS:%=-l%) $(DELAYIMPORTS:%=-d%)
+
+# Rules for auto documentation
+
+man: $(C_SRCS)
+	$(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) 
-C$(SRCDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) 
$(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16)
+
+doc-html: $(C_SRCS)
+	$(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) -C$(SRCDIR) 
$(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) 
$(C_SRCS16)
+
+doc-sgml: $(C_SRCS)
+	$(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) 
-C$(SRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) 
$(C_SRCS) $(C_SRCS16)
+
+.PHONY: man doc-html doc-sgml
+
+# Rules for installation
+
+EXE_SPECS16 = $(SPEC_SRCS16:.exe.spec=.exe)
+DRV_SPECS16 = $(EXE_SPECS16:.drv.spec=.drv)
+ALL_SPECS16 = $(DRV_SPECS16:.spec=.dll)
+
+WIN16_INSTALL = $(ALL_SPECS16:%=_install_/%)
+
+.PHONY: install_lib install_static_implib_def install_static_implib_a
+.PHONY: $(ALL_SPECS16:%=_install_/%) $(IMPORTLIB:%=_install_/%) 
$(IMPLIB_OBJS:%=_install_static_implib_/%)
+
+$(ALL_SPECS16:%=_install_/%): install_lib
+	cd $(dlldir) && $(RM) `basename $@`$(DLLEXT) && $(LN_S) $(MODULE)$(DLLEXT) 
`basename $@`$(DLLEXT)
+
+install_lib: $(MODULE)$(DLLEXT)
+	$(MKINSTALLDIRS) $(dlldir)
+	$(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
+
+$(IMPORTLIB:%=_install_/%): $(IMPORTLIB)
+	$(MKINSTALLDIRS) $(dlldir)
+	$(INSTALL_DATA) $(IMPORTLIB) $(dlldir)/$(IMPORTLIB)
+
+install_static_implib_def: $(STATICIMPLIB)
+	$(MKINSTALLDIRS) $(dlldir)
+	$(INSTALL_DATA) $(STATICIMPLIB) $(dlldir)/$(STATICIMPLIB)
+
+install_static_implib_a:
+
+$(IMPLIB_OBJS:%=_install_static_implib_/%): 
install_static_implib_$(IMPLIBEXT)
+
+install install-lib:: install_lib
+
+install install-dev:: $(IMPORTLIB:%=_install_/%) 
$(IMPLIB_OBJS:%=_install_static_implib_/%)
+
+uninstall::
+	[ ! -d $(dlldir) ] || (cd $(dlldir) && $(RM) $(MODULE)$(DLLEXT) 
$(IMPORTLIB) $(STATICIMPLIB) $(ALL_SPECS16:%=%$(DLLEXT)))
+
+# Misc. rules
+
+clean::
+	$(RM) $(SPEC_DEF)
+
+$(SPEC_DEF) $(SPEC_SRCS16:.spec=.spec.c): $(WINEBUILD)
+
+# End of global dll rules
+
+### Dependencies:
--- /dev/null	2005-07-16 02:04:36.840000000 -0700
+++ dlls/wined3d/win_X_utils.c	2005-07-16 00:31:20.000000000 -0700
@@ -0,0 +1,318 @@
+#include "config.h"
+#include "wined3d_private.h"
+#include "mmsystem.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(d3d);
+
+#ifndef __WIN32_OPENGL__
+/* retrieve the X display to use on a given DC */
+inline Display *get_display( HDC hdc ) {
+    Display *display;
+    enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
+
+    if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
+                    sizeof(display), (LPSTR)&display )) display = NULL;
+    return display;
+}
+#else/*__WIN32_OPENGL__*/
+/* retrieve the given DC */
+inline Display *get_display( HDC hdc ) {
+    return (Display *)hdc;/*yes this looks retarded... it is retarded -- 
but saves time below*/
+}
+
+inline void D3DFmtMakePFD(WINED3DPRESENT_PARAMETERS* 
pPresentationParameters, LPPIXELFORMATDESCRIPTOR ppfd, BOOL alternate) {
+/* TODO: Instead of having a check for an exact match then an 'alternate' 
match,
+   we should workout the closest possible match and populate a lookup table 
*/
+    /* We need to do some Card specific stuff in here at some point,
+    D3D now support floating point format buffers, and their are a number 
of different OpenGl ways on managing these e.g.
+    GLX_ATI_pixel_format_float
+    */
+    /*this is extemely confusing...*/
+    ZeroMemory(ppfd, sizeof(PIXELFORMATDESCRIPTOR));
+    ppfd->nSize = sizeof(PIXELFORMATDESCRIPTOR);
+    ppfd->dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
+    /*PFD_GENERIC_ACCELERATED|*/
+    /*ppfd->iLayerType = PFD_MAIN_PLANE;*/
+
+/*Choose windowed mode*/
+    if (*(pPresentationParameters->Windowed)) {
+        ppfd->dwFlags |= PFD_DRAW_TO_WINDOW;
+    }
+
+/*Choose a SwapEffect*/
+/*???is the below acceptable???*/
+    switch (*(pPresentationParameters->SwapEffect)) {
+        /* color buffer */
+    case D3DSWAPEFFECT_FLIP:
+        ppfd->dwFlags |= PFD_SWAP_EXCHANGE;
+        break;
+    case D3DSWAPEFFECT_COPY:
+        ppfd->dwFlags |= PFD_SWAP_COPY;
+        break;
+    case D3DSWAPEFFECT_DISCARD:
+        /*ppfd->dwFlags |= PFD_SWAP_COPY;*/
+        FIXME("Application requested D3DSWAPEFFECT_DISCARD, I'm sorry, 
Dave. I'm afraid I can't do that...\n");
+        FIXME("  .: doing nothing\n");
+        /*????*/
+        break;
+    default:
+        FIXME("Unknown Swap Effect... %d\n", 
*(pPresentationParameters->SwapEffect));
+        break;
+    }
+
+/*Choose a BackBuffer Format*/
+    switch (*(pPresentationParameters->BackBufferFormat)) {
+        /* color buffer */
+    case WINED3DFMT_P8:
+        ppfd->iPixelType = PFD_TYPE_COLORINDEX;
+        ppfd->cColorBits = 8;
+        break;
+
+    case WINED3DFMT_R3G3B2:
+        ppfd->iPixelType = PFD_TYPE_RGBA;
+        ppfd->cRedBits   = 3;
+        ppfd->cGreenBits = 3;
+        ppfd->cBlueBits  = 2;
+        ppfd->cColorBits = 
ppfd->cRedBits+ppfd->cGreenBits+ppfd->cBlueBits+ppfd->cAlphaBits;
+        break;
+
+    case WINED3DFMT_A1R5G5B5:
+        ppfd->cAlphaBits = 1;
+    case WINED3DFMT_X1R5G5B5:
+        ppfd->iPixelType = PFD_TYPE_RGBA;
+        ppfd->cRedBits   = 5;
+        ppfd->cGreenBits = 5;
+        ppfd->cBlueBits  = 5;
+        ppfd->cColorBits = 
ppfd->cRedBits+ppfd->cGreenBits+ppfd->cBlueBits+ppfd->cAlphaBits;
+        break;
+
+    case WINED3DFMT_R5G6B5:
+        ppfd->iPixelType = PFD_TYPE_RGBA;
+        ppfd->cRedBits   = 5;
+        ppfd->cGreenBits = 6;
+        ppfd->cBlueBits  = 5;
+        ppfd->cColorBits = 
ppfd->cRedBits+ppfd->cGreenBits+ppfd->cBlueBits+ppfd->cAlphaBits;
+        break;
+
+    case WINED3DFMT_A4R4G4B4:
+        ppfd->cAlphaBits = 4;
+    case WINED3DFMT_X4R4G4B4:
+        ppfd->iPixelType = PFD_TYPE_RGBA;
+        ppfd->cRedBits   = 4;
+        ppfd->cGreenBits = 4;
+        ppfd->cBlueBits  = 4;
+        ppfd->cColorBits = 
ppfd->cRedBits+ppfd->cGreenBits+ppfd->cBlueBits+ppfd->cAlphaBits;
+        break;
+
+    case WINED3DFMT_A8R8G8B8:
+        ppfd->cAlphaBits = 8;
+    case WINED3DFMT_R8G8B8:
+    case WINED3DFMT_X8R8G8B8:
+        ppfd->iPixelType = PFD_TYPE_RGBA;
+        ppfd->cRedBits   = 8;
+        ppfd->cGreenBits = 8;
+        ppfd->cBlueBits  = 8;
+        ppfd->cColorBits = 
ppfd->cRedBits+ppfd->cGreenBits+ppfd->cBlueBits+ppfd->cAlphaBits;
+        break;
+    case WINED3DFMT_A2R10G10B10:
+        ppfd->iPixelType = PFD_TYPE_RGBA;
+        ppfd->cRedBits   = 10;
+        ppfd->cGreenBits = 10;
+        ppfd->cBlueBits  = 10;
+        ppfd->cAlphaBits = 2;
+        ppfd->cColorBits = 
ppfd->cRedBits+ppfd->cGreenBits+ppfd->cBlueBits+ppfd->cAlphaBits;
+        break;
+    default:
+        break;
+    }
+
+/*Choose a DepthStencil Format*/
+    if (*(pPresentationParameters->EnableAutoDepthStencil)) {
+        switch (*(pPresentationParameters->AutoDepthStencilFormat)) {
+        case WINED3DFMT_D16_LOCKABLE:
+        case WINED3DFMT_D16:
+            ppfd->cDepthBits   = 16;
+            ppfd->cStencilBits = 0;
+            break;
+
+        case WINED3DFMT_D15S1:
+            ppfd->cDepthBits   = 15;
+            ppfd->cStencilBits = 1;
+            /* Does openGl support a 1bit stencil?, I've seen it used 
elsewhere
+            e.g. 
http://www.ks.uiuc.edu/Research/vmd/doxygen/OpenGLDisplayDevice_8C-source.html 
*/
+            break;
+
+        case WINED3DFMT_D24X8:
+            ppfd->cDepthBits   = 24;
+            ppfd->cStencilBits = 0;
+            break;
+
+        case WINED3DFMT_D24X4S4:
+            ppfd->cDepthBits   = 24;
+            ppfd->cStencilBits = 4;
+            break;
+
+        case WINED3DFMT_D24S8:
+            ppfd->cDepthBits   = 24;
+            ppfd->cStencilBits = 8;
+            break;
+
+        case WINED3DFMT_D32:
+        case WINED3DFMT_D32F_LOCKABLE:
+            ppfd->cDepthBits   = 32;
+            ppfd->cStencilBits = 0;
+            break;
+
+        default:
+            break;
+        }
+    }
+}
+
+inline HGLRC wglCreateContextAndShare(HDC display, HGLRC context) {
+    HGLRC newContext;
+    newContext = wglCreateContext(display);
+    if (context != NULL) {
+        wglShareLists(context, newContext);
+    }
+    return newContext;
+}
+
+inline int wglQueryVersion(HDC display, int *major, int *minor) {
+/*fix these magic numbers*/
+    *major = 100;
+    *minor = 100;
+    return 1;
+}
+
+#if 0
+inline HPBUFFERARB wglCreatePbuffer(HDC display, DWORD cfgs, int* attribs) 
{
+    int width = ;
+    int height = ;
+    return wglCreatePbufferARB(display, cfgs, width, height, attribs);
+}
+#endif
+
+inline void SwapInterval(WINED3DPRESENT_PARAMETERS* 
pPresentationParameters) {
+/*VSYNC for Windows patch*/
+/*???Should this be done here???*/
+/*Accoroding to MSDN each HWND should have a member that is a 
D3DPRESENT_PARAMETERS*/
+/*???Should I put MSDN link here???*/
+/*D3DPRESENT_INTERVAL_ONE, TWO, ... are not defined in order a simple 
subtraction would not help... .: full switch YEAH*/
+/*???Should this be a function in win_X_utils.h???*/
+    TRACE("Setting VSYNC\n");
+    TRACE("PresentationInterval == %d\n", 
*(pPresentationParameters->PresentationInterval));
+    int interval = 0;
+
+/*Choose an interval*/
+    switch (*(pPresentationParameters->PresentationInterval)) {
+#if 0
+    case D3DPRESENT_DONOTWAIT:
+        FIXME("Application requested D3DPRESENT_DONOTWAIT I dont know how 
to make present not wait? is this possible in OpenGL?...\n");
+        interval = 0;
+        break;
+    case D3DPRESENT_LINEAR_CONTENT:
+        FIXME("Application requested D3DPRESENT_LINEAR_CONTENT I dont know 
what this means or how to do it...\n");
+        /*interval = ???;*/
+        break;
+#endif
+    case D3DPRESENT_INTERVAL_DEFAULT:
+        interval = 1;
+        break;
+    case D3DPRESENT_INTERVAL_ONE:
+        /*D3DPRESENT_INTERVAL_ONE calls timeBeginPeriod increase the 
accuracy of the system timer. It and default both VSYNC best as possible -- 
this is according to the MSDN*/
+        /*???Should I put MSDN link here???*/
+        timeBeginPeriod(1);/*???...timeEndPeriod(???) WHERE???*/
+        interval = 1;
+        break;
+    case D3DPRESENT_INTERVAL_TWO:
+        interval = 2;
+        break;
+    case D3DPRESENT_INTERVAL_THREE:
+        interval = 3;
+        break;
+    case D3DPRESENT_INTERVAL_FOUR:
+        interval = 4;
+        break;
+    case D3DPRESENT_INTERVAL_IMMEDIATE:
+        interval = 0;
+        break;
+    default:
+        FIXME("Unknown Presentation Interval... %d\n", 
*(pPresentationParameters->PresentationInterval));
+        break;
+    }
+
+/*this is a bad way of doing this FIX IT*/
+    PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = 
wglGetProcAddress("wglSwapIntervalEXT");
+    if (wglSwapIntervalEXT != NULL) {
+       TRACE("wglSwapInterval(%d) called\n", interval);
+       wglSwapIntervalEXT(interval);
+    } else {
+        FIXME("wglSwapIntervalEXT == %d\n", (int)wglSwapIntervalEXT);
+    }
+}
+
+/*???remove window resizing??? -- use offscreen buffers?*/
+/*window hooking stuff*/
+/*REMOVE -- DO THIS ON CALL TO PRESENT??*/
+/*DO ALL RESIZING ON PRESENT CALL?????*/
+/*Using SetProp to store swapchain implementation*/
+/*INCLUDE WINCON.H INSTEAD*/
+LRESULT CALLBACK WindowResizeProc(HWND hwnd, UINT uMsg, WPARAM wParam, 
LPARAM lParam) {
+/*a better way for this to act -- to catch all odd problems -- 
http://www.elec.ryukoku.ac.jp/~fujii/pub/ftp/freebsd/3.3/Mesa-3.0/src/FX/fxwgl.c*/
+/*         that may also help for offscreen rendering?*/
+/*HOW SHOULD THIS INTERACT WITH FULL SCREEN APPS?*/
+    RECT client;
+    /*LPWINDOWPOS lpwp;*/
+    WINED3DVIEWPORT vp;
+    WINED3DSURFACET_DESC* pCurrentDesc;
+    IWineD3DSwapChainImpl* swapChain = NULL;
+
+    swapChain = (IWineD3DSwapChainImpl*)GetPropA(hwnd, 
WINED3D_SWAPCHAIN_PROPERTY);
+    if(swapChain == NULL || swapChain->oldFunc == NULL) {
+        return DefWindowProcA(hwnd, uMsg, wParam, lParam);
+    }
+    switch(uMsg) {
+    case WM_SIZE:
+    /*case WM_SIZING:*/
+    /*case WM_WINDOWPOSCHANGED:*//*has race conditions*/
+#if 1
+        if((wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED) && 
(swapChain->wineD3DDevice != NULL && swapChain->wineD3DDevice->renderTarget 
!= NULL)) {
+#else
+        if(swapChain->frontBuffer != NULL) {
+#endif
+            /*lpwp = (LPWINDOWPOS)lParam;*/
+            GetClientRect(hwnd, &client);
+#if 1
+            pCurrentDesc = &(((IWineD3DSurfaceImpl 
*)swapChain->wineD3DDevice->renderTarget)->currentDesc);
+#else
+            pCurrentDesc = &(((IWineD3DSurfaceImpl 
*)swapChain->frontBuffer)->currentDesc);
+#endif
+            if(pCurrentDesc != NULL && (client.right != pCurrentDesc->Width 
|| client.bottom != pCurrentDesc->Height)) {
+                vp.X      = 0;
+                vp.Y      = 0;
+                vp.Width  = client.right;/*lpwp->cx;*/
+                vp.Height = client.bottom;/*lpwp->cy;*/
+                vp.MinZ   = 0.0f;
+                vp.MaxZ   = 1.0f;
+                pCurrentDesc->Width  = vp.Width;
+                pCurrentDesc->Height = vp.Height;
+#if 1
+                
IWineD3DDevice_SetViewport((IWineD3DDevice*)swapChain->wineD3DDevice, &vp);
+#else
+                glViewport(0, 0, vp.Width, vp.Height);
+        	    /*must set stateblock viewport for clear to work properly*/
+#endif
+/*THIS IS INCORRECT -- BUT IT IS THE GROUND WORK*/
+/*IT SHOULD STRETCH THE OUTPUT TO FIT -- NOT EXTEND THE VIEWPORT*/
+/*THIS MAY ALSO MISS SOME CASES*/
+/*ALT-ENTER DOES NOT WORK*/
+            }
+        }
+        break;
+    default:
+        break;
+    }
+    return CallWindowProcA(swapChain->oldFunc, hwnd, uMsg, wParam, lParam);
+}
+#endif/*__WIN32_OPENGL__*/
--- /dev/null	2005-07-16 02:04:40.350000000 -0700
+++ dlls/wined3d/win_X_utils.h	2005-07-16 01:35:34.000000000 -0700
@@ -0,0 +1,211 @@
+#ifndef __WIN_X_UTILS__
+#define __WIN_X_UTILS__
+
+/*this uses win32 opengl instead of glx*/
+#if defined(__CYGWIN__) || defined(WIN32)
+/*specifically cygwin needs this to even work -- maybe?*/
+#define __WIN32_OPENGL__
+#endif
+
+#ifdef __WIN32_OPENGL__
+#include "../opengl32/wgl.h"
+
+/*wglext definitions start -- these should not be here*/
+#ifndef WGL_ARB_pbuffer
+DECLARE_HANDLE(HPBUFFERARB);
+#endif
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_DRAW_TO_PBUFFER_ARB        0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB     0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB      0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB     0x2030
+#define WGL_PBUFFER_LARGEST_ARB        0x2033
+#define WGL_PBUFFER_WIDTH_ARB          0x2034
+#define WGL_PBUFFER_HEIGHT_ARB         0x2035
+#define WGL_PBUFFER_LOST_ARB           0x2036
+#endif
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_NUMBER_PIXEL_FORMATS_ARB   0x2000
+#define WGL_DRAW_TO_WINDOW_ARB         0x2001
+#define WGL_DRAW_TO_BITMAP_ARB         0x2002
+#define WGL_ACCELERATION_ARB           0x2003
+#define WGL_NEED_PALETTE_ARB           0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB    0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB     0x2006
+#define WGL_SWAP_METHOD_ARB            0x2007
+#define WGL_NUMBER_OVERLAYS_ARB        0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB       0x2009
+#define WGL_TRANSPARENT_ARB            0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB  0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB            0x200C
+#define WGL_SHARE_STENCIL_ARB          0x200D
+#define WGL_SHARE_ACCUM_ARB            0x200E
+#define WGL_SUPPORT_GDI_ARB            0x200F
+#define WGL_SUPPORT_OPENGL_ARB         0x2010
+#define WGL_DOUBLE_BUFFER_ARB          0x2011
+#define WGL_STEREO_ARB                 0x2012
+#define WGL_PIXEL_TYPE_ARB             0x2013
+#define WGL_COLOR_BITS_ARB             0x2014
+#define WGL_RED_BITS_ARB               0x2015
+#define WGL_RED_SHIFT_ARB              0x2016
+#define WGL_GREEN_BITS_ARB             0x2017
+#define WGL_GREEN_SHIFT_ARB            0x2018
+#define WGL_BLUE_BITS_ARB              0x2019
+#define WGL_BLUE_SHIFT_ARB             0x201A
+#define WGL_ALPHA_BITS_ARB             0x201B
+#define WGL_ALPHA_SHIFT_ARB            0x201C
+#define WGL_ACCUM_BITS_ARB             0x201D
+#define WGL_ACCUM_RED_BITS_ARB         0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB       0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB        0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB       0x2021
+#define WGL_DEPTH_BITS_ARB             0x2022
+#define WGL_STENCIL_BITS_ARB           0x2023
+#define WGL_AUX_BUFFERS_ARB            0x2024
+#define WGL_NO_ACCELERATION_ARB        0x2025
+#define WGL_GENERIC_ACCELERATION_ARB   0x2026
+#define WGL_FULL_ACCELERATION_ARB      0x2027
+#define WGL_SWAP_EXCHANGE_ARB          0x2028
+#define WGL_SWAP_COPY_ARB              0x2029
+#define WGL_SWAP_UNDEFINED_ARB         0x202A
+#define WGL_TYPE_RGBA_ARB              0x202B
+#define WGL_TYPE_COLORINDEX_ARB        0x202C
+#endif
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int 
iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, 
int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int 
iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, 
FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int 
*piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int 
*piFormats, UINT *nNumFormats);
+#endif
+
+#ifndef WGL_EXT_swap_control
+#define WGL_EXT_swap_control 1
+typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
+typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
+#endif
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int 
iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, 
HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, 
int iAttribute, int *piValue);
+#endif
+/*wglext definitions end*/
+
+/*REMOVE*/
+  BOOL      WINAPI wglSetPixelFormat(HDC, int, const 
PIXELFORMATDESCRIPTOR*);
+/*remove*/
+#endif/*__WIN32_OPENGL__*/
+
+/* some useful defines for windows */
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+  #define glXMakeCurrent(display, drawable, context) 
wglMakeCurrent(display, context)
+  #define glXMakeContextCurrent(display, draw, read, context) 
wglMakeContextCurrentARB(draw, read, context)
+  #define glXDestroyContext(display, context) wglDeleteContext(context)
+  #define glXCreateContext(display, visInfo, context, direct) 
wglCreateContextAndShare(display, context)
+  #define glXGetProcAddressARB(procName) wglGetProcAddress(procName)
+  #define glXGetCurrentContext() wglGetCurrentContext()
+  #define glXGetCurrentDrawable() WindowFromDC(wglGetCurrentDC())
+  #define glXGetCurrentDisplay() wglGetCurrentDC()
+/*remove glFinish from here -- glFlush may be needed*/
+  #define glXSwapBuffers(display, drawable) SwapBuffers(display)
+  #define glXQueryVersion(display, major, minor) wglQueryVersion(display, 
major, minor)
+  #define glXGetClientString(display, vendor) glGetString(GL_VENDOR)
+/*#define glXCreatePbuffer(display, cfgs, attribs) 
wglCreatePbufferARB(display, cfgs, iWidth, iHeight, attribs);*/
+  #define glXDestroyPbuffer(display, pbuffer) 
GL_EXTCALL(wglDestroyPbufferARB)(pbuffer)
+  #define XFree(object)
+  #define Bool BOOL
+  #define True TRUE
+  #define False FALSE
+  #define None FALSE
+#endif/*__WIN32_OPENGL__*/
+
+#ifndef __WIN32_OPENGL__
+/* x11drv GDI escapes */
+#define X11DRV_ESCAPE 6789
+enum x11drv_escape_codes
+{
+    X11DRV_GET_DISPLAY,   /* get X11 display for a DC */
+    X11DRV_GET_DRAWABLE,  /* get current drawable for a DC */
+    X11DRV_GET_FONT,      /* get current X font for a DC */
+};
+
+#else/*__WIN32_OPENGL__*/
+
+/* void* == HDC */
+/* Display* == HDC */
+ typedef void        Display;
+ typedef HWND        Window;
+ typedef HWND        Drawable;
+ typedef DWORD       Pixmap;
+ typedef DWORD       Visual;
+ typedef DWORD       XVisualInfo;
+ typedef DWORD       XWindowAttributes;
+ typedef HGLRC       GLXContext;
+ typedef HWND        GLXWindow;
+ typedef HWND        GLXDrawable;
+ typedef DWORD       GLXFBConfig;
+ typedef DWORD       GLXPixmap;/*not used*/
+ typedef HPBUFFERARB GLXPbuffer;
+
+ #define GLX_X_RENDERABLE    WGL_SUPPORT_OPENGL_ARB
+ #define GLX_DOUBLEBUFFER    WGL_DOUBLE_BUFFER_ARB
+
+/*these work differently*/
+ /*#define GLX_DRAWABLE_TYPE
+  #define GLX_PBUFFER_BIT     WGL_DRAW_TO_PBUFFER_ARB
+  #define GLX_WINDOW_BIT      WGL_DRAW_TO_WINDOW_ARB*/
+
+ #define GLX_RENDER_TYPE      WGL_PIXEL_TYPE_ARB
+  #define GLX_RGBA_BIT        WGL_TYPE_RGBA_ARB
+  #define GLX_COLOR_INDEX_BIT WGL_TYPE_COLORINDEX_ARB
+
+ #define GLX_PBUFFER_WIDTH    WGL_PBUFFER_WIDTH_ARB
+ #define GLX_PBUFFER_HEIGHT   WGL_PBUFFER_HEIGHT_ARB
+
+ #define GLX_BUFFER_SIZE      WGL_COLOR_BITS_ARB
+ #define GLX_RED_SIZE         WGL_RED_BITS_ARB
+ #define GLX_GREEN_SIZE       WGL_GREEN_BITS_ARB
+ #define GLX_BLUE_SIZE        WGL_BLUE_BITS_ARB
+ #define GLX_ALPHA_SIZE       WGL_ALPHA_BITS_ARB
+ #define GLX_DEPTH_SIZE       WGL_DEPTH_BITS_ARB
+ #define GLX_STENCIL_SIZE     WGL_STENCIL_BITS_ARB
+
+ /*for windows98se -- not sure why unicode is being used here -- seems like 
it should be avoided if possible*/
+ #define DEVMODEW DEVMODEA
+ #define EnumDisplaySettingsExW EnumDisplaySettingsExA
+ #define ChangeDisplaySettingsExW(dmDeviceName, b, c, d, e) 
ChangeDisplaySettingsExA(NULL, b, c, d, e)
+ #define MultiByteToWideChar(a, b, c, d, dmDeviceName, f)
+#endif/*__WIN32_OPENGL__*/
+/* in windows the display will be the HDC */
+
+#define WINED3D_SWAPCHAIN_PROPERTY "__IWineD3DSwapChainImpl"
+#define GWL_WNDPROC         (-4)
+
+ /* retrieve the X display to use on a given DC */
+inline Display *get_display( HDC hdc );
+
+/* some useful functions for windows */
+#ifndef __WIN32_OPENGL__
+#else/*__WIN32_OPENGL__*/
+inline void D3DFmtMakePFD(WINED3DPRESENT_PARAMETERS* 
pPresentationParameters, LPPIXELFORMATDESCRIPTOR ppfd, BOOL alternate);
+inline HGLRC wglCreateContextAndShare(HDC display, HGLRC context);
+inline int wglQueryVersion(HDC display, int *major, int *minor);
+#if 0
+inline HPBUFFERARB wglCreatePbuffer(HDC display, DWORD cfgs, int* attribs);
+#endif
+inline void SwapInterval(WINED3DPRESENT_PARAMETERS* 
pPresentationParameters);
+LRESULT CALLBACK WindowResizeProc(HWND hwnd, UINT uMsg, WPARAM wParam, 
LPARAM lParam);
+#endif/*__WIN32_OPENGL__*/
+
+#endif/*__WIN_X_UTILS__*/

-------------- next part --------------
results of wined3d - d3d9 regression testing 07_16_2005
--Windows98SE AthlonXP 2100+, 256MB, GF4 4200 64MB 85hz (using 
wined3d+GLX->WGL patch)
NOTE: many comments will look the same (maybe small changes) as things are 
fixed/break they will be updated (by magic)
NOTE: for all programs that list fps -- they will be listed here -- these #s 
are only useful in reference to new numbers from same comp (or for bragging)
      these #s should help determine which patches speed up/slow down what 
and by how much
      -- this should be done for all programs in an easily repeatable way
NOTE: these are run without total redirection -- (so only fixme goes to 
stderr)
      dunno how to redirect the other channels in windows (any clues?)

New Bugs
  none noticed

Removed Bugs
  fixed random crash -- was related to releasing of swapchain and accessing 
a deleted object (in resize function)
  mode 0 would not show up due to an incorrect loop guard now 
640x480xD3DFMT_X8R8G8B8 is accessible (for different cards -- different 
modes)

General overview
  resizing windows is hacked (blame me) -- instead of stretching the output 
-- it simply changes the viewport size
  Initial SwapEffect support
  Initial PresentationInterval support
  for programs that enumerate display modes the screen flashes alot and 
takes a long time to startup (creating fake gl contexts to probe them)
  for programs that enumerate display formats it takes a long time to 
startup
  cannot switch to fullscreen on any apps (crashes on recreate and does not 
go fullscreen on ALT-ENTER)
  in fullscreen where you can press f2(to change gfx) -- pressing f2 crashes 
it
  there are scissoring problems (in windows98se not xp) with the opengl 
windows -- probably not a problem in X

from http://www.codesampler.com/dx9src.htm
  dx9_1pass_emboss_bump_mapping (same as real d3d9)
  dx9_2pass_emboss_bump_mapping (same as real d3d9)
  dx9_alpha_blending_texture (same as real d3d9)
  dx9_multiple_vertex_buffers (same as real d3d9)
--dx9_texture_dot3_blending !!!(???...could not find on site...???)!!!
  dx9_texture_filtering (same as real d3d9 -- this seems to work correctly 
now but im unsure)
  dx9_texture_mipmapping (same as real d3d9 -- filters work differently -- 
... hard to explain)
  dx9_texture_subloading (same as real d3d9)
  dx9_tokamak_chain (same as real d3d9 -- and impressive -- best demo of 
bunch -- BTW press F1 and have more fun...)
  dx9_transforms (same as real d3d9)
  dx9_vertex_data (same as real d3d9)
--dx9_view_matrix !!!(???...could not find on site (dx8_view_matrix not 
dx9_view_matrix)...???)!!!
  dx9_view_ports (same as real d3d9 -- but does not resize)
  dx9_spot_light (differences between opengl lighting and d3d9 lighting)
  dx9_texture (same as real d3d9)
  dx9_texture_addressing (... unsure about what this SHOULD look like -- but 
runs fine and does stuff)
  dx9_primitive_types (same as real d3d9)
  dx9_point_light (same as real d3d9)
  dx9_dot3_bump_mapping (same as real d3d9)
  dx9_effect_simple (same as real d3d9)
  dx9_fonts (same as real d3d9)
  dx9_indexed_geometry (same as real d3d9)
  dx9_initialization (same as real d3d9)
  dx9_lighting (same as real d3d9 -- I do not notice any artifacts? maybe an 
ATI problem?)
  dx9_material (same as real d3d9 -- synchronized teapots ya cannot beat it)
  dx9_multitexture (same as real d3d9)
  dx9_offscreen_rendering (same as real d3d9)
  dx9_2d_demo_game (extremely SLOW (will wait for patch) -- animations?? 
unsure too slow (like 0.1 fps))

from http://triplebuffer.devmaster.net/tutorials.php
  BumpMapping (same as real d3d9)
  tb_dx9_03 (same as real d3d9)
  tb_dx9_04 (same as real d3d9)
  tb_dx9_05 (same as real d3d9)
  tb_dx9_06 (same as real d3d9)
  tb_dx9_07 (same as real d3d9)
  tb_dx9_08 (same as real d3d9)
  tb_dx9_09 (same as real d3d9)
    85 fps 800x600
  tb_dx9_10 (same as real d3d9)
    85 fps 800x600

from http://www.clootie.ru/delphi/download_dx90.html#Direct3D
  Tut01_CreateDevice (same as real d3d9)
  Tut02_Vertices (same as real d3d9)
  Tut03_Matrices (same as real d3d9)
  Tut04_Lights (same as real d3d9)
  Tut05_Textures (same as real d3d9)
  Tut06_Meshes (same as real d3d9)
  cull (same as real d3d9 -- except slow (180 fps -> 20 fps))
    20fps 800x600

-------------
additional tested demos
  mview (same as real d3d9 -- except cannot resize/move (crashes) -- and on 
windows98se (xp is fine) the top bar buttons and bottom status bar are 
covered by opengl gfx -- bad scissoring?)
    ~510(+-20)fps -- teapot standard window size (no movement)
  2DTestDX9 (same as real d3d9 -- except the 2d does not stretch on window 
resize (see top comment))
  text3d (same as real d3d9 -- except for usability issues -- cannot change 
to fullscreen(crashes))
    ~439(+-2)fps 400x300 window
  ShadowVolume (same as real d3d9 -- except for usability issues -- cannot 
change to fullscreen(crashes))
    ~270(+-5)fps 400x300 window
  MultiDx (same as real d3d9 -- EXCEPT all panes draw the teapot on a 1bit 
buffer? -- I noticed fewer odd artifacts)
    (the author of the original MultiDx should be informed of the bug in it 
that makes the top left pane the wrong size on init)
    this will crash (due to recreating the swapchains not actually 
resizing?)
  DXCapsViewer (mode 0 -- 640x480xD3DFMT_X8R8G8B8 does not show up -- 
problem in mode iteration?)
  DxTex (runs but does not display -- will not run on my real d3d9)
  dx9_lost_device (same as real d3d9 -- says texture object failed to clean 
up properly -- its own fault?)
  dx9_resize_window (same as real d3d9 -- says texture object failed to 
clean up properly -- its own fault?)
  dx9_multiple_devices (start rendering in one window then just green...)
  dx9_swap_chains (both render in one window the other window is black -- 
this will induce seziure -- BEWARE)
    ~250(+-5)fps window

---------------
demos that were mean and nasty to me
  water (gets far -- near rendering -- but crashes) (it makes the window 
then names it (technique 0) then crashes)



More information about the wine-devel mailing list