ps_2_0
// pixel shader to prepare spheres intersection results to receive shadows
// inputs:
// {tex0 - spheres_desc (x,y,z,r, 32F)}
// tex1 - render result buffer (distances, indices, 32F)
// tex2 - intersecting ray origins
// tex3 - intersecting ray directions
// c1.x - number of spheres = width of spheres desc texture
// outputs shadow test ray position
def c6,100,99.9,256,0
def c9,1,-1,0,0
def c10,0,0,0,0
dcl t0
dcl_2d s1
dcl_2d s2
dcl_2d s3
texld r0,t0,s1
add r3,r0.b,c9.x
texkill r3
mul r0.g,r0.g,c6.x
texld r3,t0,s2
texld r4,t0,s3
mad r4,r4,r0.g,r3    // dir * dist + orig = pos
sub r0.g,r0.g,c6.y
cmp r4,r0.g,c10,r4
mov oC0,r4
