Module: wine Branch: master Commit: bb9a2e6714668398e01ac045978f37a8ee490eb3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bb9a2e6714668398e01ac04597...
Author: Paul Gofman gofmanp@gmail.com Date: Thu Apr 14 15:10:14 2016 +0300
d3dx9: D3DXVec2Transform should support arguments aliasing.
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3dx9_36/math.c | 11 +++++++---- dlls/d3dx9_36/tests/math.c | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/math.c b/dlls/d3dx9_36/math.c index 1808782..641bece 100644 --- a/dlls/d3dx9_36/math.c +++ b/dlls/d3dx9_36/math.c @@ -1712,12 +1712,15 @@ D3DXVECTOR2* WINAPI D3DXVec2Normalize(D3DXVECTOR2 *pout, const D3DXVECTOR2 *pv)
D3DXVECTOR4* WINAPI D3DXVec2Transform(D3DXVECTOR4 *pout, const D3DXVECTOR2 *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[3][0]; - pout->y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[3][1]; - pout->z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[3][2]; - pout->w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + pm->u.m[3][3]; + out.x = pm->u.m[0][0] * pv->x + pm->u.m[1][0] * pv->y + pm->u.m[3][0]; + out.y = pm->u.m[0][1] * pv->x + pm->u.m[1][1] * pv->y + pm->u.m[3][1]; + out.z = pm->u.m[0][2] * pv->x + pm->u.m[1][2] * pv->y + pm->u.m[3][2]; + out.w = pm->u.m[0][3] * pv->x + pm->u.m[1][3] * pv->y + 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 4ac0a31..46f90dd 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -1186,8 +1186,11 @@ static void D3DXVector2Test(void)
/*_______________D3DXVec2Transform_______________________*/ expectedtrans.x = 36.0f; expectedtrans.y = 44.0f; expectedtrans.z = 52.0f; expectedtrans.w = 60.0f; - D3DXVec2Transform(&gottrans,&u,&mat); - expect_vec4(expectedtrans,gottrans); + D3DXVec2Transform(&gottrans, &u, &mat); + expect_vec4(expectedtrans, gottrans); + gottrans.x = u.x; gottrans.y = u.y; + D3DXVec2Transform(&gottrans, (D3DXVECTOR2 *)&gottrans, &mat); + expect_vec4(expectedtrans, gottrans);
/*_______________D3DXVec2TransformCoord_______________________*/ expectedvec.x = 0.6f; expectedvec.y = 11.0f/15.0f;