the tex2d in your loop causes the gradient error to be triggered. If you use tex2dlod, and fill in float4(pos1.x,pos1.y,0,0) for the texture argument, it will work
. Found the solution here, also the only thread about it on the whole internet. In English at least. Shaders are SO completely undocumented.
http://www.gamedev.net/community/forums/topic.asp?topic_id=466629the [loop] keyword as suggested there didnt work for me.