[PATCH 2/8] wined3d: Avoid potential division by 0 when computing fog scale.
Matteo Bruni
mbruni at codeweavers.com
Tue Jun 16 15:45:38 CDT 2015
FPU exceptions are usually masked in D3D and fog start and end don't
normally match but apparently there are some real cases where the
planets align.
---
dlls/wined3d/glsl_shader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 37a8f87..109184d 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1250,7 +1250,7 @@ static void shader_glsl_load_fog_uniform(const struct wined3d_context *context,
tmpvalue.d = state->render_states[WINED3D_RS_FOGDENSITY];
GL_EXTCALL(glUniform1f(prog->ps.fog_density_location, tmpvalue.f));
get_fog_start_end(context, state, &start, &end);
- scale = 1.0f / (end - start);
+ scale = end == start ? INFINITY : 1.0f / (end - start);
GL_EXTCALL(glUniform1f(prog->ps.fog_end_location, end));
GL_EXTCALL(glUniform1f(prog->ps.fog_scale_location, scale));
checkGLcall("fog emulation uniforms");
--
2.3.6
More information about the wine-patches
mailing list