This fixes the non-default ARB shader backend, broken since 2ddb6b66a7cda0bf6aaddc0c6899e35cc92ceee9, although the fundamental issue was there long before that.
Originally the STATE_VDECL handler did some bookkeeping (basically, computing what is now the stream info data) that's a prerequisite for running other state handlers. For this reason a somewhat complicated dance was put in place, with the dependent handlers returning right away until the STATE_VDECL handler could prepare everything up and the STATE_VDECL handler in turn explicitly calling these "downstream" handlers so that they could do their job. With the commit mentioned above the state dirty flags are cleared after the corresponding handlers are executed, which means that the relevant handlers are skipped twice and some stuff is never set up properly.
Stream info is computed by context_apply_draw_state() before going through the state handler table for a long time now, getting rid of this obscure handler interdependency. So let's just get rid of the skipping altogether.
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/state.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 1194604e7dc..264a9974b40 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -278,11 +278,7 @@ static void state_lighting(struct wined3d_context *context, const struct wined3d
/* Lighting is not enabled if transformed vertices are drawn, but lighting * does not affect the stream sources, so it is not grouped for - * performance reasons. This state reads the decoded vertex declaration, - * so if it is dirty don't do anything. The vertex declaration applying - * function calls this function for updating. */ - if (isStateDirty(context, STATE_VDECL)) - return; + * performance reasons. */
if (state->render_states[WINED3D_RS_LIGHTING] && !context->stream_info.position_transformed) @@ -1510,12 +1506,6 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d const struct wined3d_gl_info *gl_info = context_gl->gl_info; GLenum Parm = 0;
- /* Depends on the decoded vertex declaration to read the existence of - * diffuse data. The vertex declaration will call this function if the - * fixed function pipeline is used. */ - if (isStateDirty(&context_gl->c, STATE_VDECL)) - return; - context_gl->untracked_material_count = 0; if ((context_gl->c.stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE)) && state->render_states[WINED3D_RS_COLORVERTEX]) @@ -1656,9 +1646,6 @@ static void state_normalize(struct wined3d_context *context, const struct wined3 { const struct wined3d_gl_info *gl_info = wined3d_context_gl(context)->gl_info;
- if (isStateDirty(context, STATE_VDECL)) - return; - /* Without vertex normals, we set the current normal to 0/0/0 to remove the diffuse factor * from the opengl lighting equation, as d3d does. Normalization of 0/0/0 can lead to a division * by zero and is not properly defined in opengl, so avoid it @@ -3444,10 +3431,9 @@ static void transform_texture(struct wined3d_context *context, const struct wine unsigned int mapped_stage = context_gl->tex_unit_map[tex]; struct wined3d_matrix mat;
- /* Ignore this when a vertex shader is used, or if the streams aren't sorted out yet */ - if (use_vs(state) || isStateDirty(context, STATE_VDECL)) + if (use_vs(state)) { - TRACE("Using a vertex shader, or stream sources not sorted out yet, skipping\n"); + TRACE("Using a vertex shader, skipping.\n"); return; }
@@ -4013,8 +3999,6 @@ static void transform_projection(struct wined3d_context *context, const struct w
static void streamsrc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - if (isStateDirty(context, STATE_VDECL)) - return; wined3d_context_gl_update_stream_sources(wined3d_context_gl(context), state); }