Bug 31827 - r300g fails to link a GL program (Mesa 7.9)
Summary: r300g fails to link a GL program (Mesa 7.9)
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Gallium/r300 (show other bugs)
Version: 7.9
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-21 15:36 UTC by Hicham HAOUARI
Modified: 2010-12-15 17:34 UTC (History)
0 users

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 Hicham HAOUARI 2010-11-21 15:36:13 UTC
I have made a simple test case :

http://hicham.fedorapeople.org/lightspark/ls-testcase.tar.bz2
Comment 1 Marek Olšák 2010-11-21 15:51:41 UTC
I can't reproduce this. Your test case prints "program linking succeeded".
Comment 2 Marek Olšák 2010-11-21 15:55:36 UTC
Now I see you're using 7.9. This issue has apparently been fixed in master. I guess the fix will find its way to the next 7.9.x version. Could you possibly bisect which commit fixed it in master?
Comment 3 Da Fox 2010-11-22 13:48:06 UTC
I can confirm this testcase fails to link with current mesa-git (51b895041c65f7ec9ecda48e79279dde29258b07), on radeon mobility 9600 m10 (rv350) and 2.6.36.
Comment 4 Marek Olšák 2010-11-22 15:02:39 UTC
I don't have 51b895041c65f7ec9ecda48e79279dde29258b07 in my Mesa tree, which means it doesn't exist. Don't you have some patches applied locally?
Comment 5 Da Fox 2010-11-23 00:54:49 UTC
(In reply to comment #4)
> I don't have 51b895041c65f7ec9ecda48e79279dde29258b07 in my Mesa tree, which
> means it doesn't exist. Don't you have some patches applied locally?

You are correct. I must have copy&pasted the wrong line...
Gitk shows "e7c74a7dfab789496761226fe62a08f2d9fea5c7 - st/mesa: set MaxUniformComponents" for mesa.

51b895041c65f7ec9ecda48e79279dde29258b07 appears to be from libdrm.

Sorry for the mixup.
Comment 6 Hydrar 2010-11-23 11:53:46 UTC
Just updated both my computers to latest git today, the test case prints "program linking succeeded" on my RV530(X1600), but fails on my RV410(Mobility X700), with same git versions of libdrm, mesa and xf86-video-ati.
Comment 7 Marek Olšák 2010-11-23 13:01:54 UTC
Please query GL_LINK_STATUS and post what it says.
Comment 8 Hicham HAOUARI 2010-11-23 13:07:20 UTC
(In reply to comment #7)
> Please query GL_LINK_STATUS and post what it says.

I think that is what I have done in the testcase, or am I missing something ?

Anyway, I retested with Fedora rawhide, which ships mesa-7.10 snapshot from 20101118 and I still get the same failure.

kernel : 2.6.36

libdrm : 2.4.23 branch git snapshot from 20101123
Comment 9 Marek Olšák 2010-11-24 10:18:18 UTC
Ah sorry about that. I meant this:

Could you please post what glGetProgramInfoLog returns? It should give us a clue. Thank you.
Comment 10 Hicham HAOUARI 2010-11-24 10:28:38 UTC
(In reply to comment #9)
> Ah sorry about that. I meant this:
> 
> Could you please post what glGetProgramInfoLog returns? It should give us a
> clue. Thank you.

it gives : Couldn't flatten if statement
Comment 11 Marek Olšák 2010-11-24 10:37:36 UTC
The if statement in the fragment shader is too complex. Could you possibly move the texture lookup in front of it and see if it helps?
Comment 12 Hicham HAOUARI 2010-11-24 11:05:53 UTC
(In reply to comment #11)
> The if statement in the fragment shader is too complex. Could you possibly move
> the texture lookup in front of it and see if it helps?

modifying :
******************************************************************************
if(gl_Color.x==1.0 && texture2D(g_tex2,gl_TexCoord[1].xy).a==0.0)
		discard;
******************************************************************************

to :
******************************************************************************
bool res = ( gl_Color.x==1.0 && texture2D(g_tex2,gl_TexCoord[1].xy).a==0.0 );
if(res)  discard;
******************************************************************************

gives the same error message
Comment 13 Hicham HAOUARI 2010-11-24 11:51:54 UTC
doing that :

***********************
if(false) discard;
***********************

makes the linking succeed
Comment 14 Hicham HAOUARI 2010-11-24 11:52:30 UTC
of course :

******************************************************
vec4 tex = texture2D(g_tex2,gl_TexCoord[1].xy);
	if(gl_Color.x==1.0 && tex.a==0.0)
		discard;
******************************************************

fails too
Comment 15 Marek Olšák 2010-11-24 11:55:32 UTC
I am working on a fix.
Comment 16 Marek Olšák 2010-11-24 14:29:35 UTC
The fix has been sent to ML:
http://lists.freedesktop.org/archives/mesa-dev/2010-November/004214.html
Comment 17 Marek Olšák 2010-12-01 13:00:13 UTC
Fixed in Mesa master. The fix will eventually make its way to 7.9. Closing..
Comment 18 Hicham HAOUARI 2010-12-03 13:37:10 UTC
(In reply to comment #17)
> Fixed in Mesa master. The fix will eventually make its way to 7.9. Closing..

What commit fixed this bug ?
Comment 20 Hicham HAOUARI 2010-12-15 17:34:41 UTC
Here is an attempt to backport the fixes to 7.9 :

http://hicham.fedorapeople.org/lightspark/0001-Backport-fdbz-31827-fix-to-7.9.patch

It applies against latest mesa-7.9.

I tested it locally, and the testcase succeeds.


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.