[D3D 13] Some start of D3D7 support...

Lionel Ulmer lionel.ulmer at free.fr
Sat Nov 30 09:34:59 CST 2002


At least with this patch, some D3D7 games start now... Still do not display
anything but at least they start :-)

Changelog:
 - beginning of support for D3D7 / D3DDevice7

                 Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- ../wine_work_base/dlls/ddraw/mesa_private.h	Sat Nov 30 16:32:44 2002
+++ dlls/ddraw/mesa_private.h	Sat Nov 30 13:48:06 2002
@@ -124,6 +124,7 @@
 
 /* Used for Direct3D to request the device to enumerate itself */
 extern HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD interface_version) ;
+extern HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) ;
 extern HRESULT d3ddevice_find(IDirect3DImpl *d3d, LPD3DFINDDEVICESEARCH lpD3DDFS, LPD3DFINDDEVICERESULT lplpD3DDevice, DWORD interface_version);
 
 /* Matrix copy WITH transposition */
--- ../wine_work_base/dlls/ddraw/d3ddevice/mesa.c	Sat Nov 30 16:32:44 2002
+++ dlls/ddraw/d3ddevice/mesa.c	Sat Nov 30 16:27:40 2002
@@ -207,6 +207,49 @@
     d1->wMaxSimultaneousTextures = 1;  /* TODO add proper caps according to OpenGL multi-texture stuff */
 }
 
+static void fill_opengl_caps_7(D3DDEVICEDESC7 *d)
+{
+    D3DDEVICEDESC d1;
+
+    /* Copy first D3D1/2/3 capabilities */
+    fill_opengl_caps(&d1);
+
+    /* And fill the D3D7 one with it */
+    d->dwDevCaps = d1.dwDevCaps;
+    d->dpcLineCaps = d1.dpcLineCaps;
+    d->dpcTriCaps = d1.dpcTriCaps;
+    d->dwDeviceRenderBitDepth = d1.dwDeviceRenderBitDepth;
+    d->dwDeviceZBufferBitDepth = d1.dwDeviceZBufferBitDepth;
+    d->dwMinTextureWidth = d1.dwMinTextureWidth;
+    d->dwMinTextureHeight = d1.dwMinTextureHeight;
+    d->dwMaxTextureWidth = d1.dwMaxTextureWidth;
+    d->dwMaxTextureHeight = d1.dwMaxTextureHeight;
+    d->dwMaxTextureRepeat = d1.dwMaxTextureRepeat;
+    d->dwMaxTextureAspectRatio = d1.dwMaxTextureAspectRatio;
+    d->dwMaxAnisotropy = d1.dwMaxAnisotropy;
+    d->dvGuardBandLeft = d1.dvGuardBandLeft;
+    d->dvGuardBandTop = d1.dvGuardBandTop;
+    d->dvGuardBandRight = d1.dvGuardBandRight;
+    d->dvGuardBandBottom = d1.dvGuardBandBottom;
+    d->dvExtentsAdjust = d1.dvExtentsAdjust;
+    d->dwStencilCaps = d1.dwStencilCaps;
+    d->dwFVFCaps = d1.dwFVFCaps;
+    d->dwTextureOpCaps = d1.dwTextureOpCaps;
+    d->wMaxTextureBlendStages = d1.wMaxTextureBlendStages;
+    d->wMaxSimultaneousTextures = d1.wMaxSimultaneousTextures;
+    d->dwMaxActiveLights = d1.dlcLightingCaps.dwNumLights;
+    d->dvMaxVertexW = 100000000.0; /* No idea exactly what to put here... */
+    d->deviceGUID = IID_IDirect3DTnLHalDevice;
+    d->wMaxUserClipPlanes = 1;
+    d->wMaxVertexBlendMatrices = 1;
+    d->dwVertexProcessingCaps = D3DVTXPCAPS_TEXGEN | D3DVTXPCAPS_MATERIALSOURCE7 | D3DVTXPCAPS_VERTEXFOG | D3DVTXPCAPS_DIRECTIONALLIGHTS |
+      D3DVTXPCAPS_POSITIONALLIGHTS | D3DVTXPCAPS_LOCALVIEWER;
+    d->dwReserved1 = 0;
+    d->dwReserved2 = 0;
+    d->dwReserved3 = 0;
+    d->dwReserved4 = 0;
+}
+
 #if 0 /* TODO : fix this and add multitexturing and other needed stuff */
 static void fill_device_capabilities(IDirectDrawImpl* ddraw)
 {
@@ -252,6 +295,17 @@
 
     TRACE(" enumerating OpenGL D3DDevice%ld interface (IID %s).\n", interface_version, debugstr_guid(iid));
     return cb((LPGUID) iid, buf, "direct3d", &d1, &d2, context);
+}
+
+HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context)
+{
+    D3DDEVICEDESC7 ddesc;
+
+    fill_opengl_caps_7(&ddesc);
+    
+    TRACE(" enumerating OpenGL D3DDevice7 interface.\n");
+    
+    return cb("WINE Direct3D7 using OpenGL", "Wine D3D7 device", &ddesc, context);
 }
 
 ULONG WINAPI
--- ../wine_work_base/dlls/ddraw/direct3d/mesa.c	Thu Nov 28 23:20:02 2002
+++ dlls/ddraw/direct3d/mesa.c	Sat Nov 30 16:28:56 2002
@@ -181,7 +181,8 @@
 	return D3D_OK;
     }
     if ((iid == NULL) ||
-	(IsEqualGUID(&IID_IDirect3DHALDevice, iid))) {
+	(IsEqualGUID(&IID_IDirect3DHALDevice, iid)) ||
+	(IsEqualGUID(&IID_IDirect3DTnLHalDevice, iid))) {
         switch (interface) {
 	    case 1:
 		*obj = ICOM_INTERFACE(lpd3ddev, IDirect3DDevice);
@@ -293,6 +294,32 @@
     return D3D_OK;
 }
 
+HRESULT WINAPI
+GL_IDirect3DImpl_7_EnumDevices(LPDIRECT3D7 iface,
+			       LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback,
+			       LPVOID lpUserArg)
+{
+    ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
+    TRACE("(%p/%p)->(%p,%p)\n", This, iface, lpEnumDevicesCallback, lpUserArg);
+
+    if (d3ddevice_enumerate7(lpEnumDevicesCallback, lpUserArg) != D3DENUMRET_OK)
+	return D3D_OK;
+    
+    return D3D_OK;
+}
+
+HRESULT WINAPI
+GL_IDirect3DImpl_7_CreateDevice(LPDIRECT3D7 iface,
+				REFCLSID rclsid,
+				LPDIRECTDRAWSURFACE7 lpDDS,
+				LPDIRECT3DDEVICE7* lplpD3DDevice)
+{
+    ICOM_THIS_FROM(IDirect3DImpl, IDirect3D7, iface);
+    IDirectDrawSurfaceImpl *ddsurfaceimpl = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, lpDDS);
+    TRACE("(%p/%p)->(%s,%p,%p)\n", This, iface, debugstr_guid(rclsid), lpDDS, lplpD3DDevice);
+    return create_device_helper(This, rclsid, ddsurfaceimpl, (void **) lplpD3DDevice, 7);
+}
+
 static void light_released(IDirect3DImpl *This, GLenum light_num)
 {
     IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
@@ -311,8 +338,8 @@
     XCAST(QueryInterface) Main_IDirect3DImpl_7_3T_2T_1T_QueryInterface,
     XCAST(AddRef) Main_IDirect3DImpl_7_3T_2T_1T_AddRef,
     XCAST(Release) Main_IDirect3DImpl_7_3T_2T_1T_Release,
-    XCAST(EnumDevices) Main_IDirect3DImpl_7_EnumDevices,
-    XCAST(CreateDevice) Main_IDirect3DImpl_7_CreateDevice,
+    XCAST(EnumDevices) GL_IDirect3DImpl_7_EnumDevices,
+    XCAST(CreateDevice) GL_IDirect3DImpl_7_CreateDevice,
     XCAST(CreateVertexBuffer) Main_IDirect3DImpl_7_3T_CreateVertexBuffer,
     XCAST(EnumZBufferFormats) GL_IDirect3DImpl_7_3T_EnumZBufferFormats,
     XCAST(EvictManagedTextures) Main_IDirect3DImpl_7_3T_EvictManagedTextures,


More information about the wine-patches mailing list