What's wrong with this NV_fragment_program2?

Hi,

I am writing this shader and I don’t seem to follow why “SUBR” is not providing me the correct results. I checked the contents of the variables and they seems to be fine. Apparently when I try to do the subtraction between “Coordinates” and “Position”, the “COLOR” results in some junk values.

Here is the source code:
#################################################
"!!ARBfp1.0
"

"OPTION NV_fragment_program2;
"

"ATTRIB ParticleIndex = fragment.texcoord[2];
"

"OUTPUT COLOR = result.color;
"

"PARAM Root = {0.0, 0.0};
"
"PARAM Width = program.env[0]; # width is 4
"

"TEMP MassAddress;
"
"TEMP Position;
"
"TEMP Coordinates;
"
"TEMP GridIndex;
"
"TEMP Index;
"
"TEMP fraction;
"
"TEMP temp;
"

"TEX Coordinates, ParticleIndex, texture[2], RECT;
"

"TEX MassAddress, Root, texture[0], RECT;
"
"MOVR Index.x, MassAddress.z;
"
"CAL DECODEINDEX;
"

"TEX MassAddress, GridIndex, texture[0], RECT;
"
"TEX Position, GridIndex, texture[1], RECT;
"
"SUBR COLOR, Coordinates, Position;
"
"RET;
"

"DECODEINDEX:
"
"DIVR GridIndex.y, Index.x, Width.x;
"
"FRCR fraction.x, GridIndex.y;
"
"MULR GridIndex.x, fraction.x, Width.x;
"
"RET;
"

"END
";
#################################################

Please help.

Platform : x86(AMD) , Linux RedHat 9.0
Graphics Hardware : GeForce 6600 GT

Thanks.

  • FMS

SUB is not a hardware funtion, it is substituted with an ADD. Have you tried this:

"ADDR COLOR, Coordinates, -Position;
"

Maybe its a bug in the driver…