wined3d: Move multiply_vector_matrix() to wined3d_private.h.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-05-21 01:27:33 +04:30 committed by Alexandre Julliard
parent d130f7fe0b
commit 9c95ee3890
2 changed files with 19 additions and 19 deletions

View File

@ -1374,19 +1374,6 @@ static void shader_glsl_ffp_vertex_lightambient_uniform(const struct wined3d_con
checkGLcall("glUniform3fv"); checkGLcall("glUniform3fv");
} }
static void multiply_vector_matrix(struct wined3d_vec4 *dest, const struct wined3d_vec4 *src1,
const struct wined3d_matrix *src2)
{
struct wined3d_vec4 temp;
temp.x = (src1->x * src2->_11) + (src1->y * src2->_21) + (src1->z * src2->_31) + (src1->w * src2->_41);
temp.y = (src1->x * src2->_12) + (src1->y * src2->_22) + (src1->z * src2->_32) + (src1->w * src2->_42);
temp.z = (src1->x * src2->_13) + (src1->y * src2->_23) + (src1->z * src2->_33) + (src1->w * src2->_43);
temp.w = (src1->x * src2->_14) + (src1->y * src2->_24) + (src1->z * src2->_34) + (src1->w * src2->_44);
*dest = temp;
}
static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *context, static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *context,
const struct wined3d_state *state, unsigned int light, const struct wined3d_light_info *light_info, const struct wined3d_state *state, unsigned int light, const struct wined3d_light_info *light_info,
struct glsl_shader_prog_link *prog) struct glsl_shader_prog_link *prog)
@ -1402,7 +1389,7 @@ static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *c
switch (light_info->OriginalParms.type) switch (light_info->OriginalParms.type)
{ {
case WINED3D_LIGHT_POINT: case WINED3D_LIGHT_POINT:
multiply_vector_matrix(&vec4, &light_info->position, view); wined3d_vec4_transform(&vec4, &light_info->position, view);
GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x)); GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x));
GL_EXTCALL(glUniform1f(prog->vs.light_location[light].range, light_info->OriginalParms.range)); GL_EXTCALL(glUniform1f(prog->vs.light_location[light].range, light_info->OriginalParms.range));
GL_EXTCALL(glUniform1f(prog->vs.light_location[light].c_att, light_info->OriginalParms.attenuation0)); GL_EXTCALL(glUniform1f(prog->vs.light_location[light].c_att, light_info->OriginalParms.attenuation0));
@ -1411,10 +1398,10 @@ static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *c
break; break;
case WINED3D_LIGHT_SPOT: case WINED3D_LIGHT_SPOT:
multiply_vector_matrix(&vec4, &light_info->position, view); wined3d_vec4_transform(&vec4, &light_info->position, view);
GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x)); GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x));
multiply_vector_matrix(&vec4, &light_info->direction, view); wined3d_vec4_transform(&vec4, &light_info->direction, view);
GL_EXTCALL(glUniform3fv(prog->vs.light_location[light].direction, 1, &vec4.x)); GL_EXTCALL(glUniform3fv(prog->vs.light_location[light].direction, 1, &vec4.x));
GL_EXTCALL(glUniform1f(prog->vs.light_location[light].range, light_info->OriginalParms.range)); GL_EXTCALL(glUniform1f(prog->vs.light_location[light].range, light_info->OriginalParms.range));
@ -1427,12 +1414,12 @@ static void shader_glsl_ffp_vertex_light_uniform(const struct wined3d_context *c
break; break;
case WINED3D_LIGHT_DIRECTIONAL: case WINED3D_LIGHT_DIRECTIONAL:
multiply_vector_matrix(&vec4, &light_info->direction, view); wined3d_vec4_transform(&vec4, &light_info->direction, view);
GL_EXTCALL(glUniform3fv(prog->vs.light_location[light].direction, 1, &vec4.x)); GL_EXTCALL(glUniform3fv(prog->vs.light_location[light].direction, 1, &vec4.x));
break; break;
case WINED3D_LIGHT_PARALLELPOINT: case WINED3D_LIGHT_PARALLELPOINT:
multiply_vector_matrix(&vec4, &light_info->position, view); wined3d_vec4_transform(&vec4, &light_info->position, view);
GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x)); GL_EXTCALL(glUniform4fv(prog->vs.light_location[light].position, 1, &vec4.x));
break; break;
@ -1505,7 +1492,7 @@ static void shader_glsl_clip_plane_uniform(const struct wined3d_context *context
{ {
invert_matrix(&matrix, &state->transforms[WINED3D_TS_VIEW]); invert_matrix(&matrix, &state->transforms[WINED3D_TS_VIEW]);
transpose_matrix(&matrix, &matrix); transpose_matrix(&matrix, &matrix);
multiply_vector_matrix(&plane, &plane, &matrix); wined3d_vec4_transform(&plane, &plane, &matrix);
} }
GL_EXTCALL(glUniform4fv(prog->vs.clip_planes_location + index, 1, &plane.x)); GL_EXTCALL(glUniform4fv(prog->vs.clip_planes_location + index, 1, &plane.x));

View File

@ -4878,6 +4878,19 @@ static inline void wined3d_get_material_colour_source(enum wined3d_material_colo
*specular = validate_material_colour_source(si->use_map, state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]); *specular = validate_material_colour_source(si->use_map, state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]);
} }
static inline void wined3d_vec4_transform(struct wined3d_vec4 *dst,
const struct wined3d_vec4 *v, const struct wined3d_matrix *m)
{
struct wined3d_vec4 tmp;
tmp.x = v->x * m->_11 + v->y * m->_21 + v->z * m->_31 + v->w * m->_41;
tmp.y = v->x * m->_12 + v->y * m->_22 + v->z * m->_32 + v->w * m->_42;
tmp.z = v->x * m->_13 + v->y * m->_23 + v->z * m->_33 + v->w * m->_43;
tmp.w = v->x * m->_14 + v->y * m->_24 + v->z * m->_34 + v->w * m->_44;
*dst = tmp;
}
BOOL invert_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m) DECLSPEC_HIDDEN; BOOL invert_matrix(struct wined3d_matrix *out, const struct wined3d_matrix *m) DECLSPEC_HIDDEN;
void compute_normal_matrix(float *normal_matrix, BOOL legacy_lighting, void compute_normal_matrix(float *normal_matrix, BOOL legacy_lighting,