Bug 34323

Summary: [i915 GLSL gles2] gl_FragCoord.w not correct
Product: Mesa Reporter: Shuang He <shuang.he>
Component: Drivers/DRI/i915Assignee: Kenneth Graunke <kenneth>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: piglit OpenGL GLSL case, this case fail on pineview and pass on ironlake

Description Shuang He 2011-02-15 23:02:06 UTC
Created attachment 43418 [details]
piglit OpenGL GLSL case, this case fail on pineview and pass on ironlake

System Environment:
--------------------------
Libdrm:         (master)2.4.23-6-g550fe2ca3b29ad2191eab4fdfbed9ed21e25492d
Mesa:           (master)6ed0f2ac112d22278cf051c2cee9c2199a9025ea
Xserver:                (master)xorg-server-1.9.99.901-197-gea1ffd3e60bdcedbec5a6f28929f8677bf45d450
Xf86_video_intel:               (master)2.14.0-25-g9184af921bc2f332fcb6c9b47001414378eab8e2


Bug detailed description:
-------------------------
This bug hapens on Pineview. 
This issue happens to both OpenGL GLSL and OpenGL ES 2.0 GLSL

According to OpenGL ES specificaton, section 3.8.2:
"The built-in variable gl_FragCoord holds the window coordinates x, y, z, and 1/w for the fragment. The z component of gl_FragCoord undergoes an implied conversion to floating-point. This conversion must leave the values 0 and 1 invariant. Note that this z component already has a polygon offset added in, if enabled (see section 3.5.2. The 1/w value is computed from the wc coordinate (see section 2.12)."

Following OpenGL GLSL case could be used to reproduce the issue:
[require]
GLSL >= 1.10

[vertex shader]
void main()
{
        gl_Position = gl_Vertex;
        gl_Position.w = 2.0;
}

[fragment shader]
void main()
{
        gl_FragColor = vec4(1.0, gl_FragCoord.w, 1.0, 0.0);
}

[test]
draw rect -1 -1 2 2
relative probe rgb (0.5, 0.5) (1.0, 0.5, 1.0)
Comment 1 Eric Anholt 2011-07-18 11:44:29 UTC
commit fceda4342cadc22ce86877a19bf82b86eb022d79
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Jul 13 10:56:37 2011 -0700

    i915: Include gl_FragCoord.w data, not just xyz.
    
    Fixes piglit fragcoord_w test.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34323
Comment 2 Shuang He 2011-11-07 21:34:23 UTC
Since related OpenGL ES 2.0 conformance case passed on both ironlake and pineview, I will mark this bug as verified against mesa:
(7.11)436db5df9c193b4849afd37ce7e1697274ca25d8
(master)4abba27ae06b21111adfa1c0446b38d57b61e947

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.