Commit e106bbdd authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Don't skip FFP vertex pipeline state handlers when STATE_VDECL is dirty.

This fixes the non-default ARB shader backend, broken since 2ddb6b66, 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: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 92ad4a18
...@@ -278,11 +278,7 @@ static void state_lighting(struct wined3d_context *context, const struct wined3d ...@@ -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 /* Lighting is not enabled if transformed vertices are drawn, but lighting
* does not affect the stream sources, so it is not grouped for * does not affect the stream sources, so it is not grouped for
* performance reasons. This state reads the decoded vertex declaration, * performance reasons. */
* 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;
if (state->render_states[WINED3D_RS_LIGHTING] if (state->render_states[WINED3D_RS_LIGHTING]
&& !context->stream_info.position_transformed) && !context->stream_info.position_transformed)
...@@ -1510,12 +1506,6 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d ...@@ -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; const struct wined3d_gl_info *gl_info = context_gl->gl_info;
GLenum Parm = 0; 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; context_gl->untracked_material_count = 0;
if ((context_gl->c.stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE)) if ((context_gl->c.stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE))
&& state->render_states[WINED3D_RS_COLORVERTEX]) && state->render_states[WINED3D_RS_COLORVERTEX])
...@@ -1656,9 +1646,6 @@ static void state_normalize(struct wined3d_context *context, const struct wined3 ...@@ -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; 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 /* 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 * 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 * 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 ...@@ -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]; unsigned int mapped_stage = context_gl->tex_unit_map[tex];
struct wined3d_matrix mat; 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))
if (use_vs(state) || isStateDirty(context, STATE_VDECL))
{ {
TRACE("Using a vertex shader, or stream sources not sorted out yet, skipping\n"); TRACE("Using a vertex shader, skipping.\n");
return; return;
} }
...@@ -4013,8 +3999,6 @@ static void transform_projection(struct wined3d_context *context, const struct w ...@@ -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) 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); wined3d_context_gl_update_stream_sources(wined3d_context_gl(context), state);
} }
......
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