// fix of dynamic shadows
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
//   float4 EdgeSampleOffsets[4];
//   float3 FalloffParameters;
//   float2 InvRandomAngleTextureSize;
//   float4 LightPosition;
//   float4 MinZ_MaxZRatio;
//   sampler2D RandomAngleTexture;
//   float4 RefiningSampleOffsets[6];
//   sampler2D SceneColorTexture;
//   float4 ScreenPositionScaleBias;
//   float4x4 ScreenToShadowMatrix;
//   float4x4 ScreenToWorld;
//   sampler2D ShadowDepthTexture;
//   float4 ShadowModulateColor;
//
//
// Registers:
//
//   Name                      Reg   Size
//   ------------------------- ----- ----
//   InvRandomAngleTextureSize c0       1
//   ScreenPositionScaleBias   c1       1
//   MinZ_MaxZRatio            c2       1
//   RefiningSampleOffsets     c8       6
//   ScreenToShadowMatrix      c14      4
//   EdgeSampleOffsets         c18      4
//   ScreenToWorld             c22      4
//   ShadowModulateColor       c26      1
//   LightPosition             c27      1
//   FalloffParameters         c28      1
//   SceneColorTexture         s0       1
//   ShadowDepthTexture        s1       1
//   RandomAngleTexture        s2       1
//

    ps_3_0
    def c3, 0, 1, 0.999000013, 0.5
    def c4, 2, -1, 1, 0.125
    def c5, 0.00079999998, -7.99919987, 0.0833333358, 0.699999988
    dcl_texcoord v0.xyw
    dcl_2d s0
    dcl_2d s1
    dcl_2d s2

def c220, 0, 1, 0.0625, 0.5
dcl_2d s13


// Unreal Engine shadow fix inserted with DarkStarSword's shadertool.py:
// shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* C:\test\Dumps\AllShaders\PixelShader\952E819A.txt
texldl r9, c220.z, s13
mov r8.xyw, v0
add r9.w, r8.w, -r9.y
mad r8.x, r9.w, r9.x, r8.x

    rcp r0.x, r8.w
    mul r0.yz, r0.x, r8.xxyw
    mad r1.xy, r0.yzzw, c1, c1.wzzw
    mov r1.zw, c3.x
    texldl r1, r1, s0
    mov r1.y, c3.y
    add r0.w, r1.y, -c2.y
    add r0.w, -r0.w, r1.w
    rcp r0.w, r0.w
    mul r0.w, r0.w, -c2.x
    mul r0.yz, r0.w, r0
    mul r2, r0.z, c15

// Unreal Engine shadow fix inserted with DarkStarSword's shadertool.py:
// shadertool.py --install --auto-fix-unreal-shadows --auto-fix-unreal-light-shafts --only-autofixed C:\test\Dumps\AllShaders\PixelShader\* C:\test\Dumps\AllShaders\PixelShader\952E819A.txt
add r9.w, r0.w, -r9.y
mad r0.y, -r9.w, r9.x, r0.y

    mad r2, c14, r0.y, r2
    mad r2, c16, r0.w, r2
    add r2, r2, c17
    rcp r1.x, r2.w
    mul r1.zw, r1.x, r2.xyxy
    min r3.z, r2.z, c3.z
    mad r2.zw, r8.xyxy, r0.x, c3.y
    mul r2.zw, r2, c0.xyxy
    mul r2.zw, r2, c3.w
    texld r4, r2.zwzw, s2
    mad_pp r4, r4.yxyx, c4.x, c4.y
    mul_pp r5, r4.wzwz, c4.zyzy
    mad r6, r5.zwzw, c18.xxzz, r1.zwzw
    mad_pp r6, r4.zwzw, c18.yyww, r6
    mul r3.xyw, r6.xyzx, c3.yyzx
    texldl_pp r7, r3, s1
    mul r3.xyw, r6.zwzx, c3.yyzx
    texldl r6, r3, s1
    add_pp r0.x, r6.x, r7.x
    mad r6, r5.zwzw, c19.xxzz, r1.zwzw
    mad_pp r6, r4.zwzw, c19.yyww, r6
    mov_pp r3.xy, r6
    texldl r7, r3, s1
    add_pp r0.x, r0.x, r7.x
    mov_pp r3.xy, r6.zwzw
    texldl r6, r3, s1
    add_pp r0.x, r0.x, r6.x
    mad r6, r5.zwzw, c20.xxzz, r1.zwzw
    mad_pp r6, r4.zwzw, c20.yyww, r6
    mov_pp r3.xy, r6
    texldl r7, r3, s1
    add_pp r0.x, r0.x, r7.x
    mov_pp r3.xy, r6.zwzw
    texldl r6, r3, s1
    add_pp r0.x, r0.x, r6.x
    mad r5, r5, c21.xxzz, r1.zwzw
    mad_pp r4, r4, c21.yyww, r5
    mov_pp r3.xy, r4
    texldl r5, r3, s1
    add_pp r0.x, r0.x, r5.x
    mov_pp r3.xy, r4.zwzw
    texldl r4, r3, s1
    add_pp r0.x, r0.x, r4.x
    mul_pp r1.z, r0.x, c4.w
    add r1.w, -r0.x, c5.x
    add r0.x, r0.x, c5.y
    cmp r0.x, r0.x, c3.x, c3.y
    cmp r0.x, r1.w, c3.x, r0.x
    if_ne r0.x, -r0.x
      mad_pp r4, r2.xyxy, r1.x, c8
      mov_pp r3.xy, r4
      texldl_pp r5, r3, s1
      mov_pp r3.xy, r4.zwzw
      texldl r4, r3, s1
      add_pp r0.x, r4.x, r5.x
      mad_pp r4, r2.xyxy, r1.x, c9
      mov_pp r3.xy, r4
      texldl r5, r3, s1
      add_pp r0.x, r0.x, r5.x
      mov_pp r3.xy, r4.zwzw
      texldl r4, r3, s1
      add_pp r0.x, r0.x, r4.x
      mad_pp r4, r2.xyxy, r1.x, c10
      mov_pp r3.xy, r4
      texldl r5, r3, s1
      add_pp r0.x, r0.x, r5.x
      mov_pp r3.xy, r4.zwzw
      texldl r4, r3, s1
      add_pp r0.x, r0.x, r4.x
      mad_pp r4, r2.xyxy, r1.x, c11
      mov_pp r3.xy, r4
      texldl r5, r3, s1
      add_pp r0.x, r0.x, r5.x
      mov_pp r3.xy, r4.zwzw
      texldl r4, r3, s1
      add_pp r0.x, r0.x, r4.x
      mad_pp r4, r2.xyxy, r1.x, c12
      mov_pp r3.xy, r4
      texldl r5, r3, s1
      add_pp r0.x, r0.x, r5.x
      mov_pp r3.xy, r4.zwzw
      texldl r4, r3, s1
      add_pp r0.x, r0.x, r4.x
      mad_pp r2, r2.xyxy, r1.x, c13
      mov_pp r3.xy, r2
      texldl r4, r3, s1
      add_pp r0.x, r0.x, r4.x
      mov_pp r3.xy, r2.zwzw
      texldl r2, r3, s1
      add_pp r0.x, r0.x, r2.x
      mad r0.x, r0.x, c5.z, -r1.z
      mad_pp r1.z, r0.x, c5.w, r1.z
    endif
    mul r2.xyz, r0.z, c23
    mad r0.xyz, c22, r0.y, r2
    mad r0.xyz, c24, r0.w, r0
    add r0.xyz, r0, c25
    add r0.xyz, -r0, c27
    mul r0.xyz, r0, c27.w
    dp3 r0.x, r0, r0
    rsq r0.x, r0.x
    rcp r0.x, r0.x
    mad r0.x, r0.x, c28.y, c28.z
    max r1.x, r0.x, c3.x
    mad r0.x, r1.x, -r1.x, c3.y
    max r1.x, r0.x, c3.x
    pow_pp r0.x, r1.x, c28.x
    add r2, -r1.y, c26
    mad_pp r0, r0.x, r2, c3.y
    mul_pp r1.x, r1.z, r1.z
    mul_pp r1.x, r1.z, r1.x
    add_pp r2, -r0, c3.y
    mad_pp oC0, r1.x, r2, r0

// approximately 150 instruction slots used (43 texture, 107 arithmetic)
