Bug 34323 - [i915 GLSL gles2] gl_FragCoord.w not correct
Summary: [i915 GLSL gles2] gl_FragCoord.w not correct
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i915 (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Kenneth Graunke
QA Contact:
Depends on:
Reported: 2011-02-15 23:02 UTC by Shuang He
Modified: 2011-11-07 21:34 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

piglit OpenGL GLSL case, this case fail on pineview and pass on ironlake (266 bytes, text/plain)
2011-02-15 23:02 UTC, Shuang He

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-
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:
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);

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:

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.