From: Elizabeth Figura zfigura@codeweavers.com
Assuming it changes in a meaningful way. --- dlls/wined3d/glsl_shader.c | 26 +------------------------- dlls/wined3d/stateblock.c | 29 +++++++++++++++++++++++++++-- dlls/wined3d/wined3d_private.h | 13 ++++--------- 3 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 2ab09f98cf6..a8e0a83712d 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11815,15 +11815,8 @@ static void glsl_vertex_pipe_shader(struct wined3d_context *context, static void glsl_vertex_pipe_vdecl(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - const struct wined3d_vertex_declaration *vdecl = state->vertex_declaration; - struct wined3d_context_gl *context_gl = wined3d_context_gl(context); - const struct wined3d_gl_info *gl_info = context_gl->gl_info; BOOL transformed = context->stream_info.position_transformed; BOOL wasrhw = context->last_was_rhw; - bool point_size = vdecl && vdecl->point_size; - bool specular = vdecl && vdecl->specular; - bool diffuse = vdecl && vdecl->diffuse; - bool normal = vdecl && vdecl->normal;
context->last_was_rhw = transformed;
@@ -11838,29 +11831,12 @@ static void glsl_vertex_pipe_vdecl(struct wined3d_context *context,
if (!use_vs(state)) { - /* 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. - * - * Likewise, we have to invalidate the shader when using per-vertex - * colours and specular attribute presence changes, or when - * normal, diffuse, or point size presence changes. */ - if (!shader_glsl_full_ffp_varyings(gl_info) || diffuse != context->last_was_diffuse - || (state->render_states[WINED3D_RS_COLORVERTEX] && specular != context->last_was_specular) - || normal != context->last_was_normal || point_size != context->last_was_point_size) - context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_VERTEX; - + /* Because of args->tex_transform. */ if (use_ps(state) && state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.major == 1 && state->shader[WINED3D_SHADER_TYPE_PIXEL]->reg_maps.shader_version.minor <= 3) context->shader_update_mask |= 1u << WINED3D_SHADER_TYPE_PIXEL; } - - 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_point_size = point_size; }
static void glsl_vertex_pipe_vs(struct wined3d_context *context, diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index e0f9f631d2d..72f3f7301ed 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1541,18 +1541,43 @@ HRESULT CDECL wined3d_stateblock_get_ps_consts_b(struct wined3d_stateblock *stat void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration) { + struct wined3d_vertex_declaration *prev = stateblock->stateblock_state.vertex_declaration; + TRACE("stateblock %p, declaration %p.\n", stateblock, declaration);
if (declaration) wined3d_vertex_declaration_incref(declaration); - if (stateblock->stateblock_state.vertex_declaration) - wined3d_vertex_declaration_decref(stateblock->stateblock_state.vertex_declaration); + if (prev) + wined3d_vertex_declaration_decref(prev); stateblock->stateblock_state.vertex_declaration = declaration; stateblock->changed.vertexDecl = TRUE; /* Texture matrices depend on the format of the TEXCOORD attributes. */ /* FIXME: They also depend on whether the draw is pretransformed, * but that should go away. */ stateblock->changed.texture_matrices = TRUE; + + if (declaration && prev) + { + if (!stateblock->stateblock_state.vs) + { + /* 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. + * + * Likewise, we have to invalidate the shader when using per-vertex + * colours and diffuse/specular attribute presence changes, or when + * normal presence changes. */ + if (!stateblock->device->adapter->d3d_info.full_ffp_varyings + || (stateblock->stateblock_state.rs[WINED3D_RS_COLORVERTEX] + && (declaration->diffuse != prev->diffuse || declaration->specular != prev->specular)) + || declaration->normal != prev->normal || declaration->point_size != prev->point_size) + stateblock->changed.ffp_vs_settings = 1; + } + } + else + { + stateblock->changed.ffp_vs_settings = 1; + } }
void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index d6f935f15ea..b142d514c71 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1889,15 +1889,7 @@ struct wined3d_context DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */ DWORD update_shader_resource_bindings : 1; DWORD update_compute_shader_resource_bindings : 1; - DWORD update_unordered_access_view_bindings : 1; - DWORD update_compute_unordered_access_view_bindings : 1; - DWORD update_primitive_type : 1; DWORD last_was_rhw : 1; /* True iff last draw_primitive was in xyzrhw mode. */ - DWORD last_was_vshader : 1; - DWORD last_was_diffuse : 1; - DWORD last_was_specular : 1; - DWORD last_was_normal : 1; - DWORD last_was_point_size : 1; DWORD last_was_ffp_blit : 1; DWORD last_was_blit : 1; DWORD last_was_dual_source_blend : 1; @@ -1911,9 +1903,12 @@ struct wined3d_context DWORD current : 1; DWORD destroyed : 1; DWORD destroy_delayed : 1; + DWORD update_unordered_access_view_bindings : 1; + DWORD update_compute_unordered_access_view_bindings : 1; + DWORD update_primitive_type : 1; DWORD update_multisample_state : 1; DWORD update_patch_vertex_count : 1; - DWORD padding : 23; + DWORD padding : 28;
DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */