wined3d: Treat zero shininess as no specular lighting in legacy lighting mode.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42572
Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-03-29 13:56:36 +03:00 committed by Alexandre Julliard
parent 26b8581f2f
commit 826b67e395

View file

@ -8998,7 +8998,7 @@ static const char *shader_glsl_ffp_mcs(enum wined3d_material_color_source mcs, c
}
static void shader_glsl_ffp_vertex_lighting_footer(struct wined3d_string_buffer *buffer,
const struct wined3d_ffp_vs_settings *settings, unsigned int idx)
const struct wined3d_ffp_vs_settings *settings, unsigned int idx, BOOL legacy_lighting)
{
shader_addline(buffer, "diffuse += clamp(dot(dir, normal), 0.0, 1.0)"
" * ffp_light[%u].diffuse.xyz * att;\n", idx);
@ -9006,8 +9006,9 @@ static void shader_glsl_ffp_vertex_lighting_footer(struct wined3d_string_buffer
shader_addline(buffer, "t = dot(normal, normalize(dir - normalize(ec_pos.xyz)));\n");
else
shader_addline(buffer, "t = dot(normal, normalize(dir + vec3(0.0, 0.0, -1.0)));\n");
shader_addline(buffer, "if (dot(dir, normal) > 0.0 && t > 0.0) specular +="
" pow(t, ffp_material.shininess) * ffp_light[%u].specular * att;\n", idx);
shader_addline(buffer, "if (dot(dir, normal) > 0.0 && t > 0.0%s) specular +="
" pow(t, ffp_material.shininess) * ffp_light[%u].specular * att;\n",
legacy_lighting ? " && ffp_material.shininess > 0.0" : "", idx);
}
static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer,
@ -9062,7 +9063,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
continue;
}
shader_addline(buffer, "dir = normalize(dir);\n");
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
shader_addline(buffer, "}\n");
}
@ -9103,7 +9104,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
shader_addline(buffer, "}\n");
continue;
}
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
shader_addline(buffer, "}\n");
}
@ -9114,7 +9115,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
continue;
shader_addline(buffer, "att = 1.0;\n");
shader_addline(buffer, "dir = normalize(ffp_light[%u].direction.xyz);\n", idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
}
for (i = 0; i < settings->parallel_point_light_count; ++i, ++idx)
@ -9124,7 +9125,7 @@ static void shader_glsl_ffp_vertex_lighting(struct wined3d_string_buffer *buffer
continue;
shader_addline(buffer, "att = 1.0;\n");
shader_addline(buffer, "dir = normalize(ffp_light[%u].position.xyz);\n", idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx);
shader_glsl_ffp_vertex_lighting_footer(buffer, settings, idx, legacy_lighting);
}
shader_addline(buffer, "ffp_varying_diffuse.xyz = %s.xyz * ambient + %s.xyz * diffuse + %s.xyz;\n",