i am trying to write a simple arb_fragment_program that checks if there is a texture bound to to the fragment or not. if there is a texture, it takes the color from the texture and multiplies it with the fragment.color. if not, it takes only the fragment.color.
to do the checks, i use the standard return values of TEX and modify them to get a negative/positive number that is passed to KIL. the documentation on ARB_fragment_program sais that the return values of TEX are (R=0, G=0, B=0, A=1).
so i wrote this code:
!!ARBfp1.0
OUTPUT out = result.color;
MOV out, fragment.color;
TEMP temp;
TEX temp, fragment.texcoord[0], texture[0], 2D;
TEMP istex;
ADD istex.x, temp.x, temp.y;
ADD istex.x, istex.x, temp.z;
ADD istex.x, istex.x, -0.001;
KIL istex.x;
MUL out, fragment.color, temp;
END
this would work if TEX would return the values that it should return. but it returns (R=0.443, G=0.522, B=0.188, A=1).