wined3d: Simplify the wined3d_matrix structure.

oldstable
Henri Verbeet 2015-03-20 12:41:54 +01:00 committed by Alexandre Julliard
parent c5f03c3933
commit ba396e4212
6 changed files with 100 additions and 104 deletions

View File

@ -1362,10 +1362,10 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device,
{ {
TRACE("device %p, state %s, matrix %p.\n", TRACE("device %p, state %s, matrix %p.\n",
device, debug_d3dtstype(d3dts), matrix); device, debug_d3dtstype(d3dts), matrix);
TRACE("%.8e %.8e %.8e %.8e\n", matrix->u.s._11, matrix->u.s._12, matrix->u.s._13, matrix->u.s._14); TRACE("%.8e %.8e %.8e %.8e\n", matrix->_11, matrix->_12, matrix->_13, matrix->_14);
TRACE("%.8e %.8e %.8e %.8e\n", matrix->u.s._21, matrix->u.s._22, matrix->u.s._23, matrix->u.s._24); TRACE("%.8e %.8e %.8e %.8e\n", matrix->_21, matrix->_22, matrix->_23, matrix->_24);
TRACE("%.8e %.8e %.8e %.8e\n", matrix->u.s._31, matrix->u.s._32, matrix->u.s._33, matrix->u.s._34); TRACE("%.8e %.8e %.8e %.8e\n", matrix->_31, matrix->_32, matrix->_33, matrix->_34);
TRACE("%.8e %.8e %.8e %.8e\n", matrix->u.s._41, matrix->u.s._42, matrix->u.s._43, matrix->u.s._44); TRACE("%.8e %.8e %.8e %.8e\n", matrix->_41, matrix->_42, matrix->_43, matrix->_44);
/* Handle recording of state blocks. */ /* Handle recording of state blocks. */
if (device->recording) if (device->recording)
@ -1382,7 +1382,7 @@ void CDECL wined3d_device_set_transform(struct wined3d_device *device,
* tend towards setting the same matrix repeatedly for some reason. * tend towards setting the same matrix repeatedly for some reason.
* *
* From here on we assume that the new matrix is different, wherever it matters. */ * From here on we assume that the new matrix is different, wherever it matters. */
if (!memcmp(&device->state.transforms[d3dts].u.m[0][0], matrix, sizeof(*matrix))) if (!memcmp(&device->state.transforms[d3dts], matrix, sizeof(*matrix)))
{ {
TRACE("The application is setting the same matrix over again.\n"); TRACE("The application is setting the same matrix over again.\n");
return; return;
@ -2779,22 +2779,22 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat); wined3d_device_get_transform(device, WINED3D_TS_WORLD_MATRIX(0), &world_mat);
TRACE("View mat:\n"); TRACE("View mat:\n");
TRACE("%f %f %f %f\n", view_mat.u.s._11, view_mat.u.s._12, view_mat.u.s._13, view_mat.u.s._14); TRACE("%.8e %.8e %.8e %.8e\n", view_mat._11, view_mat._12, view_mat._13, view_mat._14);
TRACE("%f %f %f %f\n", view_mat.u.s._21, view_mat.u.s._22, view_mat.u.s._23, view_mat.u.s._24); TRACE("%.8e %.8e %.8e %.8e\n", view_mat._21, view_mat._22, view_mat._23, view_mat._24);
TRACE("%f %f %f %f\n", view_mat.u.s._31, view_mat.u.s._32, view_mat.u.s._33, view_mat.u.s._34); TRACE("%.8e %.8e %.8e %.8e\n", view_mat._31, view_mat._32, view_mat._33, view_mat._34);
TRACE("%f %f %f %f\n", view_mat.u.s._41, view_mat.u.s._42, view_mat.u.s._43, view_mat.u.s._44); TRACE("%.8e %.8e %.8e %.8e\n", view_mat._41, view_mat._42, view_mat._43, view_mat._44);
TRACE("Proj mat:\n"); TRACE("Proj mat:\n");
TRACE("%f %f %f %f\n", proj_mat.u.s._11, proj_mat.u.s._12, proj_mat.u.s._13, proj_mat.u.s._14); TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._11, proj_mat._12, proj_mat._13, proj_mat._14);
TRACE("%f %f %f %f\n", proj_mat.u.s._21, proj_mat.u.s._22, proj_mat.u.s._23, proj_mat.u.s._24); TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._21, proj_mat._22, proj_mat._23, proj_mat._24);
TRACE("%f %f %f %f\n", proj_mat.u.s._31, proj_mat.u.s._32, proj_mat.u.s._33, proj_mat.u.s._34); TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._31, proj_mat._32, proj_mat._33, proj_mat._34);
TRACE("%f %f %f %f\n", proj_mat.u.s._41, proj_mat.u.s._42, proj_mat.u.s._43, proj_mat.u.s._44); TRACE("%.8e %.8e %.8e %.8e\n", proj_mat._41, proj_mat._42, proj_mat._43, proj_mat._44);
TRACE("World mat:\n"); TRACE("World mat:\n");
TRACE("%f %f %f %f\n", world_mat.u.s._11, world_mat.u.s._12, world_mat.u.s._13, world_mat.u.s._14); TRACE("%.8e %.8e %.8e %.8e\n", world_mat._11, world_mat._12, world_mat._13, world_mat._14);
TRACE("%f %f %f %f\n", world_mat.u.s._21, world_mat.u.s._22, world_mat.u.s._23, world_mat.u.s._24); TRACE("%.8e %.8e %.8e %.8e\n", world_mat._21, world_mat._22, world_mat._23, world_mat._24);
TRACE("%f %f %f %f\n", world_mat.u.s._31, world_mat.u.s._32, world_mat.u.s._33, world_mat.u.s._34); TRACE("%.8e %.8e %.8e %.8e\n", world_mat._31, world_mat._32, world_mat._33, world_mat._34);
TRACE("%f %f %f %f\n", world_mat.u.s._41, world_mat.u.s._42, world_mat.u.s._43, world_mat.u.s._44); TRACE("%.8e %.8e %.8e %.8e\n", world_mat._41, world_mat._42, world_mat._43, world_mat._44);
/* Get the viewport */ /* Get the viewport */
wined3d_device_get_viewport(device, &vp); wined3d_device_get_viewport(device, &vp);
@ -2817,11 +2817,11 @@ static HRESULT process_vertices_strided(const struct wined3d_device *device, DWO
float x, y, z, rhw; float x, y, z, rhw;
TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]); TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]);
/* Multiplication with world, view and projection matrix */ /* Multiplication with world, view and projection matrix. */
x = (p[0] * mat.u.s._11) + (p[1] * mat.u.s._21) + (p[2] * mat.u.s._31) + (1.0f * mat.u.s._41); x = (p[0] * mat._11) + (p[1] * mat._21) + (p[2] * mat._31) + mat._41;
y = (p[0] * mat.u.s._12) + (p[1] * mat.u.s._22) + (p[2] * mat.u.s._32) + (1.0f * mat.u.s._42); y = (p[0] * mat._12) + (p[1] * mat._22) + (p[2] * mat._32) + mat._42;
z = (p[0] * mat.u.s._13) + (p[1] * mat.u.s._23) + (p[2] * mat.u.s._33) + (1.0f * mat.u.s._43); z = (p[0] * mat._13) + (p[1] * mat._23) + (p[2] * mat._33) + mat._43;
rhw = (p[0] * mat.u.s._14) + (p[1] * mat.u.s._24) + (p[2] * mat.u.s._34) + (1.0f * mat.u.s._44); rhw = (p[0] * mat._14) + (p[1] * mat._24) + (p[2] * mat._34) + mat._44;
TRACE("x=%f y=%f z=%f rhw=%f\n", x, y, z, rhw); TRACE("x=%f y=%f z=%f rhw=%f\n", x, y, z, rhw);

View File

@ -782,7 +782,7 @@ static void shader_glsl_load_constants(void *shader_priv, struct wined3d_context
struct wined3d_matrix mat; struct wined3d_matrix mat;
get_modelview_matrix(context, state, &mat); get_modelview_matrix(context, state, &mat);
GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location, 1, FALSE, (GLfloat *)&mat)); GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location, 1, FALSE, &mat._11));
checkGLcall("glUniformMatrix4fv"); checkGLcall("glUniformMatrix4fv");
} }

View File

@ -3299,7 +3299,7 @@ void transform_texture(struct wined3d_context *context, const struct wined3d_sta
generated = (state->texture_states[texUnit][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000) != WINED3DTSS_TCI_PASSTHRU; generated = (state->texture_states[texUnit][WINED3D_TSS_TEXCOORD_INDEX] & 0xffff0000) != WINED3DTSS_TCI_PASSTHRU;
coordIdx = min(state->texture_states[texUnit][WINED3D_TSS_TEXCOORD_INDEX & 0x0000ffff], MAX_TEXTURES - 1); coordIdx = min(state->texture_states[texUnit][WINED3D_TSS_TEXCOORD_INDEX & 0x0000ffff], MAX_TEXTURES - 1);
set_texture_matrix(gl_info, &state->transforms[WINED3D_TS_TEXTURE0 + texUnit].u.m[0][0], set_texture_matrix(gl_info, &state->transforms[WINED3D_TS_TEXTURE0 + texUnit],
state->texture_states[texUnit][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS], state->texture_states[texUnit][WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS],
generated, context->last_was_rhw, generated, context->last_was_rhw,
context->stream_info.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx)) context->stream_info.use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))
@ -3876,7 +3876,7 @@ void clipplane(struct wined3d_context *context, const struct wined3d_state *stat
/* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */ /* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */
if (!use_vs(state)) if (!use_vs(state))
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]); gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW]._11);
else else
/* With vertex shaders, clip planes are not transformed in Direct3D, /* With vertex shaders, clip planes are not transformed in Direct3D,
* while in OpenGL they are still transformed by the model view matix. */ * while in OpenGL they are still transformed by the model view matix. */
@ -3928,9 +3928,9 @@ static void transform_worldex(struct wined3d_context *context, const struct wine
/* World matrix 0 is multiplied with the view matrix because d3d uses 3 /* World matrix 0 is multiplied with the view matrix because d3d uses 3
* matrices while gl uses only 2. To avoid weighting the view matrix * matrices while gl uses only 2. To avoid weighting the view matrix
* incorrectly it has to be multiplied into every GL modelview matrix. */ * incorrectly it has to be multiplied into every GL modelview matrix. */
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]); gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW]._11);
checkGLcall("glLoadMatrixf"); checkGLcall("glLoadMatrixf");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)].u.m[0][0]); gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_WORLD_MATRIX(matrix)]._11);
checkGLcall("glMultMatrixf"); checkGLcall("glMultMatrixf");
} }
@ -4004,7 +4004,7 @@ static void transform_view(struct wined3d_context *context, const struct wined3d
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW); gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode(GL_MODELVIEW)"); checkGLcall("glMatrixMode(GL_MODELVIEW)");
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]); gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW]._11);
checkGLcall("glLoadMatrixf(...)"); checkGLcall("glLoadMatrixf(...)");
/* Reset lights. TODO: Call light apply func */ /* Reset lights. TODO: Call light apply func */
@ -4117,7 +4117,7 @@ void transform_projection(struct wined3d_context *context, const struct wined3d_
gl_info->gl_ops.gl.p_glLoadMatrixd(projection); gl_info->gl_ops.gl.p_glLoadMatrixd(projection);
checkGLcall("glLoadMatrixd"); checkGLcall("glLoadMatrixd");
gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_PROJECTION].u.m[0][0]); gl_info->gl_ops.gl.p_glMultMatrixf(&state->transforms[WINED3D_TS_PROJECTION]._11);
checkGLcall("glLoadMatrixf"); checkGLcall("glLoadMatrixf");
} }
} }
@ -4820,7 +4820,7 @@ void light(struct wined3d_context *context, const struct wined3d_state *state, D
/* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/ /* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW); gl_info->gl_ops.gl.p_glMatrixMode(GL_MODELVIEW);
gl_info->gl_ops.gl.p_glPushMatrix(); gl_info->gl_ops.gl.p_glPushMatrix();
gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW].u.m[0][0]); gl_info->gl_ops.gl.p_glLoadMatrixf(&state->transforms[WINED3D_TS_VIEW]._11);
/* Diffuse: */ /* Diffuse: */
colRGBA[0] = lightInfo->OriginalParms.diffuse.r; colRGBA[0] = lightInfo->OriginalParms.diffuse.r;

View File

@ -3120,12 +3120,12 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage,
void get_identity_matrix(struct wined3d_matrix *mat) void get_identity_matrix(struct wined3d_matrix *mat)
{ {
static const struct wined3d_matrix identity = static const struct wined3d_matrix identity =
{{{ {
1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
}}}; };
*mat = identity; *mat = identity;
} }
@ -3140,10 +3140,10 @@ void get_modelview_matrix(const struct wined3d_context *context, const struct wi
/* Setup this textures matrix according to the texture flags. */ /* Setup this textures matrix according to the texture flags. */
/* Context activation is done by the caller (state handler). */ /* Context activation is done by the caller (state handler). */
void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags, void set_texture_matrix(const struct wined3d_gl_info *gl_info, const struct wined3d_matrix *matrix, DWORD flags,
BOOL calculatedCoords, BOOL transformed, enum wined3d_format_id vtx_fmt, BOOL ffp_proj_control) BOOL calculated_coords, BOOL transformed, enum wined3d_format_id format_id, BOOL ffp_proj_control)
{ {
float mat[16]; struct wined3d_matrix mat;
gl_info->gl_ops.gl.p_glMatrixMode(GL_TEXTURE); gl_info->gl_ops.gl.p_glMatrixMode(GL_TEXTURE);
checkGLcall("glMatrixMode(GL_TEXTURE)"); checkGLcall("glMatrixMode(GL_TEXTURE)");
@ -3161,7 +3161,7 @@ void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat
return; return;
} }
memcpy(mat, smat, 16 * sizeof(float)); mat = *matrix;
if (flags & WINED3D_TTFF_PROJECTED) if (flags & WINED3D_TTFF_PROJECTED)
{ {
@ -3170,42 +3170,47 @@ void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat
switch (flags & ~WINED3D_TTFF_PROJECTED) switch (flags & ~WINED3D_TTFF_PROJECTED)
{ {
case WINED3D_TTFF_COUNT2: case WINED3D_TTFF_COUNT2:
mat[ 3] = mat[ 1]; mat._14 = mat._12;
mat[ 7] = mat[ 5]; mat._24 = mat._22;
mat[11] = mat[ 9]; mat._34 = mat._32;
mat[15] = mat[13]; mat._44 = mat._42;
mat[ 1] = mat[ 5] = mat[ 9] = mat[13] = 0.0f; mat._12 = mat._22 = mat._32 = mat._42 = 0.0f;
break; break;
case WINED3D_TTFF_COUNT3: case WINED3D_TTFF_COUNT3:
mat[ 3] = mat[ 2]; mat._14 = mat._13;
mat[ 7] = mat[ 6]; mat._24 = mat._23;
mat[11] = mat[10]; mat._34 = mat._33;
mat[15] = mat[14]; mat._44 = mat._43;
mat[ 2] = mat[ 6] = mat[10] = mat[14] = 0.0f; mat._13 = mat._23 = mat._33 = mat._43 = 0.0f;
break; break;
} }
} }
} else { /* under directx the R/Z coord can be used for translation, under opengl we use the Q coord instead */ }
if(!calculatedCoords) { else
switch(vtx_fmt) {
/* Under Direct3D the R/Z coord can be used for translation, under
* OpenGL we use the Q coord instead. */
if (!calculated_coords)
{
switch (format_id)
{ {
/* Direct3D passes the default 1.0 in the 2nd coord, while GL
* passes it in the 4th. Swap 2nd and 4th coord. No need to
* store the value of mat._41 in mat._21 because the input
* value to the transformation will be 0, so the matrix value
* is irrelevant. */
case WINED3DFMT_R32_FLOAT: case WINED3DFMT_R32_FLOAT:
/* Direct3D passes the default 1.0 in the 2nd coord, while gl passes it in the 4th. mat._41 = mat._21;
* swap 2nd and 4th coord. No need to store the value of mat[12] in mat[4] because mat._42 = mat._22;
* the input value to the transformation will be 0, so the matrix value is irrelevant mat._43 = mat._23;
*/ mat._44 = mat._24;
mat[12] = mat[4];
mat[13] = mat[5];
mat[14] = mat[6];
mat[15] = mat[7];
break; break;
/* See above, just 3rd and 4th coord. */
case WINED3DFMT_R32G32_FLOAT: case WINED3DFMT_R32G32_FLOAT:
/* See above, just 3rd and 4th coord mat._41 = mat._31;
*/ mat._42 = mat._32;
mat[12] = mat[8]; mat._43 = mat._33;
mat[13] = mat[9]; mat._44 = mat._34;
mat[14] = mat[10];
mat[15] = mat[11];
break; break;
case WINED3DFMT_R32G32B32_FLOAT: /* Opengl defaults match dx defaults */ case WINED3DFMT_R32G32B32_FLOAT: /* Opengl defaults match dx defaults */
case WINED3DFMT_R32G32B32A32_FLOAT: /* No defaults apply, all app defined */ case WINED3DFMT_R32G32B32A32_FLOAT: /* No defaults apply, all app defined */
@ -3226,7 +3231,7 @@ void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat
{ {
/* case WINED3D_TTFF_COUNT1: Won't ever get here. */ /* case WINED3D_TTFF_COUNT1: Won't ever get here. */
case WINED3D_TTFF_COUNT2: case WINED3D_TTFF_COUNT2:
mat[2] = mat[6] = mat[10] = mat[14] = 0; mat._13 = mat._23 = mat._33 = mat._43 = 0.0f;
/* OpenGL divides the first 3 vertex coord by the 4th by default, /* OpenGL divides the first 3 vertex coord by the 4th by default,
* which is essentially the same as D3DTTFF_PROJECTED. Make sure that * which is essentially the same as D3DTTFF_PROJECTED. Make sure that
* the 4th coord evaluates to 1.0 to eliminate that. * the 4th coord evaluates to 1.0 to eliminate that.
@ -3240,12 +3245,12 @@ void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat
* 4th is != 1.0(opengl default). This would have to be fixed in drawStridedSlow * 4th is != 1.0(opengl default). This would have to be fixed in drawStridedSlow
* or a replacement shader. */ * or a replacement shader. */
default: default:
mat[3] = mat[7] = mat[11] = 0; mat[15] = 1; mat._14 = mat._24 = mat._34 = 0.0f; mat._44 = 1.0f;
} }
} }
} }
gl_info->gl_ops.gl.p_glLoadMatrixf(mat); gl_info->gl_ops.gl.p_glLoadMatrixf(&mat._11);
checkGLcall("glLoadMatrixf(mat)"); checkGLcall("glLoadMatrixf(mat)");
} }
@ -3408,35 +3413,33 @@ enum wined3d_format_id pixelformat_for_depth(DWORD depth)
} }
} }
void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *src1, void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
const struct wined3d_matrix *src2)
{ {
struct wined3d_matrix temp; struct wined3d_matrix tmp;
/* Now do the multiplication 'by hand'. /* Now do the multiplication 'by hand'.
I know that all this could be optimised, but this will be done later :-) */ I know that all this could be optimised, but this will be done later :-) */
temp.u.s._11 = (src1->u.s._11 * src2->u.s._11) + (src1->u.s._21 * src2->u.s._12) + (src1->u.s._31 * src2->u.s._13) + (src1->u.s._41 * src2->u.s._14); tmp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
temp.u.s._21 = (src1->u.s._11 * src2->u.s._21) + (src1->u.s._21 * src2->u.s._22) + (src1->u.s._31 * src2->u.s._23) + (src1->u.s._41 * src2->u.s._24); tmp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
temp.u.s._31 = (src1->u.s._11 * src2->u.s._31) + (src1->u.s._21 * src2->u.s._32) + (src1->u.s._31 * src2->u.s._33) + (src1->u.s._41 * src2->u.s._34); tmp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
temp.u.s._41 = (src1->u.s._11 * src2->u.s._41) + (src1->u.s._21 * src2->u.s._42) + (src1->u.s._31 * src2->u.s._43) + (src1->u.s._41 * src2->u.s._44); tmp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
temp.u.s._12 = (src1->u.s._12 * src2->u.s._11) + (src1->u.s._22 * src2->u.s._12) + (src1->u.s._32 * src2->u.s._13) + (src1->u.s._42 * src2->u.s._14); tmp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
temp.u.s._22 = (src1->u.s._12 * src2->u.s._21) + (src1->u.s._22 * src2->u.s._22) + (src1->u.s._32 * src2->u.s._23) + (src1->u.s._42 * src2->u.s._24); tmp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
temp.u.s._32 = (src1->u.s._12 * src2->u.s._31) + (src1->u.s._22 * src2->u.s._32) + (src1->u.s._32 * src2->u.s._33) + (src1->u.s._42 * src2->u.s._34); tmp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
temp.u.s._42 = (src1->u.s._12 * src2->u.s._41) + (src1->u.s._22 * src2->u.s._42) + (src1->u.s._32 * src2->u.s._43) + (src1->u.s._42 * src2->u.s._44); tmp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
temp.u.s._13 = (src1->u.s._13 * src2->u.s._11) + (src1->u.s._23 * src2->u.s._12) + (src1->u.s._33 * src2->u.s._13) + (src1->u.s._43 * src2->u.s._14); tmp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
temp.u.s._23 = (src1->u.s._13 * src2->u.s._21) + (src1->u.s._23 * src2->u.s._22) + (src1->u.s._33 * src2->u.s._23) + (src1->u.s._43 * src2->u.s._24); tmp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
temp.u.s._33 = (src1->u.s._13 * src2->u.s._31) + (src1->u.s._23 * src2->u.s._32) + (src1->u.s._33 * src2->u.s._33) + (src1->u.s._43 * src2->u.s._34); tmp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
temp.u.s._43 = (src1->u.s._13 * src2->u.s._41) + (src1->u.s._23 * src2->u.s._42) + (src1->u.s._33 * src2->u.s._43) + (src1->u.s._43 * src2->u.s._44); tmp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
temp.u.s._14 = (src1->u.s._14 * src2->u.s._11) + (src1->u.s._24 * src2->u.s._12) + (src1->u.s._34 * src2->u.s._13) + (src1->u.s._44 * src2->u.s._14); tmp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
temp.u.s._24 = (src1->u.s._14 * src2->u.s._21) + (src1->u.s._24 * src2->u.s._22) + (src1->u.s._34 * src2->u.s._23) + (src1->u.s._44 * src2->u.s._24); tmp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
temp.u.s._34 = (src1->u.s._14 * src2->u.s._31) + (src1->u.s._24 * src2->u.s._32) + (src1->u.s._34 * src2->u.s._33) + (src1->u.s._44 * src2->u.s._34); tmp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
temp.u.s._44 = (src1->u.s._14 * src2->u.s._41) + (src1->u.s._24 * src2->u.s._42) + (src1->u.s._34 * src2->u.s._43) + (src1->u.s._44 * src2->u.s._44); tmp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
/* And copy the new matrix in the good storage.. */ *dst = tmp;
memcpy(dest, &temp, 16 * sizeof(float));
} }
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) { DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) {
@ -3973,10 +3976,10 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_state *state, const struct
{ {
settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH; settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH;
if (state->transforms[WINED3D_TS_PROJECTION].u.m[0][3] == 0.0f if (state->transforms[WINED3D_TS_PROJECTION]._14 == 0.0f
&& state->transforms[WINED3D_TS_PROJECTION].u.m[1][3] == 0.0f && state->transforms[WINED3D_TS_PROJECTION]._24 == 0.0f
&& state->transforms[WINED3D_TS_PROJECTION].u.m[2][3] == 0.0f && state->transforms[WINED3D_TS_PROJECTION]._34 == 0.0f
&& state->transforms[WINED3D_TS_PROJECTION].u.m[3][3] == 1.0f) && state->transforms[WINED3D_TS_PROJECTION]._44 == 1.0f)
settings->ortho_fog = 1; settings->ortho_fog = 1;
} }
else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE) else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE)

View File

@ -2782,8 +2782,8 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage,
void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
BOOL is_alpha, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3, BOOL is_alpha, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3,
INT texture_idx, DWORD dst) DECLSPEC_HIDDEN; INT texture_idx, DWORD dst) DECLSPEC_HIDDEN;
void set_texture_matrix(const struct wined3d_gl_info *gl_info, const float *smat, DWORD flags, void set_texture_matrix(const struct wined3d_gl_info *gl_info, const struct wined3d_matrix *matrix,
BOOL calculatedCoords, BOOL transformed, enum wined3d_format_id coordtype, DWORD flags, BOOL calculated_coords, BOOL transformed, enum wined3d_format_id format_id,
BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN; BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN;
void texture_activate_dimensions(const struct wined3d_texture *texture, void texture_activate_dimensions(const struct wined3d_texture *texture,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;

View File

@ -1530,17 +1530,10 @@ struct wined3d_vec4
struct wined3d_matrix struct wined3d_matrix
{ {
union float _11, _12, _13, _14;
{ float _21, _22, _23, _24;
struct float _31, _32, _33, _34;
{ float _41, _42, _43, _44;
float _11, _12, _13, _14;
float _21, _22, _23, _24;
float _31, _32, _33, _34;
float _41, _42, _43, _44;
} DUMMYSTRUCTNAME;
float m[4][4];
} DUMMYUNIONNAME;
}; };
struct wined3d_light struct wined3d_light