[dx48] cleanup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Changelog:
 - some cleanup and warning fixes
 - split of CreateDevice gl/gxl detection code into FillGLCaps
 - implementation of resolution change (using ChangeDisplaySettings) but 
desctived as ChangeDisplaySettings don't seem to work well
 - begin of swap chain support (now need to split/clean gxlpbuffer/glxpixmap 
code for swap chain use)

Regards,
Raphael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD4DBQE+2hdWp7NA3AmQTU4RAlB4AJicmNrZ+TSLmlY/ATYhYdMIdfOuAJoC97ut
FncDUTsfp+zyFS+M7q4rsw==
=DRjS
-----END PGP SIGNATURE-----
diff -u /cvs-src/wine-pending/d3d8_47/d3d8_private.h dlls/d3d8/d3d8_private.h
--- /cvs-src/wine-pending/d3d8_47/d3d8_private.h	2003-06-01 13:36:23.000000000 +0200
+++ dlls/d3d8/d3d8_private.h	2003-06-01 14:26:08.000000000 +0200
@@ -394,18 +394,12 @@
     GLXContext                    glCtx;
     XVisualInfo                  *visInfo;
     Display                      *display;
+    HWND                          win_handle;
     Window                        win;
     GLXContext                    render_ctx;
     Drawable                      drawable;
 
     /* OpenGL Extension related */
-#if 0
-    BOOL                          isMultiTexture;
-    BOOL                          isDot3;
-    UINT                          TextureUnits;
-    UINT                          clipPlanes;
-    UINT                          maxLights;
-#endif
 
     /* Cursor management */
     BOOL                          bCursorVisible;
@@ -590,7 +584,13 @@
     /* IDirect3DSwapChain8 fields */
     IDirect3DSurface8Impl  *frontBuffer;
     IDirect3DSurface8Impl  *backBuffer;
+    IDirect3DSurface8Impl  *depthStencilBuffer;
     D3DPRESENT_PARAMETERS   PresentParms;
+
+    /* OpenGL/GLX related */
+    GLXContext              swap_ctx;
+    Drawable                swap_drawable;
+    
 };
 
 /* IUnknown: */
diff -u /cvs-src/wine-pending/d3d8_47/device.c dlls/d3d8/device.c
--- /cvs-src/wine-pending/d3d8_47/device.c	2003-06-01 13:36:23.000000000 +0200
+++ dlls/d3d8/device.c	2003-06-01 14:27:50.000000000 +0200
@@ -1186,9 +1186,68 @@
     return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain) {
+    IDirect3DSwapChain8Impl* object;
     ICOM_THIS(IDirect3DDevice8Impl,iface);
     FIXME("(%p) : stub\n", This);
-    *pSwapChain = NULL;
+
+    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
+    if (NULL == object) {
+      return D3DERR_OUTOFVIDEOMEMORY;
+    }
+    object->lpVtbl = &Direct3DSwapChain8_Vtbl;
+    object->ref = 1;
+
+    TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This, 
+	  pPresentationParameters->AutoDepthStencilFormat, debug_d3dformat(pPresentationParameters->AutoDepthStencilFormat),
+	  pPresentationParameters->BackBufferFormat, debug_d3dformat(pPresentationParameters->BackBufferFormat));
+
+    if (pPresentationParameters->Windowed && ((pPresentationParameters->BackBufferWidth  == 0) ||
+                                              (pPresentationParameters->BackBufferHeight == 0))) {
+      RECT Rect;
+      
+      GetClientRect(This->win_handle, &Rect);
+      
+      if (pPresentationParameters->BackBufferWidth == 0) {
+	pPresentationParameters->BackBufferWidth = Rect.right;
+	TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
+      }
+      if (pPresentationParameters->BackBufferHeight == 0) {
+	pPresentationParameters->BackBufferHeight = Rect.bottom;
+	TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
+      }
+    }
+    
+    /* Save the presentation parms now filled in correctly */
+    memcpy(&object->PresentParms, pPresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
+
+    IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
+                                            pPresentationParameters->BackBufferWidth,
+                                            pPresentationParameters->BackBufferHeight,
+                                            pPresentationParameters->BackBufferFormat,
+					    pPresentationParameters->MultiSampleType,
+					    TRUE,
+                                            (LPDIRECT3DSURFACE8*) &object->frontBuffer);
+    
+    IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
+                                            pPresentationParameters->BackBufferWidth,
+                                            pPresentationParameters->BackBufferHeight,
+                                            pPresentationParameters->BackBufferFormat,
+					    pPresentationParameters->MultiSampleType,
+					    TRUE,
+                                            (LPDIRECT3DSURFACE8*) &object->backBuffer);
+
+    if (pPresentationParameters->EnableAutoDepthStencil) {
+       IDirect3DDevice8Impl_CreateDepthStencilSurface((LPDIRECT3DDEVICE8) object,
+	  					      pPresentationParameters->BackBufferWidth,
+						      pPresentationParameters->BackBufferHeight,
+						      pPresentationParameters->AutoDepthStencilFormat,
+						      D3DMULTISAMPLE_NONE,
+						      (LPDIRECT3DSURFACE8*) &object->depthStencilBuffer);
+    } else {
+      object->depthStencilBuffer = NULL;
+    }
+
+    *pSwapChain = (IDirect3DSwapChain8*) object;
     return D3D_OK;
 }
 HRESULT  WINAPI  IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
diff -u /cvs-src/wine-pending/d3d8_47/directx.c dlls/d3d8/directx.c
--- /cvs-src/wine-pending/d3d8_47/directx.c	2003-06-01 13:36:23.000000000 +0200
+++ dlls/d3d8/directx.c	2003-06-01 16:59:12.000000000 +0200
@@ -27,6 +27,7 @@
 #include "winuser.h"
 #include "wingdi.h"
 #include "wine/debug.h"
+#include "wine/unicode.h"
 
 #include "d3d8_private.h"
 
@@ -241,7 +242,7 @@
         switch (bpp) {
         case  8: pMode->Format = D3DFMT_R3G3B2;   break;
         case 16: pMode->Format = D3DFMT_R5G6B5;   break;
-        case 24: /* pMode->Format = D3DFMT_R5G6B5;   break;*/ /* Make 24bit appear as 16 bit */
+        case 24: /* pMode->Format = D3DFMT_R5G6B5;   break;*/ /* Make 24bit appear as 32 bit */
         case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
         default: pMode->Format = D3DFMT_UNKNOWN;
         }
@@ -278,7 +279,7 @@
         switch (bpp) {
         case  8: pMode->Format       = D3DFMT_R3G3B2;   break;
         case 16: pMode->Format       = D3DFMT_R5G6B5;   break;
-        case 24: /*pMode->Format       = D3DFMT_R5G6B5;   break;*/ /* Make 24bit appear as 16 bit */
+        case 24: /*pMode->Format       = D3DFMT_R5G6B5;   break;*/ /* Make 24bit appear as 32 bit */
         case 32: pMode->Format       = D3DFMT_A8R8G8B8; break;
         default: pMode->Format       = D3DFMT_UNKNOWN;
         }
@@ -339,9 +340,9 @@
     return D3D_OK;
 }
 
-HRESULT  WINAPI  IDirect3D8Impl_CheckDeviceMultiSampleType (LPDIRECT3D8 iface,
-                                                            UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
-                                                            BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) {
+HRESULT  WINAPI  IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface,
+							   UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
+							   BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) {
     ICOM_THIS(IDirect3D8Impl,iface);
     FIXME("(%p)->(Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x)\n", 
 	  This, 
@@ -356,9 +357,9 @@
     return D3DERR_NOTAVAILABLE;
 }
 
-HRESULT  WINAPI  IDirect3D8Impl_CheckDepthStencilMatch     (LPDIRECT3D8 iface,
-                                                            UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
-                                                            D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
+HRESULT  WINAPI  IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, 
+						       UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
+						       D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
     ICOM_THIS(IDirect3D8Impl,iface);
     FIXME("(%p)->(Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n", 
 	  This, 
@@ -386,8 +387,7 @@
     return D3D_OK;
 }
 
-HRESULT  WINAPI  IDirect3D8Impl_GetDeviceCaps              (LPDIRECT3D8 iface,
-                                                            UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) {
+HRESULT  WINAPI  IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) {
     ICOM_THIS(IDirect3D8Impl,iface);
     TRACE("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps);
 
@@ -622,13 +622,164 @@
     return D3D_OK;
 }
 
-HMONITOR WINAPI  IDirect3D8Impl_GetAdapterMonitor          (LPDIRECT3D8 iface,
-                                                            UINT Adapter) {
+HMONITOR WINAPI  IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) {
     ICOM_THIS(IDirect3D8Impl,iface);
     FIXME("(%p)->(Adptr:%d)\n", This, Adapter);
     return D3D_OK;
 }
 
+
+static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
+    const char *GL_Extensions = NULL;
+    const char *GLX_Extensions = NULL;
+    GLint gl_max;
+    ICOM_THIS(IDirect3D8Impl,iface);
+
+    /* 
+     * Initialize openGL extension related variables
+     *  with Default values 
+     */
+    memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported));
+    This->gl_info.max_textures   = 1;
+    This->gl_info.ps_arb_version = PS_VERSION_NOT_SUPPORTED;
+    This->gl_info.vs_arb_version = VS_VERSION_NOT_SUPPORTED;
+    This->gl_info.vs_nv_version  = VS_VERSION_NOT_SUPPORTED;
+    This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
+
+    /* Retrieve opengl defaults */
+    glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
+    This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max);
+    TRACE("ClipPlanes support - num Planes=%d\n", gl_max);
+
+    glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
+    This->gl_info.max_lights = min(MAX_ACTIVE_LIGHTS, gl_max);
+    TRACE("Lights support - max lights=%d\n", gl_max);
+
+    /* Parse the gl supported features, in theory enabling parts of our code appropriately */
+    GL_Extensions = glGetString(GL_EXTENSIONS);
+    FIXME("GL_Extensions reported:\n");  
+    
+    if (NULL == GL_Extensions) {
+      ERR("   GL_Extensions returns NULL\n");      
+    } else {
+      while (*GL_Extensions != 0x00) {
+        const char *Start = GL_Extensions;
+        char ThisExtn[256];
+
+        memset(ThisExtn, 0x00, sizeof(ThisExtn));
+        while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
+	  GL_Extensions++;
+        }
+        memcpy(ThisExtn, Start, (GL_Extensions - Start));
+        FIXME("- %s\n", ThisExtn);
+
+	/**
+	 * ARB 
+	 */
+	if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) {
+	  This->gl_info.ps_arb_version = PS_VERSION_11;
+	  FIXME(" FOUND: ARB Pixel Shader support - version=%02x\n", This->gl_info.ps_arb_version);
+	  This->gl_info.supported[ARB_FRAGMENT_PROGRAM] = TRUE;
+        } else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) {
+	  FIXME(" FOUND: ARB Multisample support\n");
+	  This->gl_info.supported[ARB_MULTISAMPLE] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
+	  glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
+	  FIXME(" FOUND: ARB Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%u\n", gl_max);
+	  This->gl_info.supported[ARB_MULTITEXTURE] = TRUE;
+	  This->gl_info.max_textures = min(8, gl_max);
+        } else if (strcmp(ThisExtn, "GL_ARB_texture_cube_map") == 0) {
+	  FIXME(" FOUND: ARB Texture Cube Map support\n");
+	  This->gl_info.supported[ARB_TEXTURE_CUBE_MAP] = TRUE;
+        } else if (strcmp(ThisExtn, "GL_ARB_texture_compression") == 0) {
+	  FIXME(" FOUND: ARB Texture Compression support\n");
+	  This->gl_info.supported[ARB_TEXTURE_COMPRESSION] = TRUE;
+        } else if (strcmp(ThisExtn, "GL_ARB_texture_env_dot3") == 0) {
+	  FIXME(" FOUND: EXT Dot3 support\n");
+	  This->gl_info.supported[ARB_TEXTURE_ENV_DOT3] = TRUE;
+	} else if (strstr(ThisExtn, "GL_ARB_vertex_program")) {
+	  This->gl_info.vs_arb_version = VS_VERSION_11;
+	  FIXME(" FOUND: ARB Vertex Shader support - version=%02x\n", This->gl_info.vs_arb_version);
+	  This->gl_info.supported[ARB_VERTEX_PROGRAM] = TRUE;
+
+	/**
+	 * EXT
+	 */
+        } else if (strcmp(ThisExtn, "GL_EXT_fog_coord") == 0) {
+	  FIXME(" FOUND: EXT Fog coord support\n");
+	  This->gl_info.supported[EXT_FOG_COORD] = TRUE;
+        } else if (strcmp(ThisExtn, "GL_EXT_paletted_texture") == 0) {
+	  /* handle paletted texture extensions */
+	  FIXME(" FOUND: EXT Paletted texture support\n");
+	  This->gl_info.supported[EXT_PALETTED_TEXTURE] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) {
+	  FIXME(" FOUND: EXT Secondary coord support\n");
+	  This->gl_info.supported[EXT_SECONDARY_COLOR] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
+	  FIXME(" FOUND: EXT Texture S3TC compression support\n");
+	  This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) {
+	  FIXME(" FOUND: EXT Texture Anisotropic filter support\n");
+	  This->gl_info.supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) {
+	  FIXME(" FOUND: EXT Texture LOD support\n");
+	  This->gl_info.supported[EXT_TEXTURE_LOD] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_EXT_texture_lod_bias") == 0) {
+	  FIXME(" FOUND: EXT Texture LOD bias support\n");
+	  This->gl_info.supported[EXT_TEXTURE_LOD_BIAS] = TRUE;
+	} else if (strcmp(ThisExtn, "GL_EXT_vertex_weighting") == 0) {
+	  FIXME(" FOUND: EXT Vertex weighting support\n");
+	  This->gl_info.supported[EXT_VERTEX_WEIGHTING] = TRUE;
+
+	/**
+	 * NVIDIA 
+	 */
+	} else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
+	  This->gl_info.ps_nv_version = PS_VERSION_11;
+	  FIXME(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
+	  This->gl_info.supported[NV_FRAGMENT_PROGRAM] = TRUE;
+	} else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
+	  This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
+	  This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2"))   ? VS_VERSION_20 : VS_VERSION_10);
+	  FIXME(" FOUND: NVIDIA (NV) Vertex Shader support - version=%02x\n", This->gl_info.vs_nv_version);
+	  This->gl_info.supported[NV_VERTEX_PROGRAM] = TRUE;
+
+	/**
+	 * ATI
+	 */
+	/** TODO */
+	} else if (strcmp(ThisExtn, "GL_EXT_vertex_shader") == 0) {
+	  This->gl_info.vs_ati_version = VS_VERSION_11;
+	  FIXME(" FOUND: ATI (EXT) Vertex Shader support - version=%02x\n", This->gl_info.vs_ati_version);
+	  This->gl_info.supported[EXT_VERTEX_SHADER] = TRUE;
+	}
+
+
+        if (*GL_Extensions == ' ') GL_Extensions++;
+      }
+    }
+
+    GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
+    FIXME("GLX_Extensions reported:\n");  
+    
+    if (NULL == GLX_Extensions) {
+      ERR("   GLX_Extensions returns NULL\n");      
+    } else {
+      while (*GLX_Extensions != 0x00) {
+        const char *Start = GLX_Extensions;
+        char ThisExtn[256];
+	
+        memset(ThisExtn, 0x00, sizeof(ThisExtn));
+        while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
+	  GLX_Extensions++;
+        }
+        memcpy(ThisExtn, Start, (GLX_Extensions - Start));
+        FIXME("- %s\n", ThisExtn);
+        if (*GLX_Extensions == ' ') GLX_Extensions++;
+      }
+    }
+}
+
 HRESULT  WINAPI  IDirect3D8Impl_CreateDevice               (LPDIRECT3D8 iface,
                                                             UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
                                                             DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
@@ -637,9 +788,6 @@
     HWND whichHWND;
     int num;
     XVisualInfo template;
-    const char *GL_Extensions = NULL;
-    const char *GLX_Extensions = NULL;
-    GLint gl_max;
 
     ICOM_THIS(IDirect3D8Impl,iface);
     TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
@@ -690,6 +838,7 @@
            if (!whichHWND) {
                whichHWND = hFocusWindow;
            }
+	   object->win_handle = whichHWND;
            object->win     = (Window)GetPropA( whichHWND, "__wine_x11_client_window" );
 /*
  *      } else {
@@ -774,9 +923,26 @@
     /* If not windowed, need to go fullscreen, and resize the HWND to the appropriate  */
     /*        dimensions                                                               */
     if (!pPresentationParameters->Windowed) {
+#if 0
+	DEVMODEW devmode;
+	HDC hdc;
+        int bpp = 0;
+	memset(&devmode, 0, sizeof(DEVMODEW));
+	devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; 
+	MultiByteToWideChar(CP_ACP, 0, "Gamers CG", -1, devmode.dmDeviceName, CCHDEVICENAME);
+        hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
+        bpp = GetDeviceCaps(hdc, BITSPIXEL);
+        DeleteDC(hdc);
+	devmode.dmBitsPerPel = (bpp >= 24) ? 32 : bpp;/*Stupid XVidMode cannot change bpp D3DFmtGetBpp(object, pPresentationParameters->BackBufferFormat);*/
+	devmode.dmPelsWidth  = pPresentationParameters->BackBufferWidth;
+	devmode.dmPelsHeight = pPresentationParameters->BackBufferHeight;
+	ChangeDisplaySettingsExW(devmode.dmDeviceName, &devmode, object->win_handle, CDS_FULLSCREEN, NULL);
+#else
         FIXME("Requested full screen support not implemented, expect windowed operation\n");
-        SetWindowPos(whichHWND, HWND_TOP, 0, 0, pPresentationParameters->BackBufferWidth,
-                     pPresentationParameters->BackBufferHeight, SWP_SHOWWINDOW);
+#endif
+        SetWindowPos(object->win_handle, HWND_TOP, 0, 0, 
+		     pPresentationParameters->BackBufferWidth,
+                     pPresentationParameters->BackBufferHeight, SWP_SHOWWINDOW | SWP_FRAMECHANGED);
     }
 
     TRACE("Creating back buffer\n");
@@ -840,20 +1006,8 @@
       IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
     }
 
-    /* Now override the surface's Flip method (if in double buffering) ?COPIED from DDRAW!?
-    ((x11_ds_private *) surface->private)->opengl_flip = TRUE;
-    {
-    int i;
-    struct _surface_chain *chain = surface->s.chain;
-    for (i=0;i<chain->nrofsurfaces;i++)
-      if (chain->surfaces[i]->s.surface_desc.ddsCaps.dwCaps & DDSCAPS_FLIP)
-          ((x11_ds_private *) chain->surfaces[i]->private)->opengl_flip = TRUE;
-    }
-    */
-
     ENTER_GL();
 
-    /*TRACE("hereeee. %x %x %x\n", object->display, object->win, object->glCtx);*/
     if (glXMakeCurrent(object->display, object->win, object->glCtx) == False) {
       ERR("Error in setting current context (context %p drawable %ld)!\n", object->glCtx, object->win);
     }
@@ -881,145 +1035,7 @@
      * Initialize openGL extension related variables
      *  with Default values 
      */
-    memset(&This->gl_info.supported, 0, sizeof(This->gl_info.supported));
-    This->gl_info.max_textures   = 1;
-    This->gl_info.ps_arb_version = PS_VERSION_NOT_SUPPORTED;
-    This->gl_info.vs_arb_version = VS_VERSION_NOT_SUPPORTED;
-    This->gl_info.vs_nv_version  = VS_VERSION_NOT_SUPPORTED;
-    This->gl_info.vs_ati_version = VS_VERSION_NOT_SUPPORTED;
-
-    /* Retrieve opengl defaults */
-    glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
-    This->gl_info.max_clipplanes = min(MAX_CLIPPLANES, gl_max);
-    TRACE("ClipPlanes support - num Planes=%d\n", gl_max);
-
-    glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
-    This->gl_info.max_lights = min(MAX_ACTIVE_LIGHTS, gl_max);
-    TRACE("Lights support - max lights=%d\n", gl_max);
-
-    /* Parse the gl supported features, in theory enabling parts of our code appropriately */
-    GL_Extensions = glGetString(GL_EXTENSIONS);
-    FIXME("GL_Extensions reported:\n");  
-    
-    if (NULL == GL_Extensions) {
-      ERR("   GL_Extensions returns NULL\n");      
-    } else {
-      while (*GL_Extensions != 0x00) {
-        const char *Start = GL_Extensions;
-        char ThisExtn[256];
-
-        memset(ThisExtn, 0x00, sizeof(ThisExtn));
-        while (*GL_Extensions != ' ' && *GL_Extensions != 0x00) {
-	  GL_Extensions++;
-        }
-        memcpy(ThisExtn, Start, (GL_Extensions - Start));
-        FIXME("- %s\n", ThisExtn);
-
-	/**
-	 * ARB 
-	 */
-	if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) {
-	  This->gl_info.ps_arb_version = PS_VERSION_11;
-	  FIXME(" FOUND: ARB Pixel Shader support - version=%02x\n", This->gl_info.ps_arb_version);
-	  This->gl_info.supported[ARB_FRAGMENT_PROGRAM] = TRUE;
-        } else if (strcmp(ThisExtn, "GL_ARB_multisample") == 0) {
-	  FIXME(" FOUND: ARB Multisample support\n");
-	  This->gl_info.supported[ARB_MULTISAMPLE] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_ARB_multitexture") == 0) {
-	  glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
-	  FIXME(" FOUND: ARB Multitexture support - GL_MAX_TEXTURE_UNITS_ARB=%u\n", gl_max);
-	  This->gl_info.supported[ARB_MULTITEXTURE] = TRUE;
-	  This->gl_info.max_textures = min(8, gl_max);
-        } else if (strcmp(ThisExtn, "GL_ARB_texture_cube_map") == 0) {
-	  FIXME(" FOUND: ARB Texture Cube Map support\n");
-	  This->gl_info.supported[ARB_TEXTURE_CUBE_MAP] = TRUE;
-        } else if (strcmp(ThisExtn, "GL_ARB_texture_compression") == 0) {
-	  FIXME(" FOUND: ARB Texture Compression support\n");
-	  This->gl_info.supported[ARB_TEXTURE_COMPRESSION] = TRUE;
-        } else if (strcmp(ThisExtn, "GL_ARB_texture_env_dot3") == 0) {
-	  FIXME(" FOUND: EXT Dot3 support\n");
-	  This->gl_info.supported[ARB_TEXTURE_ENV_DOT3] = TRUE;
-	} else if (strstr(ThisExtn, "GL_ARB_vertex_program")) {
-	  This->gl_info.vs_arb_version = VS_VERSION_11;
-	  FIXME(" FOUND: ARB Vertex Shader support - version=%02x\n", This->gl_info.vs_arb_version);
-	  This->gl_info.supported[ARB_VERTEX_PROGRAM] = TRUE;
-
-	/**
-	 * EXT
-	 */
-        } else if (strcmp(ThisExtn, "GL_EXT_fog_coord") == 0) {
-	  FIXME(" FOUND: EXT Fog coord support\n");
-	  This->gl_info.supported[EXT_FOG_COORD] = TRUE;
-        } else if (strcmp(ThisExtn, "GL_EXT_paletted_texture") == 0) {
-	  /* handle paletted texture extensions */
-	  FIXME(" FOUND: EXT Paletted texture support\n");
-	  This->gl_info.supported[EXT_PALETTED_TEXTURE] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) {
-	  FIXME(" FOUND: EXT Secondary coord support\n");
-	  This->gl_info.supported[EXT_SECONDARY_COLOR] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
-	  FIXME(" FOUND: EXT Texture S3TC compression support\n");
-	  This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) {
-	  FIXME(" FOUND: EXT Texture Anisotropic filter support\n");
-	  This->gl_info.supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) {
-	  FIXME(" FOUND: EXT Texture LOD support\n");
-	  This->gl_info.supported[EXT_TEXTURE_LOD] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_EXT_texture_lod_bias") == 0) {
-	  FIXME(" FOUND: EXT Texture LOD bias support\n");
-	  This->gl_info.supported[EXT_TEXTURE_LOD_BIAS] = TRUE;
-	} else if (strcmp(ThisExtn, "GL_EXT_vertex_weighting") == 0) {
-	  FIXME(" FOUND: EXT Vertex weighting support\n");
-	  This->gl_info.supported[EXT_VERTEX_WEIGHTING] = TRUE;
-
-	/**
-	 * NVIDIA 
-	 */
-	} else if (strstr(ThisExtn, "GL_NV_fragment_program")) {
-	  This->gl_info.ps_nv_version = PS_VERSION_11;
-	  FIXME(" FOUND: NVIDIA (NV) Pixel Shader support - version=%02x\n", This->gl_info.ps_nv_version);
-	  This->gl_info.supported[NV_FRAGMENT_PROGRAM] = TRUE;
-	} else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
-	  This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
-	  This->gl_info.vs_nv_version = max(This->gl_info.vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2"))   ? VS_VERSION_20 : VS_VERSION_10);
-	  FIXME(" FOUND: NVIDIA (NV) Vertex Shader support - version=%02x\n", This->gl_info.vs_nv_version);
-	  This->gl_info.supported[NV_VERTEX_PROGRAM] = TRUE;
-
-	/**
-	 * ATI
-	 */
-	/** TODO */
-	} else if (strcmp(ThisExtn, "GL_EXT_vertex_shader") == 0) {
-	  This->gl_info.vs_ati_version = VS_VERSION_11;
-	  FIXME(" FOUND: ATI (EXT) Vertex Shader support - version=%02x\n", This->gl_info.vs_ati_version);
-	  This->gl_info.supported[EXT_VERTEX_SHADER] = TRUE;
-	}
-
-
-        if (*GL_Extensions == ' ') GL_Extensions++;
-      }
-    }
-
-    GLX_Extensions = glXQueryExtensionsString(object->display, DefaultScreen(object->display));
-    TRACE("GLX_Extensions reported:\n");  
-    
-    if (NULL == GLX_Extensions) {
-      ERR("   GLX_Extensions returns NULL\n");      
-    } else {
-      while (*GLX_Extensions != 0x00) {
-        const char *Start = GLX_Extensions;
-        char ThisExtn[256];
-	
-        memset(ThisExtn, 0x00, sizeof(ThisExtn));
-        while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
-	  GLX_Extensions++;
-        }
-        memcpy(ThisExtn, Start, (GLX_Extensions - Start));
-        TRACE ("- %s\n", ThisExtn);
-        if (*GLX_Extensions == ' ') GLX_Extensions++;
-      }
-    }
+    IDirect3D8Impl_FillGLCaps(iface, object->display);
 
     /* Setup all the devices defaults */
     IDirect3DDeviceImpl_InitStartupStateBlock(object);
diff -u /cvs-src/wine-pending/d3d8_47/surface.c dlls/d3d8/surface.c
--- /cvs-src/wine-pending/d3d8_47/surface.c	2003-06-01 13:36:23.000000000 +0200
+++ dlls/d3d8/surface.c	2003-06-01 13:46:45.000000000 +0200
@@ -208,7 +208,7 @@
 			 1,
 			 D3DFmt2GLFmt(This->Device, This->myDesc.Format), 
                          D3DFmt2GLType(This->Device, This->myDesc.Format), 
-                         pLockedRect->pBits + (pLockedRect->Pitch * (j-This->lockedRect.top)));
+                         ((BYTE*) pLockedRect->pBits) + (pLockedRect->Pitch * (j - This->lockedRect.top)));
 	    vcheckGLcall("glReadPixels");
 	  }
 	}
@@ -243,19 +243,6 @@
 	
 	if (SUCCEEDED(hr) && NULL != cont) {
 	  IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
-#if 0
-	  /* Now setup the texture appropraitly */
-	  D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType(cont);
-	  if (containerType == D3DRTYPE_TEXTURE) {
-            IDirect3DTexture8Impl* pTexture = (IDirect3DTexture8Impl*) cont;
-            pTexture->Dirty = TRUE;
-	  } else if (containerType == D3DRTYPE_CUBETEXTURE) {
-            IDirect3DCubeTexture8Impl* pTexture = (IDirect3DCubeTexture8Impl*) cont;
-            pTexture->Dirty = TRUE;
-	  } else {
-            FIXME("Set dirty on container type %d\n", containerType);
-	  }
-#endif
 	  IDirect3DBaseTexture8_Release(cont);
 	  cont = NULL;
 	}
diff -u /cvs-src/wine-pending/d3d8_47/swapchain.c dlls/d3d8/swapchain.c
--- /cvs-src/wine-pending/d3d8_47/swapchain.c	2003-06-01 13:36:23.000000000 +0200
+++ dlls/d3d8/swapchain.c	2003-06-01 14:20:55.000000000 +0200
@@ -56,8 +56,9 @@
     ICOM_THIS(IDirect3DSwapChain8Impl,iface);
     ULONG ref = --This->ref;
     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
-    if (ref == 0)
+    if (ref == 0) {
         HeapFree(GetProcessHeap(), 0, This);
+    }
     return ref;
 }
 
@@ -67,10 +68,19 @@
     FIXME("(%p) : stub\n", This);
     return D3D_OK;
 }
-HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) {
+
+HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
     ICOM_THIS(IDirect3DSwapChain8Impl,iface);
-    FIXME("(%p) : stub\n", This);    
-    *ppBackBuffer = NULL;
+    *ppBackBuffer = (LPDIRECT3DSURFACE8) This->backBuffer;
+    TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
+
+    if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
+        FIXME("Only one backBuffer currently supported\n");
+        return D3DERR_INVALIDCALL;
+    }
+
+    /* Note inc ref on returned surface */
+    IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppBackBuffer);
     return D3D_OK;
 }
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux