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
bb3549fc
Commit
bb3549fc
authored
Feb 26, 2013
by
Nozomi Kodama
Committed by
Alexandre Julliard
Feb 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Explicit computations in D3DXMatrixInverse to speed them up.
parent
c66d9eb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
30 deletions
+66
-30
math.c
dlls/d3dx9_36/math.c
+66
-30
No files found.
dlls/d3dx9_36/math.c
View file @
bb3549fc
...
...
@@ -277,39 +277,75 @@ FLOAT WINAPI D3DXMatrixDeterminant(const D3DXMATRIX *pm)
D3DXMATRIX
*
WINAPI
D3DXMatrixInverse
(
D3DXMATRIX
*
pout
,
FLOAT
*
pdeterminant
,
const
D3DXMATRIX
*
pm
)
{
int
a
,
i
,
j
;
D3DXMATRIX
out
;
D3DXVECTOR4
v
,
vec
[
3
];
FLOAT
det
;
FLOAT
det
,
t
[
3
],
v
[
16
];
UINT
i
,
j
;
TRACE
(
"pout %p, pdeterminant %p, pm %p
\n
"
,
pout
,
pdeterminant
,
pm
);
det
=
D3DXMatrixDeterminant
(
pm
);
if
(
!
det
)
return
NULL
;
if
(
pdeterminant
)
*
pdeterminant
=
det
;
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
j
=
0
;
j
<
4
;
j
++
)
{
if
(
j
!=
i
)
{
a
=
j
;
if
(
j
>
i
)
a
=
a
-
1
;
vec
[
a
].
x
=
pm
->
u
.
m
[
j
][
0
];
vec
[
a
].
y
=
pm
->
u
.
m
[
j
][
1
];
vec
[
a
].
z
=
pm
->
u
.
m
[
j
][
2
];
vec
[
a
].
w
=
pm
->
u
.
m
[
j
][
3
];
}
}
D3DXVec4Cross
(
&
v
,
&
vec
[
0
],
&
vec
[
1
],
&
vec
[
2
]);
out
.
u
.
m
[
0
][
i
]
=
pow
(
-
1
.
0
f
,
i
)
*
v
.
x
/
det
;
out
.
u
.
m
[
1
][
i
]
=
pow
(
-
1
.
0
f
,
i
)
*
v
.
y
/
det
;
out
.
u
.
m
[
2
][
i
]
=
pow
(
-
1
.
0
f
,
i
)
*
v
.
z
/
det
;
out
.
u
.
m
[
3
][
i
]
=
pow
(
-
1
.
0
f
,
i
)
*
v
.
w
/
det
;
}
*
pout
=
out
;
return
pout
;
t
[
0
]
=
pm
->
u
.
m
[
2
][
2
]
*
pm
->
u
.
m
[
3
][
3
]
-
pm
->
u
.
m
[
2
][
3
]
*
pm
->
u
.
m
[
3
][
2
];
t
[
1
]
=
pm
->
u
.
m
[
1
][
2
]
*
pm
->
u
.
m
[
3
][
3
]
-
pm
->
u
.
m
[
1
][
3
]
*
pm
->
u
.
m
[
3
][
2
];
t
[
2
]
=
pm
->
u
.
m
[
1
][
2
]
*
pm
->
u
.
m
[
2
][
3
]
-
pm
->
u
.
m
[
1
][
3
]
*
pm
->
u
.
m
[
2
][
2
];
v
[
0
]
=
pm
->
u
.
m
[
1
][
1
]
*
t
[
0
]
-
pm
->
u
.
m
[
2
][
1
]
*
t
[
1
]
+
pm
->
u
.
m
[
3
][
1
]
*
t
[
2
];
v
[
4
]
=
-
pm
->
u
.
m
[
1
][
0
]
*
t
[
0
]
+
pm
->
u
.
m
[
2
][
0
]
*
t
[
1
]
-
pm
->
u
.
m
[
3
][
0
]
*
t
[
2
];
t
[
0
]
=
pm
->
u
.
m
[
1
][
0
]
*
pm
->
u
.
m
[
2
][
1
]
-
pm
->
u
.
m
[
2
][
0
]
*
pm
->
u
.
m
[
1
][
1
];
t
[
1
]
=
pm
->
u
.
m
[
1
][
0
]
*
pm
->
u
.
m
[
3
][
1
]
-
pm
->
u
.
m
[
3
][
0
]
*
pm
->
u
.
m
[
1
][
1
];
t
[
2
]
=
pm
->
u
.
m
[
2
][
0
]
*
pm
->
u
.
m
[
3
][
1
]
-
pm
->
u
.
m
[
3
][
0
]
*
pm
->
u
.
m
[
2
][
1
];
v
[
8
]
=
pm
->
u
.
m
[
3
][
3
]
*
t
[
0
]
-
pm
->
u
.
m
[
2
][
3
]
*
t
[
1
]
+
pm
->
u
.
m
[
1
][
3
]
*
t
[
2
];
v
[
12
]
=
-
pm
->
u
.
m
[
3
][
2
]
*
t
[
0
]
+
pm
->
u
.
m
[
2
][
2
]
*
t
[
1
]
-
pm
->
u
.
m
[
1
][
2
]
*
t
[
2
];
det
=
pm
->
u
.
m
[
0
][
0
]
*
v
[
0
]
+
pm
->
u
.
m
[
0
][
1
]
*
v
[
4
]
+
pm
->
u
.
m
[
0
][
2
]
*
v
[
8
]
+
pm
->
u
.
m
[
0
][
3
]
*
v
[
12
];
if
(
det
==
0
.
0
f
)
return
NULL
;
if
(
pdeterminant
)
*
pdeterminant
=
det
;
t
[
0
]
=
pm
->
u
.
m
[
2
][
2
]
*
pm
->
u
.
m
[
3
][
3
]
-
pm
->
u
.
m
[
2
][
3
]
*
pm
->
u
.
m
[
3
][
2
];
t
[
1
]
=
pm
->
u
.
m
[
0
][
2
]
*
pm
->
u
.
m
[
3
][
3
]
-
pm
->
u
.
m
[
0
][
3
]
*
pm
->
u
.
m
[
3
][
2
];
t
[
2
]
=
pm
->
u
.
m
[
0
][
2
]
*
pm
->
u
.
m
[
2
][
3
]
-
pm
->
u
.
m
[
0
][
3
]
*
pm
->
u
.
m
[
2
][
2
];
v
[
1
]
=
-
pm
->
u
.
m
[
0
][
1
]
*
t
[
0
]
+
pm
->
u
.
m
[
2
][
1
]
*
t
[
1
]
-
pm
->
u
.
m
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
]
-
pm
->
u
.
m
[
2
][
1
]
*
t
[
2
];
v
[
7
]
=
pm
->
u
.
m
[
0
][
0
]
*
t
[
0
]
-
pm
->
u
.
m
[
1
][
0
]
*
t
[
1
]
+
pm
->
u
.
m
[
2
][
0
]
*
t
[
2
];
v
[
11
]
=
-
pm
->
u
.
m
[
0
][
0
]
*
(
pm
->
u
.
m
[
1
][
1
]
*
pm
->
u
.
m
[
2
][
3
]
-
pm
->
u
.
m
[
1
][
3
]
*
pm
->
u
.
m
[
2
][
1
])
+
pm
->
u
.
m
[
1
][
0
]
*
(
pm
->
u
.
m
[
0
][
1
]
*
pm
->
u
.
m
[
2
][
3
]
-
pm
->
u
.
m
[
0
][
3
]
*
pm
->
u
.
m
[
2
][
1
])
-
pm
->
u
.
m
[
2
][
0
]
*
(
pm
->
u
.
m
[
0
][
1
]
*
pm
->
u
.
m
[
1
][
3
]
-
pm
->
u
.
m
[
0
][
3
]
*
pm
->
u
.
m
[
1
][
1
]);
v
[
15
]
=
pm
->
u
.
m
[
0
][
0
]
*
(
pm
->
u
.
m
[
1
][
1
]
*
pm
->
u
.
m
[
2
][
2
]
-
pm
->
u
.
m
[
1
][
2
]
*
pm
->
u
.
m
[
2
][
1
])
-
pm
->
u
.
m
[
1
][
0
]
*
(
pm
->
u
.
m
[
0
][
1
]
*
pm
->
u
.
m
[
2
][
2
]
-
pm
->
u
.
m
[
0
][
2
]
*
pm
->
u
.
m
[
2
][
1
])
+
pm
->
u
.
m
[
2
][
0
]
*
(
pm
->
u
.
m
[
0
][
1
]
*
pm
->
u
.
m
[
1
][
2
]
-
pm
->
u
.
m
[
0
][
2
]
*
pm
->
u
.
m
[
1
][
1
]);
det
=
1
.
0
f
/
det
;
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
j
=
0
;
j
<
4
;
j
++
)
pout
->
u
.
m
[
i
][
j
]
=
v
[
4
*
i
+
j
]
*
det
;
return
pout
;
}
D3DXMATRIX
*
WINAPI
D3DXMatrixLookAtLH
(
D3DXMATRIX
*
pout
,
const
D3DXVECTOR3
*
peye
,
const
D3DXVECTOR3
*
pat
,
const
D3DXVECTOR3
*
pup
)
...
...
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