Little ARB_vertex_program question


Assuming that a vertex program hasn’t reached the maximum instruction limit yet, is it equivalent to write this :

ADD oFog.x, ePos.z, 1000;

… and this :

ADD ePos.z, ePos.z, 1000;
MOV oFog.x, ePos.z;

… and this :

ADD tempdot.z, ePos.z, 1000;
MOV oFog.x, tempdot.z;

…in an ARB vertex program ?

Thanks in advance.

oFog.x in all three cases will have the same result. Generaly the first code snippet would be better since it’s one less instruction. But there are some cases I’m sure where you would need to store ePos.z + 1000 in a temp register to use later on in a program. Just depends on what you’re doing I guess.


Thanks for the answer.
That’s also what I think but I get different results.
Anyway I just realized I was testing the program on a Radeon8500, and even if I’m running the latest drivers I think I’ll try to catch a GeForce and test it too.

Different results eh? That’s wierd, guess it’s a driver bug. You may want to contact ATI about that.


What’s the type of ePos ? If it’s an ATTRIB then it’s read-only. Does GL report an error after glProgramStringARB ?

If ePos and tempdot are TEMPs and ePos is initialized, then as far as I can tell they should produce the same results.

TEMP tempdot, ePos;
OUTPUT oFog = result.fogcoord;

I haven’t checked the error but I guess it’s ok since the program is accepted : all outputs are computed correctly (vertex, texcoords, color) except fog obviously.

Ok I’ve got another question.
Does :
MOV oColor, 1;
… and :
MOV oColor, {1, 1, 1, 1};
… do the same thing ?

I think it could answer the problem mentioned in the beginning of the thread. Be it a driver bug or a mis-usage of vertex program.

Both of those should produce the same result.

Not on my ATI Radeon 8500.

This :
MOV oColor, 1;
… produces the same result as this :
MOV oColor, {1, 0, 0, 0};

I think it’s time for a bug report.

[EDIT] Same problem on ATI Radeon 9700, not on GeForce4 (other problem on GF4 though).

[This message has been edited by vincoof (edited 01-31-2003).]

I just tried it on my 9700, and the result is white (as it should be).

I’m using the latest 3.0 drivers.

drivers 3.0 are the ones that were released for DX9 ? If so, they are the ones I’m using (at least on Radeon8500, I’m not the one who installed drivers on Radeon9700) and I’m definately having problems.