gl_Color bug in the ATI CATALYST 5.7

Hi,

Here I report a bug that I found in the ATI CATALYST 5.7 driver.

// vertex shader
varying VertexColor;
void main(void)
{
	VertexColor = gl_Color;
	gl_Position = ftransform();
}

// fragment shader
varying VertexColor;
void main(void)
{
	gl_FragColor = VertexColor;
}

In this case, no problem occurs.
However, in the following case, the gl_FragColor does not be assigned correctly from the gl_Color.

// vertex shader
void main(void)
{
	gl_Position = ftransform();
}

// fragment shader
void main(void)
{
	gl_FragColor = gl_Color;
}

I’m sorry if I were just rushing to the conclusion but I verified many times.
So if an ATI driver engineer is reading this post, please fix it in the next driver release. :slight_smile:

This is not a driver bug.

This is your shader bug, but I can understand why this is confusing.

In the vertex shader there are the built-in variables:

attribute vec4 gl_Color;
varying vec4 gl_FrontColor;
varying vec4 gl_BackColor;

In the fragment shader there is the built-in variable:

varying vec4 gl_Color;

The attribute gl_Color is ONLY available to the vertex shader, not the fragment shader.

The varying gl_Color is ONLY available to the fragment shader, not the vertex shader.

“The values in (the varying) gl_Color… will be derived automatically by the system from
gl_FrontColor, gl_BackColor… based on which face is visible.”

In your vertex shader, you must write gl_FrontColor or gl_BackColor, like this:

// vertex shader
void main(void)
{
	gl_FrontColor = gl_Color;
	gl_Position = ftransform();
}

-mr. bill

Oops!

Thank you for such a nice information, mrbill. Now I understood.

And I’m sorry that I showed my ignorance here.
(But hey, how misleading the GLSL specification is…)

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