wined3d: Fix WINED3D_MCS_COLOR2 handling in wined3d_ffp_get_vs_settings().

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>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2018-08-05 02:47:53 +04:30 committed by Alexandre Julliard
parent 2470b0e447
commit 46d5d9a6d3
1 changed files with 19 additions and 5 deletions

View File

@ -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
{