diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index 2913b9e67d..38d25adb43 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -16,21 +16,30 @@ #include "../../configuration.h" #include "../../verbosity.h" -#if defined(HAVE_D3D9) -#include -#endif - -#if defined(HAVE_D3D8) -#include -#endif - #include "d3d_common.h" +struct d3d_matrix +{ + union { + struct { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + + }; + float m[4][4]; + }; +}; + +#define D3D_TEXTURE_FILTER_LINEAR 2 +#define D3D_TEXTURE_FILTER_POINT 1 + void *d3d_matrix_transpose(void *_pout, const void *_pm) { unsigned i,j; - D3DMATRIX *pout = (D3DMATRIX*)_pout; - CONST D3DMATRIX *pm = (D3DMATRIX*)_pm; + struct d3d_matrix *pout = (struct d3d_matrix*)_pout; + const struct d3d_matrix *pm = (struct d3d_matrix*)_pm; for (i = 0; i < 4; i++) { @@ -43,7 +52,7 @@ void *d3d_matrix_transpose(void *_pout, const void *_pm) void *d3d_matrix_identity(void *_pout) { - D3DMATRIX *pout = (D3DMATRIX*)_pout; + struct d3d_matrix *pout = (struct d3d_matrix*)_pout; if ( !pout ) return NULL; @@ -69,7 +78,7 @@ void *d3d_matrix_identity(void *_pout) void *d3d_matrix_ortho_off_center_lh(void *_pout, float l, float r, float b, float t, float zn, float zf) { - D3DMATRIX *pout = (D3DMATRIX*)_pout; + struct d3d_matrix *pout = (struct d3d_matrix*)_pout; d3d_matrix_identity(pout); @@ -86,13 +95,13 @@ void *d3d_matrix_multiply(void *_pout, const void *_pm1, const void *_pm2) { unsigned i,j; - D3DMATRIX *pout = (D3DMATRIX*)_pout; - CONST D3DMATRIX *pm1 = (CONST D3DMATRIX*)_pm1; - CONST D3DMATRIX *pm2 = (CONST D3DMATRIX*)_pm2; + struct d3d_matrix *pout = (struct d3d_matrix*)_pout; + const struct d3d_matrix *pm1 = (const struct d3d_matrix*)_pm1; + const struct d3d_matrix *pm2 = (const struct d3d_matrix*)_pm2; - for (i=0; i<4; i++) + for (i = 0; i < 4; i++) { - for (j=0; j<4; j++) + for (j = 0; j < 4; j++) pout->m[i][j] = pm1->m[i][0] * pm2->m[0][j] + pm1->m[i][1] * pm2->m[1][j] + pm1->m[i][2] * pm2->m[2][j] + pm1->m[i][3] * pm2->m[3][j]; } @@ -101,7 +110,8 @@ void *d3d_matrix_multiply(void *_pout, void *d3d_matrix_rotation_z(void *_pout, float angle) { - D3DMATRIX *pout = (D3DMATRIX*)_pout; + struct d3d_matrix *pout = (struct d3d_matrix*)_pout; + d3d_matrix_identity(pout); pout->m[0][0] = cos(angle); pout->m[1][1] = cos(angle); @@ -122,10 +132,10 @@ int32_t d3d_translate_filter(unsigned type) } /* fall-through */ case RARCH_FILTER_LINEAR: - return (int32_t)D3DTEXF_LINEAR; + return (int32_t)D3D_TEXTURE_FILTER_LINEAR; case RARCH_FILTER_NEAREST: break; } - return (int32_t)D3DTEXF_POINT; + return (int32_t)D3D_TEXTURE_FILTER_POINT; }