wined3d: Invalidate the FFP vertex shader when diffuse/specular attribute presence changes.

Debugged by Andy Clayton.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-08-05 02:47:51 +04:30 committed by Alexandre Julliard
parent 8e2f08b92e
commit 5e3866cbdb
2 changed files with 15 additions and 3 deletions

View File

@ -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;
}

View File

@ -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;