Nozomi Kodama : d3dx9: Fix the case output = input in D3DXVec3Cross.
Alexandre Julliard
julliard at winehq.org
Mon Jun 10 15:12:44 CDT 2013
Module: wine
Branch: master
Commit: b3dff5b3543e13962f3dde5a59738933b63c7ec4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3dff5b3543e13962f3dde5a59738933b63c7ec4
Author: Nozomi Kodama <nozomi.kodama at yahoo.com>
Date: Sat Jun 8 02:26:45 2013 -1000
d3dx9: Fix the case output = input in D3DXVec3Cross.
---
dlls/d3dx9_36/tests/math.c | 3 +++
include/d3dx9math.inl | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c
index 9d90662..5f92729 100644
--- a/dlls/d3dx9_36/tests/math.c
+++ b/dlls/d3dx9_36/tests/math.c
@@ -1251,6 +1251,9 @@ static void D3DXVector3Test(void)
expectedvec.x = -18.0f; expectedvec.y = 40.0f; expectedvec.z = -39.0f;
D3DXVec3Cross(&gotvec,&u,&v);
expect_vec3(expectedvec,gotvec);
+ expectedvec.x = -277.0f; expectedvec.y = -150.0f; expectedvec.z = -26.0f;
+ D3DXVec3Cross(&gotvec,&gotvec,&v);
+ expect_vec3(expectedvec,gotvec);
/* Tests the case NULL */
funcpointer = D3DXVec3Cross(&gotvec,NULL,&v);
ok(funcpointer == NULL, "Expected: %p, Got: %p\n", NULL, funcpointer);
diff --git a/include/d3dx9math.inl b/include/d3dx9math.inl
index 5ee9a75..84c0c62 100644
--- a/include/d3dx9math.inl
+++ b/include/d3dx9math.inl
@@ -1029,10 +1029,13 @@ static inline D3DXVECTOR3* D3DXVec3Add(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1
static inline D3DXVECTOR3* D3DXVec3Cross(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv1, CONST D3DXVECTOR3 *pv2)
{
+ D3DXVECTOR3 temp;
+
if ( !pout || !pv1 || !pv2) return NULL;
- pout->x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
- pout->y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
- pout->z = (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x);
+ temp.x = (pv1->y) * (pv2->z) - (pv1->z) * (pv2->y);
+ temp.y = (pv1->z) * (pv2->x) - (pv1->x) * (pv2->z);
+ temp.z = (pv1->x) * (pv2->y) - (pv1->y) * (pv2->x);
+ *pout = temp;
return pout;
}
More information about the wine-cvs
mailing list