Debugged by Andy Clayton.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/glsl_shader.c | 12 +++++++++++- dlls/wined3d/wined3d_private.h | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 0c73aba8111..d38ba2bcf06 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11692,6 +11692,8 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { const struct wined3d_gl_info *gl_info = context->gl_info; + BOOL specular = !!(context->stream_info.use_map & (1u << WINED3D_FFP_SPECULAR)); + BOOL diffuse = !!(context->stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE)); BOOL normal = !!(context->stream_info.use_map & (1u << WINED3D_FFP_NORMAL)); const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info); BOOL transformed = context->stream_info.position_transformed; @@ -11724,8 +11726,14 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
/* Because of settings->texcoords, we have to regenerate the vertex * shader on a vdecl change if there aren't enough varyings to just - * always output all the texture coordinates. */ + * always output all the texture coordinates. + * + * Likewise, we have to invalidate the shader when using per-vertex + * colours and diffuse/specular attribute presence changes, or when + * normal presence changes. */ if (gl_info->limits.glsl_varyings < wined3d_max_compat_varyings(gl_info) + || (state->render_states[WINED3D_RS_COLORVERTEX] + && (diffuse != context->last_was_diffuse || specular != context->last_was_specular)) || normal != context->last_was_normal) context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
@@ -11748,6 +11756,8 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, }
context->last_was_vshader = use_vs(state); + context->last_was_diffuse = diffuse; + context->last_was_specular = specular; context->last_was_normal = normal; }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 25f7cb2416e..39bb06ad265 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1879,6 +1879,8 @@ struct wined3d_context DWORD last_swizzle_map : 16; /* MAX_ATTRIBS, 16 */ DWORD last_was_pshader : 1; DWORD last_was_vshader : 1; + DWORD last_was_diffuse : 1; + DWORD last_was_specular : 1; DWORD last_was_normal : 1; DWORD namedArraysLoaded : 1; DWORD last_was_ffp_blit : 1; @@ -1886,7 +1888,6 @@ struct wined3d_context DWORD last_was_ckey : 1; DWORD fog_coord : 1; DWORD fog_enabled : 1; - DWORD num_untracked_materials : 2; /* Max value 2 */ DWORD current : 1; DWORD destroyed : 1; DWORD valid : 1; @@ -1911,7 +1912,8 @@ struct wined3d_context DWORD transform_feedback_paused : 1; DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */ DWORD clip_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */ - DWORD padding : 9; + DWORD num_untracked_materials : 2; /* Max value 2 */ + DWORD padding : 7;
DWORD constant_update_mask; DWORD numbered_array_mask;