From ef82681d59ec264b981bb3653ea774044f02fa9c Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 1 Feb 2010 13:52:57 +0100 Subject: [PATCH] wined3d: Handle a zero source value for WINED3DSIH_RCP. --- dlls/wined3d/glsl_shader.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index fd359b52a84..ba16cae7b1c 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2229,10 +2229,15 @@ static void shader_glsl_rcp(const struct wined3d_shader_instruction *ins) mask_size = shader_glsl_get_write_mask_size(write_mask); shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_3, &src_param); - if (mask_size > 1) { - shader_addline(ins->ctx->buffer, "vec%d(1.0 / %s));\n", mask_size, src_param.param_str); - } else { - shader_addline(ins->ctx->buffer, "1.0 / %s);\n", src_param.param_str); + if (mask_size > 1) + { + shader_addline(ins->ctx->buffer, "vec%d(%s == 0.0 ? FLT_MAX : 1.0 / %s));\n", + mask_size, src_param.param_str, src_param.param_str); + } + else + { + shader_addline(ins->ctx->buffer, "%s == 0.0 ? FLT_MAX : 1.0 / %s);\n", + src_param.param_str, src_param.param_str); } } -- 2.11.4.GIT