//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
//   sampler2D Base;
//   sampler2D GBuffer1;
//   sampler2D GBuffer2;
//   sampler2D GBuffer3;
//   sampler2D GBuffer4;
//   sampler2D Shadow;
//   float4x4 global_LightPropertyMatrix;
//   float4 global_ViewPos;
//   row_major float3x3 invViewMatrix;
//   float4 shaderProperties;
//
//
// Registers:
//
//   Name                       Reg   Size
//   -------------------------- ----- ----
//   invViewMatrix              c0       3
//   shaderProperties           c3       1
//   global_ViewPos             c214     1
//   global_LightPropertyMatrix c220     4
//   GBuffer1                   s0       1
//   GBuffer2                   s1       1
//   GBuffer3                   s2       1
//   GBuffer4                   s3       1
//   Base                       s4       1
//   Shadow                     s5       1
//

    ps_3_0
    def c4, 0, 1, 3.55539989, -1.77769995
    def c5, 2, -1, 4, 0.5
    dcl_texcoord v0.xy  // In<4,5>
    dcl_texcoord2 v1.xyz  // In<6,7,8>
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2
    dcl_2d s3
    dcl_2d s4
    dcl_2d s5

#line 32 "c:\Develop\LSProjects\build\shared\EyesOfAChild\Code\EoCApp\build\memory"
    texld r0, v0, s0  // ::depth<0>
    texld r1, v0, s1  // ::GBuffer2values<0,1,2,3>
    texld r2, v0, s2  // ::GBuffer3values<0,1,2,3>
    texld r3, v0, s3  // ::GBuffer4values<0,1,2,3>

#line 39
    mov r4.xy, c4
    if_lt -c3.x, r4.x
      texld r5, v0, s4  // ::ao<0>
    else
      mov r5.x, c4.y  // ::ao<0>
    endif

#line 45
    if_lt -c3.w, r4.x
      texld r6, v0, s5  // ::shadowValue<0,1,2,3>
    else
      mov r6.xyz, c4.y  // ::shadowValue<0,1,2>
    endif

#line 18 "Shaders/Deferred.shdh"
    mov_pp r7.x, r1.w
    mov_pp r7.y, r3.w
    mad_pp r7.xy, r7, c4.z, c4.w  // ::nn<0,1>
    mov_pp r7.z, c4.y  // ::nn<2>
    dp3_pp r0.y, r7, r7
    rcp r0.y, r0.y
    add_pp r0.z, r0.y, r0.y  // ::g<0>
    mul_pp r7.xy, r7, r0.z  // ::n<0,1>
    mad_pp r7.z, r0.y, c5.x, c5.y  // ::n<2>

#line 48 "c:\Develop\LSProjects\build\shared\EyesOfAChild\Code\EoCApp\build\memory"
    dp3 r8.x, c0, r7  // ::WorldNormal<0>
    dp3 r8.y, c1, r7  // ::WorldNormal<1>
    dp3 r8.z, c2, r7  // ::WorldNormal<2>
    mad r0.xyz, r0.x, v1, c214  // ::WorldPos<0,1,2>
    add r0.xyz, -r0, c214
    dp3 r0.w, r0, r0
    rsq r0.w, r0.w

#line 68 "Shaders/Deferred.shdh"
    mov r7.x, c220.x
    mov r7.y, c221.x
    mov r7.z, c222.x
    nrm r9.xyz, r7
    dp3 r1.w, r9, r8  // ::NdotL<0>

#line 78
    mov_sat r3.w, r1.w  // ::intensity<0>

#line 85
    mad r0.xyz, r0, r0.w, r7
    nrm r7.xyz, r0  // ::halfvector<0,1,2>
    dp3 r0.x, r7, r8  // ::specularIntensity<0>
    pow r4.x, r0.x, r2.w  // ::specularIntensity<0>
    mul_sat r0.x, r1.w, c5.z
    mul r0.x, r0.x, r4.x  // ::specularIntensity<0>

#line 94
    mul r7.x, r3.w, c220.z  // DirectionLight::lightDiffuseColorOut<0>
    mul r7.y, r3.w, c221.z  // DirectionLight::lightDiffuseColorOut<1>
    mul r7.z, r3.w, c222.z  // DirectionLight::lightDiffuseColorOut<2>
    mul r9.x, r0.x, c220.w
    mul r9.y, r0.x, c221.w
    mul r9.z, r0.x, c222.w
    mad r0.x, r8.y, c5.w, c5.w
    mov r8.xyz, c223  // ::global_LightPropertyMatrix<3,7,11>
    add r10.x, -r8.x, c220.y
    add r10.y, -r8.y, c221.y
    add r10.z, -r8.z, c222.y
    mad r0.xyz, r0.x, r10, c223  // DirectionLight::lightAmbientColorOut<0,1,2>

#line 58 "c:\Develop\LSProjects\build\shared\EyesOfAChild\Code\EoCApp\build\memory"
    mul r0.xyz, r0, r1
    add r0.w, r5.x, -c4.y
    mad r4.xy, c3.zyzw, r0.w, r4.y
    mul r1.xyz, r1, r7
    mul r1.xyz, r4.y, r1
    mul r1.xyz, r6, r1  // ::LightDiffuseColorOut<0,1,2>
    mul r2.xyz, r2, r9
    mul r2.xyz, r4.y, r2
    mul r2.xyz, r6, r2
    cmp r2.xyz, -r3.w, c4.x, r2  // ::LightSpecularColorOut<0,1,2>
    mad r0.xyz, r0, r4.x, r1
    add r0.xyz, r2, r0  // ::Out<0,1,2>
    add r0.xyz, r3, r0  // ::Out<0,1,2>
    max oC0.xyz, r0, c4.x  // ::main<0,1,2>
    mov oC0.w, c4.y  // ::main<3>

// approximately 80 instruction slots used (6 texture, 74 arithmetic)
 