Commit 5e3866cb authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

Debugged by Andy Clayton. Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8e2f08b9
...@@ -11692,6 +11692,8 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, ...@@ -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_state *state, DWORD state_id)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; 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)); BOOL normal = !!(context->stream_info.use_map & (1u << WINED3D_FFP_NORMAL));
const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info); const BOOL legacy_clip_planes = needs_legacy_glsl_syntax(gl_info);
BOOL transformed = context->stream_info.position_transformed; BOOL transformed = context->stream_info.position_transformed;
...@@ -11724,8 +11726,14 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, ...@@ -11724,8 +11726,14 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
/* Because of settings->texcoords, we have to regenerate the vertex /* Because of settings->texcoords, we have to regenerate the vertex
* shader on a vdecl change if there aren't enough varyings to just * 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) 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) || normal != context->last_was_normal)
context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX;
...@@ -11748,6 +11756,8 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, ...@@ -11748,6 +11756,8 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
} }
context->last_was_vshader = use_vs(state); context->last_was_vshader = use_vs(state);
context->last_was_diffuse = diffuse;
context->last_was_specular = specular;
context->last_was_normal = normal; context->last_was_normal = normal;
} }
......
...@@ -1879,6 +1879,8 @@ struct wined3d_context ...@@ -1879,6 +1879,8 @@ struct wined3d_context
DWORD last_swizzle_map : 16; /* MAX_ATTRIBS, 16 */ DWORD last_swizzle_map : 16; /* MAX_ATTRIBS, 16 */
DWORD last_was_pshader : 1; DWORD last_was_pshader : 1;
DWORD last_was_vshader : 1; DWORD last_was_vshader : 1;
DWORD last_was_diffuse : 1;
DWORD last_was_specular : 1;
DWORD last_was_normal : 1; DWORD last_was_normal : 1;
DWORD namedArraysLoaded : 1; DWORD namedArraysLoaded : 1;
DWORD last_was_ffp_blit : 1; DWORD last_was_ffp_blit : 1;
...@@ -1886,7 +1888,6 @@ struct wined3d_context ...@@ -1886,7 +1888,6 @@ struct wined3d_context
DWORD last_was_ckey : 1; DWORD last_was_ckey : 1;
DWORD fog_coord : 1; DWORD fog_coord : 1;
DWORD fog_enabled : 1; DWORD fog_enabled : 1;
DWORD num_untracked_materials : 2; /* Max value 2 */
DWORD current : 1; DWORD current : 1;
DWORD destroyed : 1; DWORD destroyed : 1;
DWORD valid : 1; DWORD valid : 1;
...@@ -1911,7 +1912,8 @@ struct wined3d_context ...@@ -1911,7 +1912,8 @@ struct wined3d_context
DWORD transform_feedback_paused : 1; DWORD transform_feedback_paused : 1;
DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */ DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */
DWORD clip_distance_mask : 8; /* MAX_CLIP_DISTANCES, 8 */ 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 constant_update_mask;
DWORD numbered_array_mask; DWORD numbered_array_mask;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment