PDA

View Full Version : driver bug?



dobradusa
11-07-2006, 09:36 AM
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.

tomtrenki
11-07-2006, 12:39 PM
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.

Humus
11-07-2006, 12:52 PM
This appears to be a bug with the shader optimizer. I'll file a bug report.

Humus
11-07-2006, 01:10 PM
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.

dobradusa
11-07-2006, 09:24 PM
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.

Humus
11-08-2006, 12:42 PM
In my limited testing it appears this bug only affects the acos() and asin() functions.