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
54d920ae
Commit
54d920ae
authored
Sep 11, 2008
by
Luis C. Busquets Pérez
Committed by
Alexandre Julliard
Sep 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Add tests for D3DXMatrixDecompose.
parent
0af9415a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
370 additions
and
1 deletion
+370
-1
math.c
dlls/d3dx9_36/tests/math.c
+370
-1
No files found.
dlls/d3dx9_36/tests/math.c
View file @
54d920ae
...
...
@@ -21,8 +21,35 @@
#define ARRAY_SIZE 5
#define admitted_error 0.01f
#define admitted_error 0.0001f
#define relative_error(exp, out) ((exp == out) ? 0.0f : (fabs(out - exp) / fabs(exp)))
#define compare_rotation(exp, got) \
ok(fabs(exp.w - got.w) < admitted_error && \
fabs(exp.x - got.x) < admitted_error && \
fabs(exp.y - got.y) < admitted_error && \
fabs(exp.z - got.z) < admitted_error, \
"Expected rotation = (%f, %f, %f, %f), \
got rotation = (%f, %f, %f, %f)\n", \
exp.w, exp.x, exp.y, exp.z, got.w, got.x, got.y, got.z)
#define compare_scale(exp, got) \
ok(fabs(exp.x - got.x) < admitted_error && \
fabs(exp.y - got.y) < admitted_error && \
fabs(exp.z - got.z) < admitted_error, \
"Expected scale = (%f, %f, %f), \
got scale = (%f, %f, %f)\n", \
exp.x, exp.y, exp.z, got.x, got.y, got.z)
#define compare_translation(exp, got) \
ok(fabs(exp.x - got.x) < admitted_error && \
fabs(exp.y - got.y) < admitted_error && \
fabs(exp.z - got.z) < admitted_error, \
"Expected translation = (%f, %f, %f), \
got translation = (%f, %f, %f)\n", \
exp.x, exp.y, exp.z, got.x, got.y, got.z)
#define compare_vectors(exp, out) \
for (i = 0; i < ARRAY_SIZE + 2; ++i) { \
ok(relative_error(exp[i].x, out[i].x) < admitted_error && \
...
...
@@ -34,6 +61,7 @@
exp[i].x, exp[i].y, exp[i].z, exp[i].w, \
i); \
}
#define compare_planes(exp, out) \
for (i = 0; i < ARRAY_SIZE + 2; ++i) { \
ok(relative_error(exp[i].a, out[i].a) < admitted_error && \
...
...
@@ -59,6 +87,346 @@
* says they can, and some testing with a native DLL
* says so too).
*/
static
void
test_Matrix_Decompose
(
void
)
{
D3DXMATRIX
pm
;
D3DXQUATERNION
exp_rotation
,
got_rotation
;
D3DXVECTOR3
exp_scale
,
got_scale
,
exp_translation
,
got_translation
;
HRESULT
hr
;
/*___________*/
pm
.
m
[
0
][
0
]
=
-
0
.
9238790
f
;
pm
.
m
[
1
][
0
]
=
-
0
.
2705984
f
;
pm
.
m
[
2
][
0
]
=
0
.
2705984
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
0
.
2705984
f
;
pm
.
m
[
1
][
1
]
=
0
.
03
806049
f
;
pm
.
m
[
2
][
1
]
=
0
.
9619395
f
;
pm
.
m
[
3
][
1
]
=
0
.
0
f
;
pm
.
m
[
0
][
2
]
=
-
0
.
2705984
f
;
pm
.
m
[
1
][
2
]
=
0
.
9619395
f
;
pm
.
m
[
2
][
2
]
=
0
.
03
806049
f
;
pm
.
m
[
3
][
2
]
=
10
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
1
.
0
f
;
exp_scale
.
y
=
1
.
0
f
;
exp_scale
.
z
=
1
.
0
f
;
exp_rotation
.
w
=
0
.
195091
f
;
exp_rotation
.
x
=
0
.
0
f
;
exp_rotation
.
y
=
0
.
693520
f
;
exp_rotation
.
z
=
0
.
693520
f
;
exp_translation
.
x
=
-
5
.
0
f
;
exp_translation
.
y
=
0
.
0
f
;
exp_translation
.
z
=
10
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*_________*/
pm
.
m
[
0
][
0
]
=
-
2
.
255813
f
;
pm
.
m
[
1
][
0
]
=
1
.
302324
f
;
pm
.
m
[
2
][
0
]
=
1
.
488373
f
;
pm
.
m
[
3
][
0
]
=
1
.
0
f
;
pm
.
m
[
0
][
1
]
=
1
.
302327
f
;
pm
.
m
[
1
][
1
]
=
-
0
.
7209296
f
;
pm
.
m
[
2
][
1
]
=
2
.
60465
f
;
pm
.
m
[
3
][
1
]
=
2
.
0
f
;
pm
.
m
[
0
][
2
]
=
1
.
488371
f
;
pm
.
m
[
1
][
2
]
=
2
.
604651
f
;
pm
.
m
[
2
][
2
]
=
-
0
.
02325551
f
;
pm
.
m
[
3
][
2
]
=
3
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
3
.
0
f
;
exp_scale
.
y
=
3
.
0
f
;
exp_scale
.
z
=
3
.
0
f
;
exp_rotation
.
w
=
0
.
0
;
exp_rotation
.
x
=
0
.
352180
f
;
exp_rotation
.
y
=
0
.
616316
f
;
exp_rotation
.
z
=
0
.
704361
f
;
exp_translation
.
x
=
1
.
0
f
;
exp_translation
.
y
=
2
.
0
f
;
exp_translation
.
z
=
3
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*_____________*/
pm
.
m
[
0
][
0
]
=
2
.
427051
f
;
pm
.
m
[
1
][
0
]
=
0
.
0
f
;
pm
.
m
[
2
][
0
]
=
1
.
763355
f
;
pm
.
m
[
3
][
0
]
=
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
0
.
0
f
;
pm
.
m
[
1
][
1
]
=
3
.
0
f
;
pm
.
m
[
2
][
1
]
=
0
.
0
f
;
pm
.
m
[
3
][
1
]
=
5
.
0
f
;
pm
.
m
[
0
][
2
]
=
-
1
.
763355
f
;
pm
.
m
[
1
][
2
]
=
0
.
0
f
;
pm
.
m
[
2
][
2
]
=
2
.
427051
f
;
pm
.
m
[
3
][
2
]
=
5
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
3
.
0
f
;
exp_scale
.
y
=
3
.
0
f
;
exp_scale
.
z
=
3
.
0
f
;
exp_rotation
.
w
=
0
.
951057
f
;
exp_rotation
.
x
=
0
.
0
f
;
exp_rotation
.
y
=
0
.
309017
f
;
exp_rotation
.
z
=
0
.
0
f
;
exp_translation
.
x
=
5
.
0
f
;
exp_translation
.
y
=
5
.
0
f
;
exp_translation
.
z
=
5
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*_____________*/
pm
.
m
[
0
][
0
]
=
-
0
.
9238790
f
;
pm
.
m
[
1
][
0
]
=
-
0
.
2705984
f
;
pm
.
m
[
2
][
0
]
=
0
.
2705984
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
0
.
2705984
f
;
pm
.
m
[
1
][
1
]
=
0
.
03
806049
f
;
pm
.
m
[
2
][
1
]
=
0
.
9619395
f
;
pm
.
m
[
3
][
1
]
=
0
.
0
f
;
pm
.
m
[
0
][
2
]
=
-
0
.
2705984
f
;
pm
.
m
[
1
][
2
]
=
0
.
9619395
f
;
pm
.
m
[
2
][
2
]
=
0
.
03
806049
f
;
pm
.
m
[
3
][
2
]
=
10
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
1
.
0
f
;
exp_scale
.
y
=
1
.
0
f
;
exp_scale
.
z
=
1
.
0
f
;
exp_rotation
.
w
=
0
.
195091
f
;
exp_rotation
.
x
=
0
.
0
f
;
exp_rotation
.
y
=
0
.
693520
f
;
exp_rotation
.
z
=
0
.
693520
f
;
exp_translation
.
x
=
-
5
.
0
f
;
exp_translation
.
y
=
0
.
0
f
;
exp_translation
.
z
=
10
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*__________*/
pm
.
m
[
0
][
0
]
=
-
0
.
9238790
f
;
pm
.
m
[
1
][
0
]
=
-
0
.
5411968
f
;
pm
.
m
[
2
][
0
]
=
0
.
8117952
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
0
.
2705984
f
;
pm
.
m
[
1
][
1
]
=
0
.
076120
98
f
;
pm
.
m
[
2
][
1
]
=
2
.
8858185
f
;
pm
.
m
[
3
][
1
]
=
0
.
0
f
;
pm
.
m
[
0
][
2
]
=
-
0
.
2705984
f
;
pm
.
m
[
1
][
2
]
=
1
.
9238790
f
;
pm
.
m
[
2
][
2
]
=
0
.
11418147
f
;
pm
.
m
[
3
][
2
]
=
10
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
1
.
0
f
;
exp_scale
.
y
=
2
.
0
f
;
exp_scale
.
z
=
3
.
0
f
;
exp_rotation
.
w
=
0
.
195091
f
;
exp_rotation
.
x
=
0
.
0
f
;
exp_rotation
.
y
=
0
.
693520
f
;
exp_rotation
.
z
=
0
.
693520
f
;
exp_translation
.
x
=
-
5
.
0
f
;
exp_translation
.
y
=
0
.
0
f
;
exp_translation
.
z
=
10
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*__________*/
pm
.
m
[
0
][
0
]
=
0
.
7156004
f
;
pm
.
m
[
1
][
0
]
=
-
0
.
5098283
f
;
pm
.
m
[
2
][
0
]
=
-
0
.
4774843
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
-
0
.
6612288
f
;
pm
.
m
[
1
][
1
]
=
-
0
.
7147621
f
;
pm
.
m
[
2
][
1
]
=
-
0
.
2277977
f
;
pm
.
m
[
3
][
1
]
=
0
.
0
f
;
pm
.
m
[
0
][
2
]
=
-
0
.
2251499
f
;
pm
.
m
[
1
][
2
]
=
0
.
4787385
f
;
pm
.
m
[
2
][
2
]
=
-
0
.
8485972
f
;
pm
.
m
[
3
][
2
]
=
10
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
1
.
0
f
;
exp_scale
.
y
=
1
.
0
f
;
exp_scale
.
z
=
1
.
0
f
;
exp_rotation
.
w
=
0
.
195091
f
;
exp_rotation
.
x
=
0
.
905395
f
;
exp_rotation
.
y
=
-
0
.
323355
f
;
exp_rotation
.
z
=
-
0
.
194013
f
;
exp_translation
.
x
=
-
5
.
0
f
;
exp_translation
.
y
=
0
.
0
f
;
exp_translation
.
z
=
10
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*_____________*/
pm
.
m
[
0
][
0
]
=
0
.
06554436
f
;
pm
.
m
[
1
][
0
]
=
-
0
.
6873012
f
;
pm
.
m
[
2
][
0
]
=
0
.
7234092
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
-
0
.
9617381
f
;
pm
.
m
[
1
][
1
]
=
-
0
.
2367795
f
;
pm
.
m
[
2
][
1
]
=
-
0
.
1378230
f
;
pm
.
m
[
3
][
1
]
=
0
.
0
f
;
pm
.
m
[
0
][
2
]
=
0
.
2660144
f
;
pm
.
m
[
1
][
2
]
=
-
0
.
6866967
f
;
pm
.
m
[
2
][
2
]
=
-
0
.
6765233
f
;
pm
.
m
[
3
][
2
]
=
10
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
1
.
0
f
;
exp_scale
.
y
=
1
.
0
f
;
exp_scale
.
z
=
1
.
0
f
;
exp_rotation
.
w
=
-
0
.
195091
f
;
exp_rotation
.
x
=
0
.
703358
f
;
exp_rotation
.
y
=
-
0
.
586131
f
;
exp_rotation
.
z
=
0
.
351679
f
;
exp_translation
.
x
=
-
5
.
0
f
;
exp_translation
.
y
=
0
.
0
f
;
exp_translation
.
z
=
10
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*_________*/
pm
.
m
[
0
][
0
]
=
7
.
121047
f
;
pm
.
m
[
1
][
0
]
=
-
5
.
883487
f
;
pm
.
m
[
2
][
0
]
=
11
.
81843
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
5
.
883487
f
;
pm
.
m
[
1
][
1
]
=
-
10
.
60660
f
;
pm
.
m
[
2
][
1
]
=
-
8
.
825232
f
;
pm
.
m
[
3
][
1
]
=
0
.
0
f
;
pm
.
m
[
0
][
2
]
=
11
.
81843
f
;
pm
.
m
[
1
][
2
]
=
8
.
8252320
f
;
pm
.
m
[
2
][
2
]
=
-
2
.
727645
f
;
pm
.
m
[
3
][
2
]
=
2
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
exp_scale
.
x
=
15
.
0
f
;
exp_scale
.
y
=
15
.
0
f
;
exp_scale
.
z
=
15
.
0
f
;
exp_rotation
.
w
=
0
.
382684
f
;
exp_rotation
.
x
=
0
.
768714
f
;
exp_rotation
.
y
=
0
.
0
f
;
exp_rotation
.
z
=
0
.
512476
f
;
exp_translation
.
x
=
-
5
.
0
f
;
exp_translation
.
y
=
0
.
0
f
;
exp_translation
.
z
=
2
.
0
f
;
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
compare_scale
(
exp_scale
,
got_scale
);
compare_rotation
(
exp_rotation
,
got_rotation
);
compare_translation
(
exp_translation
,
got_translation
);
/*__________*/
pm
.
m
[
0
][
0
]
=
0
.
0
f
;
pm
.
m
[
1
][
0
]
=
4
.
0
f
;
pm
.
m
[
2
][
0
]
=
5
.
0
f
;
pm
.
m
[
3
][
0
]
=
-
5
.
0
f
;
pm
.
m
[
0
][
1
]
=
0
.
0
f
;
pm
.
m
[
1
][
1
]
=
-
10
.
60660
f
;
pm
.
m
[
2
][
1
]
=
-
8
.
825232
f
;
pm
.
m
[
3
][
1
]
=
6
.
0
f
;
pm
.
m
[
0
][
2
]
=
0
.
0
f
;
pm
.
m
[
1
][
2
]
=
8
.
8252320
f
;
pm
.
m
[
2
][
2
]
=
2
.
727645
;
pm
.
m
[
3
][
2
]
=
3
.
0
f
;
pm
.
m
[
0
][
3
]
=
0
.
0
f
;
pm
.
m
[
1
][
3
]
=
0
.
0
f
;
pm
.
m
[
2
][
3
]
=
0
.
0
f
;
pm
.
m
[
3
][
3
]
=
1
.
0
f
;
hr
=
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
&
pm
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %x
\n
"
,
hr
);
/*___________*/
hr
=
D3DXMatrixDecompose
(
&
got_scale
,
&
got_rotation
,
&
got_translation
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Expected D3DERR_INVALIDCALL, got %x
\n
"
,
hr
);
}
static
void
test_D3DXVec_Array
(
void
)
{
unsigned
int
i
;
...
...
@@ -198,5 +566,6 @@ static void test_D3DXVec_Array(void)
START_TEST
(
math
)
{
test_Matrix_Decompose
();
test_D3DXVec_Array
();
}
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