Unofficial AMD Bugzilla – Bug 330
Strange bug when linking GLSL shaders twice
Last modified: 2012-05-04 00:56:43 CDT
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.
Created attachment 278 [details]
Created attachment 281 [details]
Correct Rendering Result
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.
Created attachment 282 [details]
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.
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.
As I mentioned in the first post I tried the test case in a NVIDIA Quadro 4000 an the issue is not present.
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.
Thanks to you, for such a rapid feedback! :)
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.
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.
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.