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

Matt Turner mattst88 at gmail.com
Tue Jan 12 11:53:45 PST 2016


On Tue, Jan 12, 2016 at 1:41 AM, Iago Toral <itoral at igalia.com> wrote:
> 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)

Yes, I'll make that change. Thanks.

With that, can I assume a Reviewed-by?


More information about the mesa-dev mailing list