[dx95] some minor fixes

Raphaël Junqueira fenix at club-internet.fr
Mon Nov 10 14:18:39 CST 2003


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

Hi all,

Changelog:
- - stupid typos fixes on software vertex shader operands
- - CopyRects fix (problem in error paths) based on Carlos Lozano patch

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

iD8DBQE/r/Kfp7NA3AmQTU4RAqqzAJ9Jf1cSseFXlPxkj4baz2d39U9gGwCfVLsr
TAiPkc/TYjKoR1OGGmuOE60=
=WLrq
-----END PGP SIGNATURE-----
-------------- next part --------------
? dlls/d3d8/diff
Index: dlls/d3d8/device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/device.c,v
retrieving revision 1.91
diff -u -r1.91 device.c
--- dlls/d3d8/device.c	4 Nov 2003 04:17:28 -0000	1.91
+++ dlls/d3d8/device.c	10 Nov 2003 20:17:18 -0000
@@ -990,8 +990,8 @@
         dst->myDesc.Format = src->myDesc.Format;
 
         /* Convert container as well */
-        IDirect3DSurface8Impl_GetContainer((LPDIRECT3DSURFACE8) dst, &IID_IDirect3DBaseTexture8, (void**) &texture); /* FIXME: Which refid? */
-        if (texture != NULL) {
+        rc = IDirect3DSurface8Impl_GetContainer((LPDIRECT3DSURFACE8) dst, &IID_IDirect3DBaseTexture8, (void**) &texture); /* FIXME: Which refid? */
+        if (SUCCEEDED(rc) && NULL != texture) {
             ((IDirect3DBaseTexture8Impl*) texture)->format = src->myDesc.Format;
 	    /** Releasing texture after GetContainer */
 	    IDirect3DBaseTexture8_Release(texture);
@@ -1000,38 +1000,39 @@
     }
 
     /* Quick if complete copy ... */
-    if (rc == D3D_OK && cRects == 0 && pSourceRectsArray == NULL && pDestPointsArray == NULL) {
+    if (SUCCEEDED(rc)) {
+      if (cRects == 0 && pSourceRectsArray == NULL && pDestPointsArray == NULL) {
 
-      if (src->myDesc.Width == dst->myDesc.Width && src->myDesc.Height == dst->myDesc.Height) {
-
-        D3DLOCKED_RECT lrSrc;
-        D3DLOCKED_RECT lrDst;
-        IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) src, &lrSrc, NULL, D3DLOCK_READONLY);
-	IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) dst, &lrDst, NULL, 0L);
-        TRACE("Locked src and dst, Direct copy as surfaces are equal, w=%d, h=%d\n", dst->myDesc.Width, dst->myDesc.Height);
-
-	memcpy(lrDst.pBits, lrSrc.pBits, src->myDesc.Size);
- 
-        IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
-        rc = IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) dst);
-        TRACE("Unlocked src and dst\n");
+	if (src->myDesc.Width == dst->myDesc.Width && src->myDesc.Height == dst->myDesc.Height) {
+	  
+	  D3DLOCKED_RECT lrSrc;
+	  D3DLOCKED_RECT lrDst;
+	  IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) src, &lrSrc, NULL, D3DLOCK_READONLY);
+	  IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) dst, &lrDst, NULL, 0L);
+	  TRACE("Locked src and dst, Direct copy as surfaces are equal, w=%d, h=%d\n", dst->myDesc.Width, dst->myDesc.Height);
+	  
+	  memcpy(lrDst.pBits, lrSrc.pBits, src->myDesc.Size);
+	  
+	  IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
+	  rc = IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) dst);
+	  TRACE("Unlocked src and dst\n");
+	  
+	} else {
+	  
+	  FIXME("Wanted to copy all surfaces but size not compatible\n");
+	  rc = D3DERR_INVALIDCALL;
+	  
+	}
 
       } else {
+	
+	if (NULL != pSourceRectsArray && NULL != pDestPointsArray) {
 
-	FIXME("Wanted to copy all surfaces but size not compatible\n");
-        rc = D3DERR_INVALIDCALL;
-
-      }
-
-    } else {
-
-      if (NULL != pSourceRectsArray && NULL != pDestPointsArray) {
-
-        int bytesPerPixel = ((IDirect3DSurface8Impl*) pSourceSurface)->bytesPerPixel;
-        int i;
+	  int bytesPerPixel = ((IDirect3DSurface8Impl*) pSourceSurface)->bytesPerPixel;
+	  int i;
 
-        /* Copy rect by rect */
-        for (i = 0; i < cRects; i++) {
+	  /* Copy rect by rect */
+	  for (i = 0; i < cRects; i++) {
             CONST RECT*  r = &pSourceRectsArray[i];
             CONST POINT* p = &pDestPointsArray[i];
             int copyperline;
@@ -1040,10 +1041,9 @@
             D3DLOCKED_RECT lrDst;
             RECT dest_rect;
  
-
             TRACE("Copying rect %d (%ld,%ld),(%ld,%ld) -> (%ld,%ld)\n", i, r->left, r->top, r->right, r->bottom, p->x, p->y);
             if (src->myDesc.Format == D3DFMT_DXT1) { 
-                copyperline = ((r->right - r->left) * bytesPerPixel)/2; /* DXT1 is half byte per pixel */
+	      copyperline = ((r->right - r->left) * bytesPerPixel)/2; /* DXT1 is half byte per pixel */
             } else {
                 copyperline = ((r->right - r->left) * bytesPerPixel);
             }
@@ -1057,19 +1057,16 @@
 
             /* Find where to start */
             for (j = 0; j < (r->bottom - r->top - 1); j++) {
-               memcpy((char*) lrDst.pBits + (j * lrDst.Pitch), (char*) lrSrc.pBits + (j * lrSrc.Pitch), copyperline);
+	      memcpy((char*) lrDst.pBits + (j * lrDst.Pitch), (char*) lrSrc.pBits + (j * lrSrc.Pitch), copyperline);
             }
-
             IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
             rc = IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) dst);
             TRACE("Unlocked src and dst\n");
-        }
-      
-      } else {
-      
-	FIXME("Wanted to copy partial surfaces not implemented\n");
-        rc = D3DERR_INVALIDCALL;	
-	
+	  }
+	} else {
+	  FIXME("Wanted to copy partial surfaces not implemented\n");
+	  rc = D3DERR_INVALIDCALL;		  
+	}
       }
     }
 
Index: dlls/d3d8/shader.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d8/shader.c,v
retrieving revision 1.16
diff -u -r1.16 shader.c
--- dlls/d3d8/shader.c	25 Sep 2003 20:22:40 -0000	1.16
+++ dlls/d3d8/shader.c	10 Nov 2003 20:17:21 -0000
@@ -306,7 +306,7 @@
 
 void vshader_m3x4(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX34 mat) {
   d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[0][2] * s0->z;
-  d->y = mat[2][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
+  d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
   d->z = mat[2][0] * s0->x + mat[2][1] * s0->y + mat[2][2] * s0->z;
   d->w = mat[3][0] * s0->x + mat[3][1] * s0->y + mat[3][2] * s0->z;
   VSTRACE(("executing m3x4(1): mat=(%f, %f, %f)    s0=(%f)     d=(%f) \n", mat[0][0], mat[0][1], mat[0][2], s0->x, d->x));
@@ -316,8 +316,8 @@
 }
 
 void vshader_m3x3(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX33 mat) {
-  d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[2][2] * s0->z;
-  d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[2][2] * s0->z;
+  d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[0][2] * s0->z;
+  d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
   d->z = mat[2][0] * s0->x + mat[2][1] * s0->y + mat[2][2] * s0->z;
   d->w = 1.0f;
   VSTRACE(("executing m3x3(1): mat=(%f, %f, %f)    s0=(%f)     d=(%f) \n", mat[0][0], mat[0][1], mat[0][2], s0->x, d->x));


More information about the wine-patches mailing list