driver bug?

OK, here is the vertex shader code that doesn’t works right:

varying vec2 SomeVar;

void main{
vec4 SomeOtherVar;

SomeVar.y = 0.5*acos(SomeOtherVar.y);

}

It starts working if I use:

SomeVar.y = acos(SomeOtherVar.y);
SomeVar.y *= 0.5;

And this is the ONLY change in the code. The results should be the same, but only the two-line version works. Any ideas? Could be some hw limitation I don’t know about? The card is ATI Radeon 9600 or 9800.

I had a similar problem with GF6600, so I don’t think its a hardware limitation.
AFAIK GPUs can multiply the result of an operation by 1/4, 1/2, 2, 4 and 8 without the need for an extra instruction, but compilers seem to become confused easily when they try to make use of this feature, so it could be a compiler bug.

This appears to be a bug with the shader optimizer. I’ll file a bug report.

Originally posted by tomtrenki:
I had a similar problem with GF6600, so I don’t think its a hardware limitation.
AFAIK GPUs can multiply the result of an operation by 1/4, 1/2, 2, 4 and 8 without the need for an extra instruction, but compilers seem to become confused easily when they try to make use of this feature, so it could be a compiler bug.

Actually here 0.5 fixed it. It didn’t matter that it was 0.5 in particular. The problem appears to be that the results were never written to the output register.

Originally posted by tomtrenki:
I had a similar problem with GF6600, so I don’t think its a hardware limitation.
AFAIK GPUs can multiply the result of an operation by 1/4, 1/2, 2, 4 and 8 without the need for an extra instruction, but compilers seem to become confused easily when they try to make use of this feature, so it could be a compiler bug.

The interesting part is that the code before the problematic line reads something like that:

const float PI = 3.14…
vec4 AnotherVar;

SomeVar.x = (atan(AnotherVar.x,AnotherVar.z) + PI)/(2.0*PI);

And it works fine!!! A similar approach with acos (e.g. (acos(x)+0.0)/2.0) doesn’t work.

In my limited testing it appears this bug only affects the acos() and asin() functions.

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