//lights PS 1
cbuffer PER_BATCH : register(b0)
{
  float4 g_LightPos : packoffset(c0);
  float4 g_LightDiffuse : packoffset(c1);
  row_major float4x4 g_mLightProj : packoffset(c2);
  float4 vWBasisX : packoffset(c6);
  float4 vWBasisY : packoffset(c7);
  float4 vWBasisZ : packoffset(c8);
  float4 irreg_kernel_2d[8] : packoffset(c9);
  float4 SSDOParams : packoffset(c17);
}
SamplerState _tex0_s : register(s0);
SamplerState _tex1_s : register(s1);
SamplerState _tex2_s : register(s2);
SamplerState _tex8_s : register(s8);
Texture2D<float4> _tex0 : register(t0);
Texture2D<float4> _tex1 : register(t1);
Texture2D<float4> _tex2 : register(t2);
Texture2D<float4> _tex8 : register(t8);

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,
  out float4 o1 : SV_Target1,
  
        row_major matrix vp : TEXCOORD2,
  row_major matrix ivp : TEXCOORD6)
  
{
  float4 r0,r1,r2,r3,r4,r5;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.w = 1;
  r1.x = _tex0.Sample(_tex0_s, v1.xy).x;
  
      float4 stereo = StereoParams.Load(0);
  float4 tmp = mul(vp, v2 * r1.x);
  tmp.x -= stereo.x * (tmp.w - stereo.y);
  v2 = mul(ivp, tmp) / r1.x;
  
  r0.xyz = v2.xyz * r1.xxx;
  r1.xyz = -r1.xxx * v2.xyz + g_LightPos.xyz;
  r2.x = dot(g_mLightProj._m00_m01_m02_m03, r0.xyzw);
  r2.y = dot(g_mLightProj._m10_m11_m12_m13, r0.xyzw);
  r0.w = dot(g_mLightProj._m30_m31_m32_m33, r0.xyzw);
  r2.xy = r2.xy / r0.ww;
  r2.xyz = _tex2.SampleLevel(_tex2_s, r2.xy, 0).xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = r1.xyz * r0.www;
  r1.xyz = g_LightPos.www * r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = 1 + -r0.w;
  r0.w = max(0, r0.w);
  r1.xyzw = _tex1.Sample(_tex1_s, v1.xy).xyzw;
  r1.xyz = r1.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r4.xy = 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 = saturate(dot(r3.xyz, r1.xyz));
  r2.xyz = r1.www * r2.xyz;
  r2.xyz = g_LightDiffuse.xyz * r2.xyz;
  r2.xyz = r2.xyz * r0.www;
  r5.xyzw = _tex8.Sample(_tex8_s, v1.xy).xyzw;
  r5.xyz = r5.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.w = saturate(dot(r3.xyz, r5.xyz));
  r0.w = r1.w + -r0.w;
  r0.w = max(0, r0.w);
  r0.w = sqrt(r0.w);
  r0.w = r0.w * r5.w;
  r0.w = saturate(SSDOParams.x * r0.w);
  r0.w = 1 + -r0.w;
  r2.xyz = r2.xyz * r0.www;
  o0.xyz = r2.xyz;
  r2.xyz = g_LightDiffuse.www * r2.xyz;
  o0.w = 0;
  r0.w = dot(-r0.xyz, -r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = -r0.xyz * r0.www + r3.xyz;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r0.x = saturate(dot(r1.xyz, r0.xyz));
  r0.x = log2(r0.x);
  r0.x = r4.y * r0.x;
  r0.x = exp2(r0.x);
  r0.x = r4.x * 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:29:19 2015
//
//
// Buffer Definitions: 
//
// cbuffer PER_BATCH
// {
//
//   float4 g_LightPos;                 // Offset:    0 Size:    16
//   float4 g_LightDiffuse;             // Offset:   16 Size:    16
//   row_major float4x4 g_mLightProj;   // Offset:   32 Size:    64
//   float4 vWBasisX;                   // Offset:   96 Size:    16 [unused]
//   float4 vWBasisY;                   // Offset:  112 Size:    16 [unused]
//   float4 vWBasisZ;                   // Offset:  128 Size:    16 [unused]
//   float4 irreg_kernel_2d[8];         // Offset:  144 Size:   128 [unused]
//   float4 SSDOParams;                 // Offset:  272 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _tex0                             sampler      NA          NA    0        1
// _tex1                             sampler      NA          NA    1        1
// _tex2                             sampler      NA          NA    2        1
// _tex8                             sampler      NA          NA    8        1
// _tex0                             texture  float4          2d    0        1
// _tex1                             texture  float4          2d    1        1
// _tex2                             texture  float4          2d    2        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       
// TEXCOORD                 0   xyzw        1     NONE   float   xy  
// TEXCOORD                 1   xyzw        2     NONE   float   xyz 
//
//
// 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[18], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, 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) t2
dcl_resource_texture2d (float,float,float,float) t8
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 6
mov r0.w, l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r1.x, v1.xyxx, t0.xyzw, s0
mul r0.xyz, r1.xxxx, v2.xyzx
mad r1.xyz, -r1.xxxx, v2.xyzx, cb0[0].xyzx
dp4 r2.x, cb0[2].xyzw, r0.xyzw
dp4 r2.y, cb0[3].xyzw, r0.xyzw
dp4 r0.w, cb0[5].xyzw, r0.xyzw
div r2.xy, r2.xyxx, r0.wwww
sample_l_indexable(texture2d)(float,float,float,float) r2.xyz, r2.xyxx, t2.xyzw, s2, l(0.000000)
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, r1.xyzx
mul r1.xyz, r1.xyzx, cb0[0].wwww
dp3 r0.w, r1.xyzx, r1.xyzx
add r0.w, -r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, v1.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 r4.xy, r1.wwww, l(40.584526, 255.000000, 0.000000, 0.000000), l(0.318310, 0.000001, 0.000000, 0.000000)
dp3 r1.w, r1.xyzx, r1.xyzx
rsq r1.w, r1.w
mul r1.xyz, r1.wwww, r1.xyzx
dp3_sat r1.w, r3.xyzx, r1.xyzx
mul r2.xyz, r2.xyzx, r1.wwww
mul r2.xyz, r2.xyzx, cb0[1].xyzx
mul r2.xyz, r0.wwww, r2.xyzx
sample_indexable(texture2d)(float,float,float,float) r5.xyzw, v1.xyxx, t8.xyzw, s8
mad r5.xyz, r5.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
dp3_sat r0.w, r3.xyzx, r5.xyzx
add r0.w, -r0.w, r1.w
max r0.w, r0.w, l(0.000000)
sqrt r0.w, r0.w
mul r0.w, r5.w, r0.w
mul_sat r0.w, r0.w, cb0[17].x
add r0.w, -r0.w, l(1.000000)
mul r2.xyz, r0.wwww, r2.xyzx
mov o0.xyz, r2.xyzx
mul r2.xyz, r2.xyzx, cb0[1].wwww
mov o0.w, l(0)
dp3 r0.w, -r0.xyzx, -r0.xyzx
rsq r0.w, r0.w
mad r0.xyz, -r0.xyzx, r0.wwww, r3.xyzx
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3_sat r0.x, r1.xyzx, r0.xyzx
log r0.x, r0.x
mul r0.x, r0.x, r4.y
exp r0.x, r0.x
mul r0.x, r0.x, r4.x
mul o1.xyz, r0.xxxx, r2.xyzx
mov o1.w, l(0)
ret 
// Approximately 53 instruction slots used

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