i965/fs: Skip assertion on NaN.
authorMatt Turner <mattst88@gmail.com>
Mon, 11 Jan 2016 17:34:50 +0000 (09:34 -0800)
committerMatt Turner <mattst88@gmail.com>
Wed, 13 Jan 2016 18:32:53 +0000 (10:32 -0800)
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
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_fs_combine_constants.cpp

index 9141907..994c699 100644 (file)
@@ -300,7 +300,8 @@ 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) && isnan(table.imm[i].val)) ||
+                fabsf(reg->f) == table.imm[i].val);
       }
    }