//Shadows PS 1
//VS 2ccc857aad1bbf87
cbuffer PER_BATCH : register(b0)
{
  float4 vBasisMagnitudes : packoffset(c0);
  float4 vWBasisY : packoffset(c1);
  float4 vWBasisX : packoffset(c2);
  float4 irreg_kernel_2d[8] : packoffset(c3);
  float4 vInvShadowMapWH : packoffset(c11);
  float4 fDepthShift : packoffset(c12);
  float4 fShadowFadingDist : packoffset(c13);
  float4 vCamPos : packoffset(c14);
  float4 fOneDivFarDist : packoffset(c15);
  float4 vWBasisZ : packoffset(c16);
  float4 fDepthTestBias : packoffset(c17);
  float4 fKernelRadius : packoffset(c18);
}
SamplerState sceneDepthSampler_s : register(s0);
SamplerState sRotSampler_s : register(s2);
SamplerComparisonState SAMPLER_STATE_depthMapSampler_s : register(s1);
Texture2D<float4> sceneDepthSampler : register(t0);
Texture2D<float4> sRotSampler : register(t1);
Texture2D<float4> depthMapSampler0 : register(t2);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  out float4 o0 : SV_Target0,
  
          float4 g_VS_NearFarClipDist : TEXCOORD2,
  float4 g_VS_ScreenSize : TEXCOORD3)
  
{
  float4 r0,r1,r2,r3,r4,r5;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = sceneDepthSampler.Sample(sceneDepthSampler_s, v2.xy).x;
  
      float4 stereo = StereoParams.Load(0);
  float depth = r0.x * g_VS_NearFarClipDist.y;
  v0.x -= stereo.x * (depth - stereo.y) / depth * g_VS_ScreenSize.x / 2;
  
  r0.yzw = vBasisMagnitudes.xyz * r0.xxx;
  r0.yz = v0.xy * r0.yz;
  r1.xyzw = vWBasisX.xyzw * r0.yyyy;
  r1.xyzw = vWBasisZ.xyzw * r0.wwww + r1.xyzw;
  r1.xyzw = vWBasisY.xyzw * r0.zzzz + r1.xyzw;
  r1.xyzw = vCamPos.xyzw + r1.xyzw;
  r2.xyzw = r1.xyxy / r1.wwww;
  r0.y = r1.z * fOneDivFarDist.x + -fDepthTestBias.x;
  r0.zw = float2(72,72) * v2.xy;
  r0.y = max(0, r0.y);
  r0.y = min(0.999998987, r0.y);
  r1.x = 15 * fKernelRadius.y;
  r0.zw = r1.xx * r0.zw;
  r0.zw = sRotSampler.Sample(sRotSampler_s, r0.zw).xy;
  r1.xyz = fKernelRadius.yxx * vInvShadowMapWH.yxx;
  r1.xyz = r1.xyz * r0.wzz;
  r1.w = -r1.x;
  r3.xyzw = float4(0,0,0,0);
  r0.z = 0;
  while (true) {
    r0.w = (int)r0.z;
    r0.w = r0.w >= 4;
    if (r0.w != 0) break;
    r4.xyzw = irreg_kernel_2d[r0.z].yyzz * r1.xzzw;
    r4.xyzw = r1.zwxz * irreg_kernel_2d[r0.z].xxww + r4.xyzw;
    r4.xyzw = r4.xyzw + r2.zwzw;
    r5.x = depthMapSampler0.SampleCmp(SAMPLER_STATE_depthMapSampler_s, r4.xy, r0.y).x;
    r5.y = depthMapSampler0.SampleCmp(SAMPLER_STATE_depthMapSampler_s, r4.zw, r0.y).x;
    bitmask.w = ((~(-1 << 1)) << 0) & 0xffffffff;
  r0.w = (((uint)1 << 0) & bitmask.w) | ((uint)r0.z & ~bitmask.w);
    r4.xyzw = irreg_kernel_2d[r0.w].yyzz * r1.xyzw;
    r4.xyzw = r1.zwxz * irreg_kernel_2d[r0.w].xxww + r4.xyzw;
    r4.xyzw = r4.xyzw + r2.xyzw;
    r5.z = depthMapSampler0.SampleCmp(SAMPLER_STATE_depthMapSampler_s, r4.xy, r0.y).x;
    r5.w = depthMapSampler0.SampleCmp(SAMPLER_STATE_depthMapSampler_s, r4.zw, r0.y).x;
    r3.xyzw = r5.xyzw + r3.xyzw;
    r0.z = (int)r0.z + 2;
  }
  r0.y = dot(r3.xyzw, float4(0.125,0.125,0.125,0.125));
  r0.x = r0.x * fShadowFadingDist.z + -fShadowFadingDist.x;
  r0.z = fShadowFadingDist.y + -fShadowFadingDist.x;
  r0.x = saturate(r0.x / r0.z);
  r0.x = 1 + -r0.x;
  r0.y = -r0.y * r0.y + 1;
  o0.xyzw = r0.yyyy * r0.xxxx;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.1 on Fri Aug 28 22:49:15 2015
//
//
// Buffer Definitions: 
//
// cbuffer PER_BATCH
// {
//
//   float4 vBasisMagnitudes;           // Offset:    0 Size:    16
//   float4 vWBasisY;                   // Offset:   16 Size:    16
//   float4 vWBasisX;                   // Offset:   32 Size:    16
//   float4 irreg_kernel_2d[8];         // Offset:   48 Size:   128
//   float4 vInvShadowMapWH;            // Offset:  176 Size:    16
//   float4 fDepthShift;                // Offset:  192 Size:    16 [unused]
//   float4 fShadowFadingDist;          // Offset:  208 Size:    16
//   float4 vCamPos;                    // Offset:  224 Size:    16
//   float4 fOneDivFarDist;             // Offset:  240 Size:    16
//   float4 vWBasisZ;                   // Offset:  256 Size:    16
//   float4 fDepthTestBias;             // Offset:  272 Size:    16
//   float4 fKernelRadius;              // Offset:  288 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// sceneDepthSampler                 sampler      NA          NA    0        1
// SAMPLER_STATE_depthMapSampler   sampler_c      NA          NA    1        1
// sRotSampler                       sampler      NA          NA    2        1
// sceneDepthSampler                 texture  float4          2d    0        1
// sRotSampler                       texture  float4          2d    1        1
// depthMapSampler0                  texture  float4          2d    2        1
// PER_BATCH                         cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xy  
// TEXCOORD                 0   xyzw        1     NONE   float       
// TEXCOORD                 1   xyzw        2     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[19], dynamicIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_comparison
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v2.xy
dcl_output o0.xyzw
dcl_temps 6
sample_indexable(texture2d)(float,float,float,float) r0.x, v2.xyxx, t0.xyzw, s0
mul r0.yzw, r0.xxxx, cb0[0].xxyz
mul r0.yz, r0.yyzy, v0.xxyx
mul r1.xyzw, r0.yyyy, cb0[2].xyzw
mad r1.xyzw, cb0[16].xyzw, r0.wwww, r1.xyzw
mad r1.xyzw, cb0[1].xyzw, r0.zzzz, r1.xyzw
add r1.xyzw, r1.xyzw, cb0[14].xyzw
div r2.xyzw, r1.xyxy, r1.wwww
mad r0.y, r1.z, cb0[15].x, -cb0[17].x
mul r0.zw, v2.xxxy, l(0.000000, 0.000000, 72.000000, 72.000000)
max r0.y, r0.y, l(0.000000)
min r0.y, r0.y, l(0.999999)
mul r1.x, cb0[18].y, l(15.000000)
mul r0.zw, r0.zzzw, r1.xxxx
sample_indexable(texture2d)(float,float,float,float) r0.zw, r0.zwzz, t1.zwxy, s2
mul r1.xyz, cb0[11].yxxy, cb0[18].yxxy
mul r1.xyz, r0.wzzw, r1.xyzx
mov r1.w, -r1.x
mov r3.xyzw, l(0,0,0,0)
mov r0.z, l(0)
loop 
  itof r0.w, r0.z
  ge r0.w, r0.w, l(4.000000)
  breakc_nz r0.w
  mul r4.xyzw, r1.xzzw, cb0[r0.z + 3].yyzz
  mad r4.xyzw, r1.zwxz, cb0[r0.z + 3].xxww, r4.xyzw
  add r4.xyzw, r2.zwzw, r4.xyzw
  sample_c_indexable(texture2d)(float,float,float,float) r5.x, r4.xyxx, t2.xxxx, s1, r0.y
  sample_c_indexable(texture2d)(float,float,float,float) r5.y, r4.zwzz, t2.xxxx, s1, r0.y
  bfi r0.w, l(1), l(0), l(1), r0.z
  mul r4.xyzw, r1.xyzw, cb0[r0.w + 3].yyzz
  mad r4.xyzw, r1.zwxz, cb0[r0.w + 3].xxww, r4.xyzw
  add r4.xyzw, r2.xyzw, r4.xyzw
  sample_c_indexable(texture2d)(float,float,float,float) r5.z, r4.xyxx, t2.xxxx, s1, r0.y
  sample_c_indexable(texture2d)(float,float,float,float) r5.w, r4.zwzz, t2.xxxx, s1, r0.y
  add r3.xyzw, r3.xyzw, r5.xyzw
  iadd r0.z, r0.z, l(2)
endloop 
dp4 r0.y, r3.xyzw, l(0.125000, 0.125000, 0.125000, 0.125000)
mad r0.x, r0.x, cb0[13].z, -cb0[13].x
add r0.z, -cb0[13].x, cb0[13].y
div_sat r0.x, r0.x, r0.z
add r0.x, -r0.x, l(1.000000)
mad r0.y, -r0.y, r0.y, l(1.000000)
mul o0.xyzw, r0.xxxx, r0.yyyy
ret 
// Approximately 46 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
