Problem with in/out variables on AMD hardware

Hi everyone,

I had a problem with in/out variables with my HD 3870 graphics card (Catalyst 9.4). When I first tried, I thought it was the problem with the software I was using. Now I’m using ShaderDesign 1.6 to try my shaders, which is a new version that is compatible with OpenGL 3 (it’s written on their website…).

But I have the same problem, and I wonder if somebody had the same error.

In fact, if I have an “out” variable in the vertex shader, I have to declared it “out” too in the fragment shader. When I try to set it as “in”, which is logicial, I have the following error :

“ERROR : Symbol NameOfTheVariable is defined with 2 different types in vertex and framgnet shaders”.

Here is a simple program that highlight the problem :


// VS
smooth out vec3 Variable;

void main ()
{
   // Use it
}


// FS
smooth in vec3 Variable; // Out compiles, in crashs

void main ()
{
// Use it
}



Are you using glsl version 1.30? I had my program crash with the following:

// VS
#version 130;
out vec3 color; // if changed to `out mediump vec3 color;' it works

void main(void)
{
  // set color
}

// FS
#version 130;
in mediump vec3 color;

void main(void)
{
  // use color
}

The strange thing was… for the fragment shader the compiler message told me to use the precision qualifier (lowp, mediump or highp). But it didn’t complain about the vertex shader. After I added mediump as well to the vertex shader my program worked.

Yep, I was using GLSL 1.30.

I’ll try this mediump trick when I’ll get back home, but it’s quite strange ^^.

Hi !

In fact, we WERE wrong ! I’ve just read that from the spec :

The fragment language has no default precision qualifier for floating point types. Hence for float, floating
point vector and matrix variable declarations, either the declaration must include a precision qualifier or
the default float precision must have been previously declared.

So adding precision highp float; in the fragment shader resolves all the problems ;).

Precision qualifiers seem to be an ES compatibility thing.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.