vkd3d-shader/hlsl: Do not allow NaNs in SM1.

Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Giovanni Mascellani 2022-04-27 10:56:20 +02:00 committed by Alexandre Julliard
parent eb2c3b0b90
commit 4d181bc622

View File

@ -278,10 +278,10 @@ static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
"Floating point division by zero."); "Floating point division by zero.");
} }
dst->value[k].f = src1->value[k].f / src2->value[k].f; dst->value[k].f = src1->value[k].f / src2->value[k].f;
if (ctx->profile->major_version < 4 && isinf(dst->value[k].f)) if (ctx->profile->major_version < 4 && !isfinite(dst->value[k].f))
{ {
hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO, hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
"Infinities are not allowed by the shader model."); "Infinities and NaNs are not allowed by the shader model.");
} }
break; break;