3 Replies Latest reply on Oct 12, 2011 3:30 AM by JVertrees

    Strange behavior from shaders

    JVertrees
      When rendering on ATI w/Linux we get strange behavior from the shaders

      Greetings,

      We're using GLSL 1.20 across multiple platforms. Currently we have strange behavior on Linux (OpenSuse 11.4) with an ATI FirePro v8800 using the ATI drivers (v8.892: fglrx64_xpic_SUSE114-8.892-1.x86_64).

      Some variables are being wiped out in the fragment shader and our objects are  not rendering correctly. Oddly, if we write:

      // sphere.fs code here...

      gl_FragColor = color;

      vec4 final_color = gl_LightModel.ambient * color;

      // more sphere.fs code here...

      we get the solidly colored objects, which is ok in this part of the shader; however if we swap the two lines:

       

       

      // code here...

      vec4 final_color = gl_LightModel.ambient * color;

       

      gl_FragColor = color;

      // code here...

      nothing shows up--the color varible has lost its data. As you can see "color" is never on the left hand side, but is somehow being modified.
      Another strange thing we see is in the vertex shader. We try to set a varying ("color") from an attribute ("a_Color"). If I put the following at the _top_ of main:
      color = a_Color;
      then the (varying) color is not set from the (attribute) a_Color and (varying) color is blank in the fragment shader. But, if I move
      color = a_Color;
      to the bottom of the vertex shader, we do get small points that appear, indicating that there's a difference between where we put these statemets. Nowhere else in the shaders are 'color' and 'a_Color' ever on the left hand side of a statement.
      The info logs for compiling and linking all return successfully:

      * Vertex shader was successfully compiled to run on hardware.

      * Fragment shader was successfully compiled to run on hardware.

      * Vertex shader(s) linked, fragment shader(s) linked.

      AMD's GPU Analyzer created assembly for both shaders, so they compiled and linked fine.

      GL Info:

       

       Detected GLSL version 4.10.

       OpenGL graphics engine:

        GL_VENDOR: ATI Technologies Inc.

        GL_RENDERER: ATI FirePro V8800 (FireGL) Graphics Adapter

        GL_VERSION: 4.1.11079 Compatibility Profile Context FireGL

       

      Our release cannot go forward until we fix these issues. We appreciate any help we can get.

      Cheers,

      -- Jason