diff options
author | Axel Davy <[email protected]> | 2016-09-25 12:43:29 +0200 |
---|---|---|
committer | Axel Davy <[email protected]> | 2016-10-10 23:43:50 +0200 |
commit | 7afcbb49baa9b4e447d3806aaffcebc01103c965 (patch) | |
tree | 247a756112df6a485f631a751f9849f144b9b085 /src/gallium/state_trackers/nine | |
parent | 36399f9a7f97692a69157c74bb503dc8cb427fa5 (diff) |
st/nine: Fix ff computation for inverse
Thanks to wine tests.
Apparently 4x4 inverse is to be used, and
if the inverse can't be calculated, the
input matrix is to be used.
Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.c | 26 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.h | 3 |
2 files changed, 6 insertions, 23 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index 2c237f4ed84..b2d6a9d759b 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -1825,7 +1825,7 @@ nine_ff_load_vs_transforms(struct NineDevice9 *device) nine_d3d_matrix_matrix_mul(&M[0], &M[1], GET_D3DTS(PROJECTION)); /* normal matrix == transpose(inverse(WV)) */ - nine_d3d_matrix_inverse_3x3(&T, &M[1]); + nine_d3d_matrix_inverse(&T, &M[1]); nine_d3d_matrix_transpose(&M[4], &T); /* P matrix */ @@ -2445,6 +2445,11 @@ nine_d3d_matrix_inverse(D3DMATRIX *D, const D3DMATRIX *M) M->m[2][0] * D->m[0][2] + M->m[3][0] * D->m[0][3]; + if (det < 1e-30) {/* non inversible */ + *D = *M; /* wine tests */ + return; + } + det = 1.0 / det; for (i = 0; i < 4; i++) @@ -2464,22 +2469,3 @@ nine_d3d_matrix_inverse(D3DMATRIX *D, const D3DMATRIX *M) } #endif } - -/* TODO: don't use 4x4 inverse, unless this gets all nicely inlined ? */ -void -nine_d3d_matrix_inverse_3x3(D3DMATRIX *D, const D3DMATRIX *M) -{ - D3DMATRIX T; - unsigned i, j; - - for (i = 0; i < 3; ++i) - for (j = 0; j < 3; ++j) - T.m[i][j] = M->m[i][j]; - for (i = 0; i < 3; ++i) { - T.m[i][3] = 0.0f; - T.m[3][i] = 0.0f; - } - T.m[3][3] = 1.0f; - - nine_d3d_matrix_inverse(D, &T); -} diff --git a/src/gallium/state_trackers/nine/nine_ff.h b/src/gallium/state_trackers/nine/nine_ff.h index 9c33c76370d..6c32dba5902 100644 --- a/src/gallium/state_trackers/nine/nine_ff.h +++ b/src/gallium/state_trackers/nine/nine_ff.h @@ -25,9 +25,6 @@ void nine_d3d_matrix_inverse(D3DMATRIX *, const D3DMATRIX *); void -nine_d3d_matrix_inverse_3x3(D3DMATRIX *, const D3DMATRIX *); - -void nine_d3d_matrix_transpose(D3DMATRIX *, const D3DMATRIX *); #define NINED3DTSS_TCI_DISABLE 0 |