Bug 18995 - [i965 gem] glsl/pointcoord fails
Summary: [i965 gem] glsl/pointcoord fails
Status: VERIFIED DUPLICATE of bug 28749
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Ian Romanick
QA Contact: libo
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-10 00:03 UTC by lin, jiewen
Modified: 2014-08-04 04:49 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
log (46.02 KB, application/octet-stream)
2008-12-10 00:03 UTC, lin, jiewen
Details
conf (3.76 KB, text/plain)
2008-12-10 00:04 UTC, lin, jiewen
Details
screenshot (19.63 KB, image/png)
2008-12-10 00:06 UTC, lin, jiewen
Details

Description lin, jiewen 2008-12-10 00:03:10 UTC
Created attachment 20985 [details]
log

System Environment:
--------------------------

--Platform: 965
--Architecture(32-bit,64-bit,compatiblity): 32-bit
--2D driver: (xf86-video-intel-2.6-branch)                                     
6ca0d7e6ff05bff2bb88bfae64c2d79ac115bd38
--3D driver: (intel-2008-q4)154a9e5317f890618932cea0129ef887e16baf84
--DRM:shipped with kernel 2.6.28-rc6 for-airlied
--libdrm: (master)c99566fb810c9d8cae5e9cd39d1772b55e2f514c
--Xserver: (server-1.6-branch)b268458eab2f213ec14dfe8013aa714c187e3aab
--Kernel: 2.6.28-rc6 for-airlied

Bug detailed description:
--------------------------
start X and run pointcoord, the display is not correct. Details could be got in
the
attachment screenshot.

Reproduce steps:
----------------
1. xinit &
2. ./pointcoord
Comment 1 lin, jiewen 2008-12-10 00:04:21 UTC
Created attachment 20986 [details]
conf
Comment 2 lin, jiewen 2008-12-10 00:06:20 UTC
Created attachment 20987 [details]
screenshot

On the pic, the left window is software rendering(normal), and the right
one is direct rendering.
Comment 3 Gordon Jin 2008-12-10 05:19:17 UTC
The case is under mesa/progs/glsl/
Comment 4 lin, jiewen 2009-01-16 00:24:17 UTC
This issue still eixsts with current build.
Comment 5 Eric Anholt 2009-05-06 12:54:14 UTC
Works fine on master and 7.4.
Comment 6 Eric Anholt 2009-05-06 12:55:02 UTC
Gah, wrong tab.
Comment 7 fangxun 2009-09-09 02:43:35 UTC
This issue still eixsts on G45 with following commits:
Libdrm:         (master)121b9648f846d900e67818869974ee82046e9b25
Mesa:           (mesa_7_6_branch)9216b4e7be942fed432ceb42a4337d7298d0bc6c
Xserver:        (server-1.6-branch)3044711412d0a08ba65a491bd2441c0c8980f5e2
Xf86_video_intel:    (master)94fc93d4e2b88565dca17f72903d8991213c9ee8
Kernel:         (master)e07cccf4046978df10f2e13fe2b99b2f9b3a65db

It works well on GM965.


Comment 8 fangxun 2009-09-09 03:00:21 UTC
It failed on GM965 and G45.
Comment 9 Ian Romanick 2009-09-09 20:53:12 UTC
(In reply to comment #7)
> This issue still eixsts on G45 with following commits:
> Libdrm:         (master)121b9648f846d900e67818869974ee82046e9b25
> Mesa:           (mesa_7_6_branch)9216b4e7be942fed432ceb42a4337d7298d0bc6c
> Xserver:        (server-1.6-branch)3044711412d0a08ba65a491bd2441c0c8980f5e2
> Xf86_video_intel:    (master)94fc93d4e2b88565dca17f72903d8991213c9ee8
> Kernel:         (master)e07cccf4046978df10f2e13fe2b99b2f9b3a65db
> 
> It works well on GM965.

(In reply to comment #8)
> It failed on GM965 and G45.
> 

So... does it work on GM965 or not?  These two comments are contradictory.
Comment 10 Ian Romanick 2009-09-09 20:53:58 UTC
(In reply to comment #9)
> (In reply to comment #7)
> > This issue still eixsts on G45 with following commits:
> > Libdrm:         (master)121b9648f846d900e67818869974ee82046e9b25
> > Mesa:           (mesa_7_6_branch)9216b4e7be942fed432ceb42a4337d7298d0bc6c
> > Xserver:        (server-1.6-branch)3044711412d0a08ba65a491bd2441c0c8980f5e2
> > Xf86_video_intel:    (master)94fc93d4e2b88565dca17f72903d8991213c9ee8
> > Kernel:         (master)e07cccf4046978df10f2e13fe2b99b2f9b3a65db
> > 
> > It works well on GM965.
> 
> (In reply to comment #8)
> > It failed on GM965 and G45.
> > 
> 
> So... does it work on GM965 or not?  These two comments are contradictory.

Never mind.  I re-read it and figured out that #8 is a correction of #7.
Comment 11 Ian Romanick 2009-11-23 21:56:15 UTC
I started looking at this today.  The code in the 965 driver is completely wrong.  When point-sprite mode is enabled (via glEnable(GL_POINT_SPRITE)), fragment shaders get an extra input called gl_PointCoord.  This should always be done.  If a particular texture unit has GL_COORD_REPLACE set, this value should be copied to the appropriate gl_TexCoord entry.

This is not what happens.  To be honest, I can't (yet) make heads or tails of what is happening.

In addition:

 * GL_POINT_SPRITE_COORD_ORIGIN is not respected for gl_PointCoord
 * GL_POINT_SPRITE_R_MODE_NV is completely ignored

In the SF we should calculate per-vertex texture coordinates according to the ARB_point_sprite spec for gl_PointCoord:

      s = 1/2 + (x_f + 1/2 - x_w) / size
      t = 1/2 - (y_f + 1/2 - y_w) / size

        or

      s = 1/2 + (x_f + 1/2 - x_w) / size
      t = 1/2 + (y_f + 1/2 - y_w) / size

according to the setting of the point sprite coordinate origin.  size is the point's size, x_f and y_f are the (integral) window coordinates of the fragment, and x_w and y_w are the exact, unrounded window coordinates of the vertex for the point.

This should be passed to the WM.  The "regular" texture coordinates should also be passed to the WM.  In the WM, each coordinate that is replaced (via GL_COORD_REPLACE) should have some combination of values from gl_PointCoord, gl_TexCoord[n], and {0, 0, 0, 1} copied to it.  This allows all the possible point sprite R-mode settings to be supported.
Comment 12 Eric Anholt 2010-08-16 23:43:26 UTC
Marking this as a dupe of the simpler, piglit test for gl_PointCoord.

*** This bug has been marked as a duplicate of bug 28749 ***
Comment 13 bo.b.wang 2011-03-10 17:40:26 UTC
Platform:        Sandybrige
Libdrm:         (master)2.4.24-6-g3b04c73650b5e9bbcb602fdb8cea0b16ad82d0c0
Mesa:           (7.10)3ed9054cc598a38d2cbcadd3f81943635148514c
Xserver:                (master)xorg-server-1.10.0
Xf86_video_intel:               (master)2.14.901-2-g049ce4397ddf7fd088ce364cbb53cacf5133176f
Cairo:          (master)f1d313e042af89b2f5f5d09d3eb1703d0517ecd7
Kernel: (drm-intel-fixes)467cffba85791cdfce38c124d75bd578f4bb8625

This bug is existing in Sandybrige Rev09
Comment 14 Gordon Jin 2012-10-25 06:38:22 UTC
bug 28749 has been fixed. 

Li Bo to verify if this bug gone on SNB.
Comment 15 libo 2012-10-31 01:23:51 UTC
The demo still has render error on SNB but I don't they are the same question. It's duplicate with Bug 46376.


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.