Hello,
I am trying to make benefit of the new branching capabilities of the NV_fragment_program2 extension on my geForce 6800 GT to speed up my program but I get very strange results…
It’s a volume rendering application and currently, I use the fragment program just to make a texture lookup to map color on the 3D scalar field. To test the IF statement, I just try to kill the fragment if density > 0.0, so every fragment are killed. In fact, fragments are well killed (nothing displayed) but my framerate drop back from ~40fps to ~7fps ! If I comment the IF statement and the kill, the framerate remain to ~40FPS, the kil also seams to be inefficient…
Here is the FP code I use:
!!ARBfp1.0
OPTION NV_fragment_program2;
ATTRIB tex0=fragment.texcoord[0];
OUTPUT oColor=result.color;
#light color
PARAM lcol={0.8,0.8,0.8};
TEMP index;
#texture fetch, alpha = density
TEXC index, tex0, texture[0], 3D;
IF GT.a; #every fragment are killed
KIL {-1,-1,-1,-1};
ELSE; #Texture lookup
MOV index.r, 0.0;
TEX oColor, index.argb, texture[2], 2D;
ENDIF;
END
If anybody have tried to use branching and could help me…