//Lights PS 1
cbuffer PER_BATCH : register(b0)
{
  float4 g_LightPos : packoffset(c0);
  float4 g_LightDiffuse : packoffset(c1);
  float4 g_ScreenScale : packoffset(c2);
  float4 vWBasisX : packoffset(c3);
  float4 vWBasisY : packoffset(c4);
  float4 vWBasisZ : packoffset(c5);
  float4 irreg_kernel_2d[8] : packoffset(c6);
  float4 SSDOParams : packoffset(c14);
}
SamplerState _tex0_s : register(s0);
SamplerState _tex1_s : register(s1);
SamplerState _tex8_s : register(s8);
Texture2D<float4> _tex0 : register(t0);
Texture2D<float4> _tex1 : register(t1);
Texture2D<float4> _tex8 : register(t8);

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

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

  r0.xy = v0.xy * g_ScreenScale.xy + g_ScreenScale.zw;
  r1.xyzw = _tex1.Sample(_tex1_s, r0.xy).xyzw;
  r1.xyz = r1.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.zw = r1.ww * float2(40.5845261,255) + float2(0.318309993,9.99999997e-007);
  r1.w = dot(r1.xyz, r1.xyz);
  r1.w = rsqrt(r1.w);
  r1.xyz = r1.xyz * r1.www;
  r1.w = _tex0.Sample(_tex0_s, r0.xy).x;
  r2.xyzw = _tex8.Sample(_tex8_s, r0.xy).xyzw;
  
    float4 stereo = StereoParams.Load(0);
  float depth = r1.w * g_VS_NearFarClipDist.y;
  v0.x -= stereo.x * (depth - stereo.y) / depth * g_VS_ScreenSize.x / 2;
  
  r3.xyz = vWBasisX.xyz * v0.xxx + vWBasisZ.xyz;
  r3.xyz = vWBasisY.xyz * v0.yyy + r3.xyz;
  r4.xyz = -r3.xyz * r1.www + g_LightPos.xyz;
  r3.xyz = r3.xyz * r1.www;
  r0.x = dot(r4.xyz, r4.xyz);
  r0.x = rsqrt(r0.x);
  r5.xyz = r4.xyz * r0.xxx;
  r4.xyz = g_LightPos.www * r4.xyz;
  r0.x = dot(r4.xyz, r4.xyz);
  r0.x = 1 + -r0.x;
  r0.x = max(0, r0.x);
  r0.x = r0.x * r0.x;
  r0.y = saturate(dot(r5.xyz, r1.xyz));
  r2.xyz = r2.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r1.w = saturate(dot(r5.xyz, r2.xyz));
  r1.w = -r1.w + r0.y;
  r2.xyz = g_LightDiffuse.xyz * r0.yyy;
  r2.xyz = r2.xyz * r0.xxx;
  r0.x = max(0, r1.w);
  r0.x = sqrt(r0.x);
  r0.x = r0.x * r2.w;
  r0.x = saturate(SSDOParams.x * r0.x);
  r0.x = 1 + -r0.x;
  r2.xyz = r2.xyz * r0.xxx;
  o0.xyz = r2.xyz;
  r2.xyz = g_LightDiffuse.www * r2.xyz;
  o0.w = 0;
  r0.x = dot(-r3.xyz, -r3.xyz);
  r0.x = rsqrt(r0.x);
  r3.xyz = -r3.xyz * r0.xxx + r5.xyz;
  r0.x = dot(r3.xyz, r3.xyz);
  r0.x = rsqrt(r0.x);
  r3.xyz = r3.xyz * r0.xxx;
  r0.x = saturate(dot(r1.xyz, r3.xyz));
  r0.x = log2(r0.x);
  r0.x = r0.w * r0.x;
  r0.x = exp2(r0.x);
  r0.x = r0.z * r0.x;
  o1.xyz = r2.xyz * r0.xxx;
  o1.w = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.1 on Sun Aug 30 15:11:44 2015
//
//
// Buffer Definitions: 
//
// cbuffer PER_BATCH
// {
//
//   float4 g_LightPos;                 // Offset:    0 Size:    16
//   float4 g_LightDiffuse;             // Offset:   16 Size:    16
//   float4 g_ScreenScale;              // Offset:   32 Size:    16
//   float4 vWBasisX;                   // Offset:   48 Size:    16
//   float4 vWBasisY;                   // Offset:   64 Size:    16
//   float4 vWBasisZ;                   // Offset:   80 Size:    16
//   float4 irreg_kernel_2d[8];         // Offset:   96 Size:   128 [unused]
//   float4 SSDOParams;                 // Offset:  224 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _tex0                             sampler      NA          NA    0        1
// _tex1                             sampler      NA          NA    1        1
// _tex8                             sampler      NA          NA    8        1
// _tex0                             texture  float4          2d    0        1
// _tex1                             texture  float4          2d    1        1
// _tex8                             texture  float4          2d    8        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  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[15], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s8, 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) t8
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 6
mad r0.xy, v0.xyxx, cb0[2].xyxx, cb0[2].zwzz
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.xyxx, t1.xyzw, s1
mad r1.xyz, r1.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r0.zw, r1.wwww, l(0.000000, 0.000000, 40.584526, 255.000000), l(0.000000, 0.000000, 0.318310, 0.000001)
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
sample_indexable(texture2d)(float,float,float,float) r1.w, r0.xyxx, t0.yzwx, s0
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r0.xyxx, t8.xyzw, s8
mad r3.xyz, cb0[3].xyzx, v0.xxxx, cb0[5].xyzx
mad r3.xyz, cb0[4].xyzx, v0.yyyy, r3.xyzx
mad r4.xyz, -r3.xyzx, r1.wwww, cb0[0].xyzx
mul r3.xyz, r1.wwww, r3.xyzx
dp3 r0.x, r4.xyzx, r4.xyzx
rsq r0.x, r0.x
mul r5.xyz, r0.xxxx, r4.xyzx
mul r4.xyz, r4.xyzx, cb0[0].wwww
dp3 r0.x, r4.xyzx, r4.xyzx
add r0.x, -r0.x, l(1.000000)
max r0.x, r0.x, l(0.000000)
mul r0.x, r0.x, r0.x
dp3_sat r0.y, r5.xyzx, r1.xyzx
mad r2.xyz, r2.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3_sat r1.w, r5.xyzx, r2.xyzx
add r1.w, r0.y, -r1.w
mul r2.xyz, r0.yyyy, cb0[1].xyzx
mul r2.xyz, r0.xxxx, r2.xyzx
max r0.x, r1.w, l(0.000000)
sqrt r0.x, r0.x
mul r0.x, r2.w, r0.x
mul_sat r0.x, r0.x, cb0[14].x
add r0.x, -r0.x, l(1.000000)
mul r2.xyz, r0.xxxx, r2.xyzx
mov o0.xyz, r2.xyzx
mul r2.xyz, r2.xyzx, cb0[1].wwww
mov o0.w, l(0)
dp3 r0.x, -r3.xyzx, -r3.xyzx
rsq r0.x, r0.x
mad r3.xyz, -r3.xyzx, r0.xxxx, r5.xyzx
dp3 r0.x, r3.xyzx, r3.xyzx
rsq r0.x, r0.x
mul r3.xyz, r0.xxxx, r3.xyzx
dp3_sat r0.x, r1.xyzx, r3.xyzx
log r0.x, r0.x
mul r0.x, r0.x, r0.w
exp r0.x, r0.x
mul r0.x, r0.x, r0.z
mul o1.xyz, r0.xxxx, r2.xyzx
mov o1.w, l(0)
ret 
// Approximately 50 instruction slots used

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