4 Replies Latest reply on Dec 19, 2011 12:03 PM by fweiler

    [BUG REPORT] GLSL Shader link error

    florianlink

      Hi,

      I experienced link errors in our GLSL VolumeRenderer, the fragment and vertex shader compile successfully and the linking then fails with the error:

      unexpected error.
      unexpected error.

      (On an AMD Radeon HD 6900M Series
      OpenGL version string: 4.1.10767 Compatibility Profile Context, but also on older FireGL cards with OpenGL 2.1)

      I boiled it down to the attached shaders, which fail to link on ATI, but work fine on NVidia. The problem seems to be passing a uniform of struct type where the struct contains a sampler. Passing it through one function call works, but passing it through nested function calls fails.

      If you comment the sampler in the example shader it links fine, and if only someCall2 is called from main() it also links, so the problem really seems to pass the sampler inside the struct through nested functions.

      Fragment Shader:

      struct VolumeInfo {
         sampler3D volumeDataTexture;
         vec4 data;
      };

      uniform VolumeInfo primaryVolumeInfo;

      vec4 someCall2(in VolumeInfo info) {
         return vec4(info.data);
      }

      vec4 someCall(in VolumeInfo info) {
         return someCall2(info);
      }

      void main() {
         gl_FragColor = someCall(primaryVolumeInfo);
      }

      Vertex Shader:

      void main() {
        gl_Position = ftransform();
      }

       

      Can you please fix this in the driver or give me an idea of a workaround?

      (passing the sampler as a single extra argument is not really an option for our VolumeRenderer, since the struct will contain various samplers, depending on the render mode, and it not an option to pass all those as extra arguments)

      regards,
      Florian Link