Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=42572 Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/wined3d/glsl_shader.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index d9e0bda9ea..9434d9007c 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -9145,7 +9145,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); @@ -9153,8 +9153,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, @@ -9209,7 +9210,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"); }
@@ -9250,7 +9251,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"); }
@@ -9261,7 +9262,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) @@ -9271,7 +9272,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",