wined3d: Handle a zero source value for WINED3DSIH_LOG.

This commit is contained in:
Henri Verbeet 2010-02-01 13:52:56 +01:00 committed by Alexandre Julliard
parent bef792f5ff
commit 4a8f93bade
1 changed files with 9 additions and 4 deletions

View File

@ -2105,10 +2105,15 @@ static void shader_glsl_log(const struct wined3d_shader_instruction *ins)
shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param);
if (dst_size > 1) {
shader_addline(buffer, "vec%d(log2(abs(%s))));\n", dst_size, src0_param.param_str);
} else {
shader_addline(buffer, "log2(abs(%s)));\n", src0_param.param_str);
if (dst_size > 1)
{
shader_addline(buffer, "vec%d(%s == 0.0 ? -FLT_MAX : log2(abs(%s))));\n",
dst_size, src0_param.param_str, src0_param.param_str);
}
else
{
shader_addline(buffer, "%s == 0.0 ? -FLT_MAX : log2(abs(%s)));\n",
src0_param.param_str, src0_param.param_str);
}
}