mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Do not generate infinities in SM1.
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6b893b597b
commit
c680b674d6
@ -18,6 +18,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "hlsl.h"
|
#include "hlsl.h"
|
||||||
|
|
||||||
static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, struct hlsl_ir_constant *src)
|
static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst, struct hlsl_ir_constant *src)
|
||||||
@ -270,12 +272,17 @@ static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_ir_constant *dst,
|
|||||||
{
|
{
|
||||||
case HLSL_TYPE_FLOAT:
|
case HLSL_TYPE_FLOAT:
|
||||||
case HLSL_TYPE_HALF:
|
case HLSL_TYPE_HALF:
|
||||||
if (src2->value[k].f == 0)
|
if (ctx->profile->major_version >= 4 && src2->value[k].f == 0)
|
||||||
{
|
{
|
||||||
hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO,
|
hlsl_warning(ctx, &dst->node.loc, VKD3D_SHADER_WARNING_HLSL_DIVISION_BY_ZERO,
|
||||||
"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))
|
||||||
|
{
|
||||||
|
hlsl_error(ctx, &dst->node.loc, VKD3D_SHADER_ERROR_HLSL_DIVISION_BY_ZERO,
|
||||||
|
"Infinities are not allowed by the shader model.");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HLSL_TYPE_DOUBLE:
|
case HLSL_TYPE_DOUBLE:
|
||||||
|
@ -25,6 +25,7 @@ todo draw quad
|
|||||||
probe all rgba (5.0, 5.0, -5.0, 3.0)
|
probe all rgba (5.0, 5.0, -5.0, 3.0)
|
||||||
|
|
||||||
[require]
|
[require]
|
||||||
|
% Infinities are not allowed in SM1
|
||||||
shader model >= 4.0
|
shader model >= 4.0
|
||||||
|
|
||||||
[pixel shader]
|
[pixel shader]
|
||||||
|
Loading…
Reference in New Issue
Block a user