From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/glsl_shader.c | 18 +++++++++++++----- dlls/wined3d/utils.c | 8 ++------ dlls/wined3d/wined3d_private.h | 3 +-- 3 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 977e5f1ae07..7d14ba7580d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1572,7 +1572,7 @@ static void shader_glsl_ffp_vertex_normalmatrix_uniform(const struct wined3d_con if (prog->vs.normal_matrix_location == -1) return;
- get_modelview_matrix(&context_gl->c, state, 0, &mv); + get_modelview_matrix(state, 0, &mv); compute_normal_matrix(mat, context_gl->c.d3d_info->wined3d_creation_flags & WINED3D_LEGACY_FFP_LIGHTING, &mv);
GL_EXTCALL(glUniformMatrix3fv(prog->vs.normal_matrix_location, 1, FALSE, mat)); @@ -1790,7 +1790,7 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv, { struct wined3d_matrix mat;
- get_modelview_matrix(context, state, 0, &mat); + get_modelview_matrix(state, 0, &mat); GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[0], 1, FALSE, &mat._11)); checkGLcall("glUniformMatrix4fv");
@@ -1806,7 +1806,7 @@ static void shader_glsl_load_constants(struct shader_glsl_priv *priv, if (prog->vs.modelview_matrix_location[i] == -1) break;
- get_modelview_matrix(context, state, i, &mat); + get_modelview_matrix(state, i, &mat); GL_EXTCALL(glUniformMatrix4fv(prog->vs.modelview_matrix_location[i], 1, FALSE, &mat._11)); checkGLcall("glUniformMatrix4fv"); } @@ -9258,12 +9258,20 @@ static GLuint shader_glsl_generate_ffp_vertex_shader(struct shader_glsl_priv *pr { if (!settings->vertexblends) { - shader_addline(buffer, "normal = ffp_normal_matrix * ffp_attrib_normal;\n"); + if (settings->transformed) + shader_addline(buffer, "normal = ffp_attrib_normal;\n"); + else + shader_addline(buffer, "normal = ffp_normal_matrix * ffp_attrib_normal;\n"); } else { for (i = 0; i < settings->vertexblends + 1; ++i) - shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] * (mat3(ffp_modelview_matrix[%u]) * ffp_attrib_normal);\n", i, i); + { + if (settings->transformed) + shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] * ffp_attrib_normal;\n", i); + else + shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] * (mat3(ffp_modelview_matrix[%u]) * ffp_attrib_normal);\n", i, i); + } }
if (settings->normalize) diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index fb663abcb8f..c7f2f6dcd90 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -5589,13 +5589,9 @@ void get_identity_matrix(struct wined3d_matrix *mat) *mat = identity; }
-void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state, - unsigned int index, struct wined3d_matrix *mat) +void get_modelview_matrix(const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat) { - if (context->stream_info.position_transformed) - get_identity_matrix(mat); - else - multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(index)]); + multiply_matrix(mat, &state->transforms[WINED3D_TS_VIEW], &state->transforms[WINED3D_TS_WORLD_MATRIX(index)]); }
/* Setup this textures matrix according to the texture flags. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 30f836f901f..7979c144a6a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4375,8 +4375,7 @@ static inline BOOL shader_sampler_is_shadow(const struct wined3d_shader *shader, }
void get_identity_matrix(struct wined3d_matrix *mat); -void get_modelview_matrix(const struct wined3d_context *context, const struct wined3d_state *state, - unsigned int index, struct wined3d_matrix *mat); +void get_modelview_matrix(const struct wined3d_state *state, unsigned int index, struct wined3d_matrix *mat); void get_texture_matrix(const struct wined3d_stream_info *si, const struct wined3d_stateblock_state *state, const unsigned int tex, struct wined3d_matrix *mat); void get_pointsize_minmax(const struct wined3d_context *context, const struct wined3d_state *state,