// PAY DAY HEIST - SHADOWS
// HELIXMOD FIX BY MIKE_AR69
// Generated by Microsoft (R) HLSL Shader Compiler 9.24.950.2656
//
// Parameters:
//
//   float4x4 camera_inv_view_matrix;
//   float3 camera_unprojection;
//   float4x4 view_proj_matrix;
//
//
// Registers:
//
//   Name                   Reg   Size
//   ---------------------- ----- ----
//   view_proj_matrix       c0       4
//   camera_inv_view_matrix c4       3
//   camera_unprojection    c7       1
//

    vs_3_0
    def c8, 1, -0.000292968762, 0.000390625006, 0
def c200, 2000, 0.1, 0.0625, 0
def c201, 1.0, 0.5, 0.1, 0.9

dcl_2d s0
    dcl_position v0
    dcl_texcoord v1
    dcl_position o0
    dcl_texcoord o1.xy
    dcl_texcoord1 o2.xyz
    dcl_texcoord2 o3.xyz


    dp4 r0.x, v0, c0
    dp4 r0.y, v0, c1
    dp4 r0.z, v0, c2
    dp4 r0.w, v0, c3		//The problem here is that r0.z = 0 and r0.w = 1 ALWAYS
							//So there is no depth information at all.
							//Need to either find that somewhere else or try and
							//fix a different shader

mov r10, r0					//r10 is NOT stereo shifted

mov r14.x, c250.x
if_eq r14.x, c200.w
	texldl r24, c200.z, s0
	
	mov r14.y, c250.y
	if_eq r14.y, c200.w
		//Works exactly with convergence = 1
		add r0.x, r0.x, -r24.x
	else	
		//Works approximately for other values of convergence
		rcp r24.w, c200.x
		mul r24.w, r24.w, r24.y
		add r24.w, c8.x, -r24.w
		add r24.w, -r24.w, r24.y 	
		mul r24.w, r24.w, r0.w
		add r24.y, r24.w, -r24.y
		mul r24.x, r24.x, r24.y
		add r0.x, r0.x, r24.x
	endif
endif
    

mul r1.xy, r0, c7				//r0 is shifted so r1 is shifted
								//r1 is like a view coord (except z=1)
								
mov r1.z, c8.x

    dp3 r2.x, r1, c4			//o2/r2 is shifted because r1 is shifted
    dp3 r2.y, r1, c5
    dp3 r2.z, r1, c6

mov o2.xyz, r2.xyz
	
    mov o1.xy, v1				//Passthrough of v1
    mov o3.xyz, c8.yzww			//Passthrough of constants

mov o0, r10			//UNSHIFTED COORD

// approximately 12 instruction slots used
 