Bug 93560

Summary: opt_combine_constants failing fabsf(reg->f) == table.imm[i].val assertion
Product: Mesa Reporter: Kenneth Graunke <kenneth>
Component: Drivers/DRI/i965Assignee: Matt Turner <mattst88>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Kenneth Graunke 2016-01-02 12:54:23 UTC
$ shader_runner shaders/closed/UnrealEngine4/PlatformerGame/232.shader_test -auto

shader_runner: brw_fs_combine_constants.cpp:302: bool fs_visitor::opt_combine_constants(): Assertion `fabsf(reg->f) == table.imm[i].val' failed.

It looks like the value is some kind of NaN:

(gdb) p reg->f
$1 = -nan(0x400000)
(gdb) p table.imm[i].val
$2 = nan(0x400000)
Comment 1 Matt Turner 2016-01-11 17:33:11 UTC
I don't know what to say. The shader contains

   vec3((0.0/0.0),(0.0/0.0),(0.0/0.0))

We can change the assert to

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

but I can't believe this is what they intended to do -- it's used directly in the expression that calculates the color output.
Comment 2 Kenneth Graunke 2016-01-11 19:24:06 UTC
Yeah, I can't imagine that's what they want to do either.  That change sounds good, though.
Comment 3 Matt Turner 2016-01-13 18:39:22 UTC
Fixed by:

    i965/fs: Skip assertion on NaN.
    
    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.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.