From: Stefan Dösinger stefan@codeweavers.com
WINED3D_MCS_COLOR2 requires specular colour, and does not require diffuse colour.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/utils.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index bac52022510..a4181d8572d 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -6077,6 +6077,16 @@ int wined3d_ffp_frag_program_key_compare(const void *key, const struct wine_rb_e return memcmp(ka, kb, sizeof(*ka)); }
+static enum wined3d_material_color_source validate_material_colour_source(WORD use_map, + enum wined3d_material_color_source source) +{ + if (source == WINED3D_MCS_COLOR1 && use_map & (1u << WINED3D_FFP_DIFFUSE)) + return source; + if (source == WINED3D_MCS_COLOR2 && use_map & (1u << WINED3D_FFP_SPECULAR)) + return source; + return WINED3D_MCS_MATERIAL; +} + void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, const struct wined3d_state *state, struct wined3d_ffp_vs_settings *settings) { @@ -6141,12 +6151,16 @@ void wined3d_ffp_get_vs_settings(const struct wined3d_context *context, settings->point_size = state->gl_primitive_type == GL_POINTS; settings->per_vertex_point_size = !!(si->use_map & 1u << WINED3D_FFP_PSIZE);
- if (state->render_states[WINED3D_RS_COLORVERTEX] && (si->use_map & (1u << WINED3D_FFP_DIFFUSE))) + if (state->render_states[WINED3D_RS_COLORVERTEX]) { - settings->diffuse_source = state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE]; - settings->emissive_source = state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE]; - settings->ambient_source = state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE]; - settings->specular_source = state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]; + settings->diffuse_source = validate_material_colour_source(si->use_map, + state->render_states[WINED3D_RS_DIFFUSEMATERIALSOURCE]); + settings->emissive_source = validate_material_colour_source(si->use_map, + state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE]); + settings->ambient_source = validate_material_colour_source(si->use_map, + state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE]); + settings->specular_source = validate_material_colour_source(si->use_map, + state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE]); } else {