[Mesa-dev] [PATCH 2/2] i965/fs: Skip assertion on NaN.

Iago Toral itoral at igalia.com
Tue Jan 12 01:41:26 PST 2016


On Mon, 2016-01-11 at 09:36 -0800, Matt Turner wrote:
> A shader in Unreal4 uses the result of divide by zero in its color
> output, producing NaN and triggering this assertion since NaN is not
> equal to itself.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93560
> ---
>  src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
> index 9141907..95d4504 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp
> @@ -300,7 +300,7 @@ fs_visitor::opt_combine_constants()
>           reg->subreg_offset = table.imm[i].subreg_offset;
>           reg->stride = 0;
>           reg->negate = signbit(reg->f) != signbit(table.imm[i].val);
> -         assert(fabsf(reg->f) == table.imm[i].val);
> +         assert(isnan(reg->f) || fabsf(reg->f) == table.imm[i].val);

Shouldn't this be:

(isnan(reg->f) && isnan(table.imm[i].val)) ||
fabsf(reg->f) == table.imm[i].val)

Iago

>        }
>     }
>  




More information about the mesa-dev mailing list