Paul Gofman : d3dx9: D3DXVec3Transform should support input and output parameter overlap.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 14 11:48:51 CDT 2016


Module: wine
Branch: master
Commit: 1ba9cfb5c33f71cd1e1a2ba832b843ca4219a38f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1ba9cfb5c33f71cd1e1a2ba832b843ca4219a38f

Author: Paul Gofman <gofmanp at gmail.com>
Date:   Tue Apr 12 13:09:17 2016 +0300

d3dx9: D3DXVec3Transform should support input and output parameter overlap.

Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx9_36/math.c       | 11 +++++++----
 dlls/d3dx9_36/tests/math.c |  8 ++++++--
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c
index da33074..394ff05 100644
--- a/dlls/d3dx9_36/math.c
+++ b/dlls/d3dx9_36/math.c
@@ -1898,12 +1898,15 @@ D3DXVECTOR3* WINAPI D3DXVec3ProjectArray(D3DXVECTOR3* out, UINT outstride, const
 
 D3DXVECTOR4* WINAPI D3DXVec3Transform(D3DXVECTOR4 *pout, const D3DXVECTOR3 *pv, const D3DXMATRIX *pm)
 {
+    D3DXVECTOR4 out;
+
     TRACE("pout %p, pv %p, pm %p\n", pout, pv, pm);
 
-    pout->x = pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[2][0] * pv->z + pm->u.m[3][0];
-    pout->y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[2][1] * pv->z + pm->u.m[3][1];
-    pout->z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[2][2] * pv->z + pm->u.m[3][2];
-    pout->w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] * pv->z + pm->u.m[3][3];
+    out.x = pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[2][0] * pv->z + pm->u.m[3][0];
+    out.y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[2][1] * pv->z + pm->u.m[3][1];
+    out.z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[2][2] * pv->z + pm->u.m[3][2];
+    out.w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[2][3] * pv->z + pm->u.m[3][3];
+    *pout = out;
     return pout;
 }
 
diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c
index cbe94b5..0fe6796 100644
--- a/dlls/d3dx9_36/tests/math.c
+++ b/dlls/d3dx9_36/tests/math.c
@@ -1361,8 +1361,12 @@ static void D3DXVector3Test(void)
 
 /*_______________D3DXVec3Transform_______________________*/
     expectedtrans.x = 70.0f; expectedtrans.y = 88.0f; expectedtrans.z = 106.0f; expectedtrans.w = 124.0f;
-    D3DXVec3Transform(&gottrans,&u,&mat);
-    expect_vec4(expectedtrans,gottrans);
+    D3DXVec3Transform(&gottrans, &u, &mat);
+    expect_vec4(expectedtrans, gottrans);
+
+    gottrans.x = u.x; gottrans.y = u.y; gottrans.z = u.z;
+    D3DXVec3Transform(&gottrans, (D3DXVECTOR3 *)&gottrans, &mat);
+    expect_vec4(expectedtrans, gottrans);
 
 /*_______________D3DXVec3TransformCoord_______________________*/
     expectedvec.x = 70.0f/124.0f; expectedvec.y = 88.0f/124.0f; expectedvec.z = 106.0f/124.0f;




More information about the wine-cvs mailing list