Bug 330 - Strange bug when linking GLSL shaders twice
Summary: Strange bug when linking GLSL shaders twice
Alias: None
Product: AMD Catalyst™Proprietary Display Driver
Classification: Unclassified
Component: OpenGL Driver (show other bugs)
Version: .archived
Hardware: Other All
: low minor
Assignee: nobody
Depends on:
Reported: 2011-11-16 06:55 CST by elvezzaro
Modified: 2012-05-04 00:56 CDT (History)
1 user (show)

Test case (6.72 KB, application/zip)
2011-11-16 06:56 CST, elvezzaro
Correct Rendering Result (13.56 KB, image/png)
2011-11-18 01:25 CST, REX XU
System info (223.84 KB, text/plain)
2011-11-18 02:49 CST, elvezzaro

Note You need to log in before you can comment on or make changes to this bug.
Description elvezzaro 2011-11-16 06:55:15 CST
What I'm going to describe is a very strange bug, that took me a day to find out in our software.

What we are doing is putting all the shader code in a single file, and using preprocessor definitions to compile only parts of the shader (e.g. #define VERTEX_SHADER is pre-pendended to the shader code to compile only the vertex shader part of the file).

This worked well until I wanted to add geometry shader support. Since those are an optional part of the pipeline and since a different geometry shader is needed for different primitives, I couldn't afford to modify all the existing shader files to add pass-through geometry shader code.

So what I did is try to first link the shader programs by including the geometry shader, even if it has no main(). Then if the link fails, I detach the geometry shader from the program object and link again.

To my dismay, shaders that worked before, suddenly stopped working when using this approach.

I was able to reproduce the issue in a simple program. On my machine (ATI Firepro V7800), I only see a blue background. With an NVIDIA Quadro it works just fine.

You can find the program here (if a page shows up instead, click the first link on the page): http://lvezzaro.altervista.org/GeomAti.zip

Either avoiding to attach the empty geometry shader (by commenting line 150 in flat.cpp) to the program or changing the line:

float c = 1.0;


const float c = 1.0;

in the shader code will also display the white triangle, in addition to the background.

To build the code on Windows, you'll need Visual Studio 2008 or later (external libraries are included).
To build on Linux you'll need Scons and development libraries of SDL and glew.

I encountered this problem in both Linux and Windows, I'm using the latest driver.

Please let me know if you are able to reproduce it, and hopefully fix this.
Comment 1 elvezzaro 2011-11-16 06:56:10 CST
Created attachment 278 [details]
Test case
Comment 2 REX XU 2011-11-18 01:25:43 CST
Created attachment 281 [details]
Correct Rendering Result
Comment 3 REX XU 2011-11-18 01:31:33 CST

We have tried to reproduce this issue following the steps you provided. The result is attached (See "Correct Rendering Result"). It seems no problem appear. We use V4800 GL card and the environment is catalyst 11.10 driver on Win7 32 system.

As you have said that you use V7800 GL card, could you also give us the link that you have downloaded the wanted driver? Also, tell us which OS platform you are using? Thus, we could do the trials on the same environment and compare the results. 

Thank you.
Comment 4 elvezzaro 2011-11-18 02:49:16 CST
Created attachment 282 [details]
System info
Comment 5 elvezzaro 2011-11-18 02:55:34 CST
As I said, I encounter issues in both Linux and Windows. 
I have provided the Linux info as an attachment.
For Windows, I'm running Windows 7, 64bit.

On Linux, this is the driver I'm using: http://support.amd.com/us/gpudownload/fire/Pages/fire_linux.aspx

On Windows this is the one: http://support.amd.com/us/gpudownload/fire/Pages/fire_win7-64.aspx

As I said, I'm at the latest versions.
Comment 6 REX XU 2011-11-18 03:20:53 CST

Thank you for this feedback. Since V7800 GL is not available during this period of time, once you check the results on windows 7 64 system, could you help to check it with other types of cards if it is convenient for you. According to our analysis, the issue seems to be ASIC-independent.
Comment 7 elvezzaro 2011-11-18 03:38:14 CST
As I mentioned in the first post I tried the test case in a NVIDIA Quadro 4000 an the issue is not present.
Comment 8 REX XU 2011-11-18 04:48:38 CST

We have reproduced this issue on Windows 7 x64 system with the driver you have specified. We will start to investigate the root cause and give you update after that. Thank you.
Comment 9 elvezzaro 2011-11-18 04:51:25 CST
Thanks to you, for such a rapid feedback! :)
Comment 10 REX XU 2011-11-22 02:00:33 CST

Sorry for the delayed response. We have already investigated the issue. The problem has been fixed. However, you might have to wait for some time to get the newer version. When you download the driver, version number with prefix 8.90 will include the solution to this issue.

Thank you.
Comment 11 Michael Cronenworth 2012-04-25 18:20:13 CDT
This message is a reminder that your bug is marked as Catalyst 11.10.

The current Catalyst version is 12.4.

Approximately 7 days from now the Bugzilla administrator will be removing the
11.10 version. At that time your bug will be CLOSED as WONTFIX.

Bug Reporter: Thank you for reporting this issue. However, the Bugzilla
administrator provides this as a unofficial, free service to AMD customers, and
I like to keep my systems neat and tidy. If you would like to keep your bug
from being closed, please try a new Catalyst version and update the 'version'
field if the issue still occurs.

If you are unable to update the version, please make a comment and someone will
change it for you.
Comment 12 Michael Cronenworth 2012-05-04 00:55:24 CDT
This bug is being closed due to the 'version' being 11.10 after 7 days of the
previous closure notice.

Thank you for your bug report.