Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a5d56507
Commit
a5d56507
authored
Nov 08, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Nov 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Handle NULL arguments in D3DXVec3Project.
parent
dff50123
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
14 deletions
+39
-14
math.c
dlls/d3dx9_36/math.c
+13
-8
math.c
dlls/d3dx9_36/tests/math.c
+26
-6
No files found.
dlls/d3dx9_36/math.c
View file @
a5d56507
...
...
@@ -1809,17 +1809,22 @@ D3DXVECTOR3* WINAPI D3DXVec3Normalize(D3DXVECTOR3 *pout, CONST D3DXVECTOR3 *pv)
D3DXVECTOR3
*
WINAPI
D3DXVec3Project
(
D3DXVECTOR3
*
pout
,
CONST
D3DXVECTOR3
*
pv
,
CONST
D3DVIEWPORT9
*
pviewport
,
CONST
D3DXMATRIX
*
pprojection
,
CONST
D3DXMATRIX
*
pview
,
CONST
D3DXMATRIX
*
pworld
)
{
D3DXMATRIX
m
;
D3DXVECTOR3
out
;
TRACE
(
"(%p, %p, %p, %p, %p, %p)
\n
"
,
pout
,
pv
,
pviewport
,
pprojection
,
pview
,
pworld
);
D3DXMatrixMultiply
(
&
m
,
pworld
,
pview
);
D3DXMatrixMultiply
(
&
m
,
&
m
,
pprojection
);
D3DXVec3TransformCoord
(
&
out
,
pv
,
&
m
);
out
.
x
=
pviewport
->
X
+
(
1
.
0
f
+
out
.
x
)
*
pviewport
->
Width
/
2
.
0
f
;
out
.
y
=
pviewport
->
Y
+
(
1
.
0
f
-
out
.
y
)
*
pviewport
->
Height
/
2
.
0
f
;
out
.
z
=
pviewport
->
MinZ
+
out
.
z
*
(
pviewport
->
MaxZ
-
pviewport
->
MinZ
);
*
pout
=
out
;
D3DXMatrixIdentity
(
&
m
);
if
(
pworld
)
D3DXMatrixMultiply
(
&
m
,
&
m
,
pworld
);
if
(
pview
)
D3DXMatrixMultiply
(
&
m
,
&
m
,
pview
);
if
(
pprojection
)
D3DXMatrixMultiply
(
&
m
,
&
m
,
pprojection
);
D3DXVec3TransformCoord
(
pout
,
pv
,
&
m
);
if
(
pviewport
)
{
pout
->
x
=
pviewport
->
X
+
(
1
.
0
f
+
pout
->
x
)
*
pviewport
->
Width
/
2
.
0
f
;
pout
->
y
=
pviewport
->
Y
+
(
1
.
0
f
-
pout
->
y
)
*
pviewport
->
Height
/
2
.
0
f
;
pout
->
z
=
pviewport
->
MinZ
+
pout
->
z
*
(
pviewport
->
MaxZ
-
pviewport
->
MinZ
);
}
return
pout
;
}
...
...
dlls/d3dx9_36/tests/math.c
View file @
a5d56507
...
...
@@ -1331,12 +1331,6 @@ static void D3DXVector3Test(void)
D3DXVec3Normalize
(
&
gotvec
,
&
nul
);
expect_vec3
(
expectedvec
,
gotvec
);
/*_______________D3DXVec3Project_________________________*/
expectedvec
.
x
=
1135
.
721924
f
;
expectedvec
.
y
=
147
.
086914
f
;
expectedvec
.
z
=
0
.
153412
f
;
D3DXMatrixPerspectiveFovLH
(
&
projection
,
D3DX_PI
/
4
.
0
f
,
20
.
0
f
/
17
.
0
f
,
1
.
0
f
,
1000
.
0
f
);
D3DXVec3Project
(
&
gotvec
,
&
u
,
&
viewport
,
&
projection
,
&
view
,
&
world
);
expect_vec3
(
expectedvec
,
gotvec
);
/*_______________D3DXVec3Scale____________________________*/
expectedvec
.
x
=
-
58
.
5
f
;
expectedvec
.
y
=
-
39
.
0
f
;
expectedvec
.
z
=
-
13
.
0
f
;
D3DXVec3Scale
(
&
gotvec
,
&
u
,
scale
);
...
...
@@ -1372,6 +1366,32 @@ static void D3DXVector3Test(void)
D3DXVec3TransformNormal
(
&
gotvec
,
&
u
,
&
mat
);
expect_vec3
(
expectedvec
,
gotvec
);
/*_______________D3DXVec3Project_________________________*/
expectedvec
.
x
=
1135
.
721924
f
;
expectedvec
.
y
=
147
.
086914
f
;
expectedvec
.
z
=
0
.
153412
f
;
D3DXMatrixPerspectiveFovLH
(
&
projection
,
D3DX_PI
/
4
.
0
f
,
20
.
0
f
/
17
.
0
f
,
1
.
0
f
,
1000
.
0
f
);
D3DXVec3Project
(
&
gotvec
,
&
u
,
&
viewport
,
&
projection
,
&
view
,
&
world
);
expect_vec3
(
expectedvec
,
gotvec
);
/* World matrix can be omitted */
D3DXMatrixMultiply
(
&
mat
,
&
world
,
&
view
);
D3DXVec3Project
(
&
gotvec
,
&
u
,
&
viewport
,
&
projection
,
&
mat
,
NULL
);
expect_vec3
(
expectedvec
,
gotvec
);
/* Projection matrix can be omitted */
D3DXMatrixMultiply
(
&
mat
,
&
view
,
&
projection
);
D3DXVec3Project
(
&
gotvec
,
&
u
,
&
viewport
,
NULL
,
&
mat
,
&
world
);
expect_vec3
(
expectedvec
,
gotvec
);
/* View matrix can be omitted */
D3DXMatrixMultiply
(
&
mat
,
&
world
,
&
view
);
D3DXVec3Project
(
&
gotvec
,
&
u
,
&
viewport
,
&
projection
,
NULL
,
&
mat
);
expect_vec3
(
expectedvec
,
gotvec
);
/* All matrices can be omitted */
expectedvec
.
x
=
4010
.
000000
f
;
expectedvec
.
y
=
-
1695
.
000000
f
;
expectedvec
.
z
=
1
.
600000
f
;
D3DXVec3Project
(
&
gotvec
,
&
u
,
&
viewport
,
NULL
,
NULL
,
NULL
);
expect_vec3
(
expectedvec
,
gotvec
);
/* Viewport can be omitted */
expectedvec
.
x
=
1
.
814305
f
;
expectedvec
.
y
=
0
.
582097
f
;
expectedvec
.
z
=
-
0
.
066555
f
;
D3DXVec3Project
(
&
gotvec
,
&
u
,
NULL
,
&
projection
,
&
view
,
&
world
);
expect_vec3
(
expectedvec
,
gotvec
);
/*_______________D3DXVec3Unproject_________________________*/
expectedvec
.
x
=
-
2
.
913411
f
;
expectedvec
.
y
=
1
.
593215
f
;
expectedvec
.
z
=
0
.
380724
f
;
D3DXMatrixPerspectiveFovLH
(
&
projection
,
D3DX_PI
/
4
.
0
f
,
20
.
0
f
/
17
.
0
f
,
1
.
0
f
,
1000
.
0
f
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment