[D3D 56] Miscellaneous fixes to get AvP working

Lionel Ulmer lionel.ulmer at free.fr
Fri Dec 27 05:32:32 CST 2002


Changelog:
 - added some tracing in the fake ZBuffer methods
 - added support for the DEPTH_FILL BLT
 - set by defaut perspective correction to nicest.
 - decrease the limit where 'w' is ignored

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/mesa.c	2002-12-26 12:42:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/mesa.c	2002-12-27 11:06:01.000000000 +0100
@@ -924,7 +924,7 @@
     glVertex3fv(coords);
 }
 inline static void handle_xyzrhw(D3DVALUE *coords) {
-    if (coords[3] < 0.00001)
+    if (coords[3] < 1e-8)
         glVertex3fv(coords);
     else {
         GLfloat w = 1.0 / coords[3];
@@ -1977,6 +1981,7 @@
     object->set_context(object);
     ENTER_GL();
     TRACE(" current context set\n");
+    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
     glClearColor(0.0, 0.0, 0.0, 0.0);
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
     glDrawBuffer(buffer);
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3d_private.h	2002-12-27 11:01:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3d_private.h	2002-12-27 10:38:06.000000000 +0100
@@ -59,6 +59,9 @@
     /* Used as a callback for Devices to tell to the D3D object it's been created */
     HRESULT (*added_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
     HRESULT (*removed_device)(IDirect3DImpl *d3d, IDirect3DDeviceImpl *device);
+
+    /* This is needed for delayed texture creation and Z buffer blits */
+    IDirect3DDeviceImpl *current_device;
 };
 
 /*****************************************************************************
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3dexecutebuffer.c	2002-12-26 12:42:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3dexecutebuffer.c	2002-12-27 10:57:35.000000000 +0100
@@ -125,7 +125,7 @@
               ((col >>  8) & 0xFF) / 255.0,					\
               ((col >>  0) & 0xFF) / 255.0);					\
     glTexCoord2f(vx->u7.tu, vx->u8.tv);						\
-    if (vx->u4.rhw < 0.01)							\
+    if (vx->u4.rhw < 1e-8)							\
         glVertex3f(vx->u1.sx,							\
                    vx->u2.sy,							\
                    vx->u3.sz);							\
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3dtexture.c	2002-12-27 11:01:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3dtexture.c	2002-12-27 10:41:14.000000000 +0100
@@ -662,14 +662,12 @@
 HRESULT d3dtexture_create(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOLEAN at_creation, 
 			  IDirectDrawSurfaceImpl *main)
 {
-    IDirect3DGLImpl *gl_d3d = (IDirect3DGLImpl *) d3d;
-
     /* First, initialize the texture vtables... */
     ICOM_INIT_INTERFACE(surf, IDirect3DTexture,  VTABLE_IDirect3DTexture);
     ICOM_INIT_INTERFACE(surf, IDirect3DTexture2, VTABLE_IDirect3DTexture2);
 	
     /* Only create all the private stuff if we actually have an OpenGL context.. */
-    if (gl_d3d->current_device != NULL) {
+    if (d3d->current_device != NULL) {
         IDirect3DTextureGLImpl *private;
 
         private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTextureGLImpl));
--- /home/ulmer/Wine/wine_base//dlls/ddraw/mesa_private.h	2002-12-27 11:01:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/mesa_private.h	2002-12-27 10:37:38.000000000 +0100
@@ -82,9 +82,6 @@
     struct IDirect3DImpl parent;
     int free_lights;
     void (*light_released)(IDirect3DImpl *, GLenum light_num);
-
-    /* This is needed for delayed texture creation */
-    struct IDirect3DDeviceImpl *current_device;
 } IDirect3DGLImpl;
 
 typedef struct IDirect3DLightGLImpl
--- /home/ulmer/Wine/wine_base//dlls/ddraw/direct3d/mesa.c	2002-12-27 11:01:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/direct3d/mesa.c	2002-12-27 10:42:00.000000000 +0100
@@ -379,9 +379,7 @@
 
 static HRESULT d3d_add_device(IDirect3DImpl *This, IDirect3DDeviceImpl *device)
 {
-    IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
- 
-    if  (glThis->current_device == NULL) {
+    if  (This->current_device == NULL) {
         /* Create delayed textures now that we have an OpenGL context...
 	   For that, go through all surface attached to our DDraw object and create
 	   OpenGL textures for all textures.. */
@@ -396,16 +394,14 @@
 	}
     }
     /* For the moment, only one device 'supported'... */
-    glThis->current_device = device;
+    This->current_device = device;
 
     return DD_OK;
 }
 
 static HRESULT d3d_remove_device(IDirect3DImpl *This, IDirect3DDeviceImpl *device)
 {
-    IDirect3DGLImpl *glThis = (IDirect3DGLImpl *) This;
-
-    glThis->current_device = NULL;
+    This->current_device = NULL;
     return DD_OK;
 }
 
--- /home/ulmer/Wine/wine_base//dlls/ddraw/dsurface/fakezbuffer.c	2002-12-27 11:01:50.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/dsurface/fakezbuffer.c	2002-12-27 11:04:39.000000000 +0100
@@ -34,6 +34,7 @@
 
 #include "ddcomimpl.h"
 #include "ddraw_private.h"
+#include "d3d_private.h"
 #include "dsurface/main.h"
 #include "dsurface/fakezbuffer.h"
 
@@ -114,6 +115,33 @@
 				  LPDIRECTDRAWSURFACE7 src, LPRECT rsrc,
 				  DWORD dwFlags, LPDDBLTFX lpbltfx)
 {
+    ICOM_THIS(IDirectDrawSurfaceImpl,iface);
+
+    if (TRACE_ON(ddraw)) {
+        TRACE("(%p)->(%p,%p,%p,%08lx,%p)\n", This,rdst,src,rsrc,dwFlags,lpbltfx);
+	if (rdst) TRACE("\tdestrect :%dx%d-%dx%d\n",rdst->left,rdst->top,rdst->right,rdst->bottom);
+	if (rsrc) TRACE("\tsrcrect  :%dx%d-%dx%d\n",rsrc->left,rsrc->top,rsrc->right,rsrc->bottom);
+	TRACE("\tflags: ");
+	DDRAW_dump_DDBLT(dwFlags);
+	if (dwFlags & DDBLT_DDFX) {
+	    TRACE("\tblitfx: ");
+	    DDRAW_dump_DDBLTFX(lpbltfx->dwDDFX);
+	}
+    }
+
+    /* We only support the BLT with DEPTH_FILL for now */
+    if (This->ddraw_owner->d3d != NULL) {
+        if (This->ddraw_owner->d3d->current_device != NULL) {
+	    This->ddraw_owner->d3d->current_device->clear(This->ddraw_owner->d3d->current_device,
+							  0, NULL, /* Clear the whole screen */
+							  D3DCLEAR_ZBUFFER,
+							  0x00000000,
+							  ((double) lpbltfx->u5.dwFillDepth) / 4294967295.0,
+							  0x00000000);
+	    return DD_OK;
+	}
+    }
+
     return cant_do_that("blt to a");
 }
 
@@ -122,6 +150,21 @@
 				      DWORD dsty, LPDIRECTDRAWSURFACE7 src,
 				      LPRECT rsrc, DWORD trans)
 {
+    ICOM_THIS(IDirectDrawSurfaceImpl,iface);
+
+    if (TRACE_ON(ddraw)) {
+	FIXME("(%p)->(%ld,%ld,%p,%p,%08lx)\n",
+		This,dstx,dsty,src,rsrc,trans
+	);
+	FIXME("\ttrans:");
+	if (FIXME_ON(ddraw))
+	  DDRAW_dump_DDBLTFAST(trans);
+	if (rsrc)
+	  FIXME("\tsrcrect: %dx%d-%dx%d\n",rsrc->left,rsrc->top,rsrc->right,rsrc->bottom);
+	else
+	  FIXME(" srcrect: NULL\n");
+    }
+
     return cant_do_that("bltfast to a");
 }
 


More information about the wine-patches mailing list