[D3D 16] Patching at 36000 feet :-)

Lionel Ulmer lionel.ulmer at free.fr
Sun Dec 1 17:36:40 CST 2002


Well, just to tell people that I was able to hack during my plane trip, here
is the measly patch I was able to generate...

Changelog:
 - only handle memory allocation for non-already loaded textures
 - implement GetCaps for D3DDevice7
 
                            Lionel

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/mesa.c	2002-12-02 00:46:38.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/mesa.c	2002-12-02 01:02:53.000000000 +0100
@@ -180,7 +180,7 @@
     d1->dlcLightingCaps.dwNumLights = 16; /* glGetIntegerv(GL_MAX_LIGHTS, &maxlight); d1->dlcLightingCaps.dwNumLights = maxlight; */
     fill_opengl_primcaps(&(d1->dpcLineCaps));
     fill_opengl_primcaps(&(d1->dpcTriCaps));
-    d1->dwDeviceRenderBitDepth  = DDBD_16|DDBD_24;
+    d1->dwDeviceRenderBitDepth  = DDBD_16|DDBD_24|DDBD_32;
     d1->dwDeviceZBufferBitDepth = DDBD_16;
     d1->dwMaxBufferSize = 0;
     d1->dwMaxVertexCount = 65536;
@@ -1187,6 +1187,19 @@
     return DD_OK;
 }
 
+HRESULT WINAPI
+GL_IDirect3DDeviceImpl_7_GetCaps(LPDIRECT3DDEVICE7 iface,
+				 LPD3DDEVICEDESC7 lpD3DHELDevDesc)
+{
+    ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
+    TRACE("(%p/%p)->(%p)\n", This, iface, lpD3DHELDevDesc);
+
+    fill_opengl_caps_7(lpD3DHELDevDesc);
+
+    TRACE(" returning caps : no dump function yet.\n");
+
+    return DD_OK;
+}
 
 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
 # define XCAST(fun)     (typeof(VTABLE_IDirect3DDevice7.fun))
@@ -1200,7 +1213,7 @@
     XCAST(QueryInterface) Main_IDirect3DDeviceImpl_7_3T_2T_1T_QueryInterface,
     XCAST(AddRef) Main_IDirect3DDeviceImpl_7_3T_2T_1T_AddRef,
     XCAST(Release) GL_IDirect3DDeviceImpl_7_3T_2T_1T_Release,
-    XCAST(GetCaps) Main_IDirect3DDeviceImpl_7_GetCaps,
+    XCAST(GetCaps) GL_IDirect3DDeviceImpl_7_GetCaps,
     XCAST(EnumTextureFormats) GL_IDirect3DDeviceImpl_7_3T_EnumTextureFormats,
     XCAST(BeginScene) Main_IDirect3DDeviceImpl_7_3T_2T_1T_BeginScene,
     XCAST(EndScene) Main_IDirect3DDeviceImpl_7_3T_2T_1T_EndScene,
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3dtexture.c	2002-12-02 00:46:38.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3dtexture.c	2002-12-02 01:02:33.000000000 +0100
@@ -407,12 +407,15 @@
     
     TRACE("(%p/%p)->(%p)\n", This, iface, lpD3DTexture2);
 
-    mem_used = This->surface->surface_desc.dwHeight *
-               This->surface->surface_desc.dwHeight *
-	       This->surface->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount;
-    if (This->surface->ddraw_owner->allocate_memory(This->surface->ddraw_owner, mem_used) < 0) {
-        TRACE(" out of virtual memory... Warning application.\n");
-	return D3DERR_TEXTURE_LOAD_FAILED;
+    if (This->loaded == FALSE) {
+        /* Only check memory for not already loaded texture... */
+        mem_used = This->surface->surface_desc.dwHeight *
+	           This->surface->surface_desc.dwHeight *
+	           This->surface->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount;
+	if (This->surface->ddraw_owner->allocate_memory(This->surface->ddraw_owner, mem_used) < 0) {
+	    TRACE(" out of virtual memory... Warning application.\n");
+	    return D3DERR_TEXTURE_LOAD_FAILED;
+	}
     }
     This->loaded = TRUE;
     


More information about the wine-patches mailing list