Asgard
09-01-2002, 11:41 PM
I'm using a GeForce2 GTS Pro and the 30.82 drivers, and I have the following problem with the exp instruction of NV_vertex_program:
I have the following vertex program with c[0] = {-1.8, -1.2, 0.0, 0.0}:
exp R0.y, c[0].x;
mov o[COL0].x, R0.y;
exp o[COL0].y, c[0].y;
So what this basically does is calculate the fraction of c[0].x and c[0].y and put it in o[COL0].
As expected, this yields a greenish color, since exp calculates src-floor(src) in .y, which is -1.8-(-2) = 0.2 for -1.8 and -1.2-(-2) = 0.8 for -1.2.
Now, if I change the program to this:
c[0] = {1.8, 1.2, 0.0, 0.0}:
exp R0.y, -c[0].x;
mov o[COL0].x, R0.y;
exp o[COL0].y, -c[0].y;
I get a red color, just as if I didn't specify the - in front of the c[0] every time. Why is this? Shouldn't it be the exact same result as above (that is, green)?
I tried the same vertex program in DirectX 8.1 using similar code to the one above and also the frc macro instruction, and DirectX gives results as expected (even though it explicitly says in the docs that passing in a negative value to exp produces undefined results, but still the .y component of the result is apparently calculated correctly).
Anyone have any ideas?
Regards.
[This message has been edited by Asgard (edited 09-02-2002).]
I have the following vertex program with c[0] = {-1.8, -1.2, 0.0, 0.0}:
exp R0.y, c[0].x;
mov o[COL0].x, R0.y;
exp o[COL0].y, c[0].y;
So what this basically does is calculate the fraction of c[0].x and c[0].y and put it in o[COL0].
As expected, this yields a greenish color, since exp calculates src-floor(src) in .y, which is -1.8-(-2) = 0.2 for -1.8 and -1.2-(-2) = 0.8 for -1.2.
Now, if I change the program to this:
c[0] = {1.8, 1.2, 0.0, 0.0}:
exp R0.y, -c[0].x;
mov o[COL0].x, R0.y;
exp o[COL0].y, -c[0].y;
I get a red color, just as if I didn't specify the - in front of the c[0] every time. Why is this? Shouldn't it be the exact same result as above (that is, green)?
I tried the same vertex program in DirectX 8.1 using similar code to the one above and also the frc macro instruction, and DirectX gives results as expected (even though it explicitly says in the docs that passing in a negative value to exp produces undefined results, but still the .y component of the result is apparently calculated correctly).
Anyone have any ideas?
Regards.
[This message has been edited by Asgard (edited 09-02-2002).]