Bug 31983 - [i915 gles2] "if (expression with builtin/varying variables) discard" breaks linkage
[i915 gles2] "if (expression with builtin/varying variables) discard" breaks ...
Status: VERIFIED FIXED
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i915
git
Other Linux (All)
: medium normal
Assigned To: Kenneth Graunke
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-29 23:26 UTC by Shuang He
Modified: 2010-12-05 16:10 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shuang He 2010-11-29 23:26:15 UTC
System Environment:
--------------------------
Libdrm:        (master)2.4.22-16-g51b895041c65f7ec9ecda48e79279dde29258b07
Mesa:        (master)1eb7a81f2e43842acd59929ce65db2142b69134d
Xserver:       
(master)xorg-server-1.9.0-330-g4e0f8f666e61390206c42ad2087477a912525bc7
Xf86_video_intel:       
(master)2.13.901-5-g0bb135c40e5ac1bf7593ec1d68d2815cbf47aa25


Bug detailed description:
-------------------------
This bug hapens on Pineview. The reported error is:
EGL_VERSION = 1.4 (DRI2)
Failed to link:
Couldn't flatten if statement

PIGLIT: {'result': 'fail' }

Following case could be used to reproduce the issue:
[require]
GLES >= 2.0
ESSL >= 1.00

[vertex shader]
attribute vec4 piglit_Position;

void main()
{
        gl_Position = piglit_Position;
}

[fragment shader]
void main()
{
        if (gl_FrontFacing)
                discard;
        else
                gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

[test]
clear color 0.0 1.0 0.0 0.0
clear
draw rect -1 -1 2 2
relative probe rgb (0.03, 0.25) (0.0, 1.0, 0.0)
Comment 1 Kenneth Graunke 2010-12-01 13:38:04 UTC
I believe this should be fixed by the following commit:

commit 940df10100d740ef27fa39026fd51c3199ed3d62
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Thu Nov 25 01:09:26 2010 -0800

    glsl: Add a lowering pass to move discards out of if-statements.
    
    This should allow lower_if_to_cond_assign to work in the presence of
    discards, fixing bug #31690 and likely #31983.
    
    NOTE: This is a candidate for the 7.9 branch.
Comment 2 Shuang He 2010-12-02 21:11:50 UTC
yes, it works for me. though it's reporting:
i915_program_error: Bad source->Index: 12
i915_program_error: Bad source->Index: 12
i915_program_error: Bad source->Index: 12

and FYI, it also fixes 5 OpenGL ES 2.0 conformance tests
Comment 3 Shuang He 2010-12-05 16:09:12 UTC
I'd go ahead to mark this as fixed
Comment 4 Shuang He 2010-12-05 16:10:25 UTC
verified on pineview against:
Libdrm:		(master)2.4.22-19-gaf3d282afbd3360245c2ef2d3552b2530f67481d
Mesa:		(master)09fba30fded4505e2cc5a93fd84cb1a73b7320a7
Xserver:		(master)xorg-server-1.9.0-376-g311cad33155c64ed996418808727fc417168592e
Xf86_video_intel:		(master)2.13.901-9-g55c5f1876e2329a938955967f5d45c814e50beb5
Kernel:	(drm-intel-next) b9e68670cc3a13166b389ce847af19b0d0d33c67