//AO?
//VS acb0e0fe3c8befcb
cbuffer _Globals : register(b4)
{
  float2 gm_vTextureSizeInv : packoffset(c0);
  float3 gd_vEyeUpperLeft : packoffset(c1);
  float3 gd_vEyeLowerRight : packoffset(c2);
  row_major float4x4 gm_mProjectionT : packoffset(c3);
  row_major float4x4 gm_mProjectionTI : packoffset(c7);
  float4 g_vParams0 : packoffset(c11);
  float4 g_vParams1 : packoffset(c12);
  float4 g_vParams2 : packoffset(c13);
  float4 g_vParams3 : packoffset(c14);
  float4 g_vParamsPC : packoffset(c15);
}

cbuffer _cbSharedPerViewData : register(b1)
{

  struct
  {
    row_major float4x4 mProjection;
    row_major float4x4 mViewToViewport;
    row_major float4x4 mViewToWorld;
    float4 vViewRemap;
    float4 vViewDepthRemap;
    float4 vEyeVectorUL;
    float4 vEyeVectorLR;
    float4 v4ShadowRange;
    float4 vViewSpaceUpVector;
    float4 vGlobalLitFactor;
    float4 vViewportSize;
    float4 vEngineTime;
    float4 vShaderColor0;
    float4 vShaderColor1;
    float4 vShaderColor2;
    float4 vShaderColor3;
    float4 vShaderColor4;
    float4 vClipPlane;
  } cbSharedPerViewData : packoffset(c0);

}

cbuffer _cbSharedLightData : register(b2)
{

  struct
  {
    float4 vParams0;
    float4 vParams1;
    float4 vParams2;
    float4 vLightDiffuse;
    float4 vHalfLightBoxFadeNeg;
    float4 vHalfLightBoxFadePos;
    float4 vRcpLightBoxFadeNeg;
    float4 vRcpLightBoxFadePos;
    float4 vLightPosView;
    float4 vLightDirView;
    float4 vProjectorTilingOffset;
    row_major float4x4 mViewToShadowProjTrans;
    row_major float4x4 mViewToLightProjTrans;
    float4 vLightParams;
    float4 vRestrictLightBoxVectorX;
    float4 vRestrictLightBoxVectorY;
    float4 vRestrictLightBoxVectorZ;
    float4 vRestrictLightBoxPosition;
  } cbSharedLightData : packoffset(c0);

}
SamplerState samplerShadowColorPointSampled_s : register(s0);
Texture2D<float4> mapShadowColorPointSampled : register(t0);

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

void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  uint v3 : SV_SampleIndex0,
  out float4 o0 : SV_TARGET0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

   
  
  r0.xy = v1.xy / v1.ww;
  r1.xy = mapShadowColorPointSampled.Sample(samplerShadowColorPointSampled_s, r0.xy).zw;
  r0.w = dot(r1.xy, float2(1,0.00392156886));
  
  r0.w = cbSharedPerViewData.vViewRemap.w * r0.w;
  
  //float4 stereo = StereoParams.Load(0);
  //r0.x -= stereo.x * (r0.w - stereo.y) / cbSharedLightData.vLightDirView.x;
  
  
  r1.xyz = gd_vEyeLowerRight.xyz + -gd_vEyeUpperLeft.xyz;
  r0.z = 1;
  r0.xyz = r0.xyz * r1.xyz + gd_vEyeUpperLeft.xyz;
  r1.xyz = r0.xyz * r0.www + -cbSharedLightData.vLightPosView.xyz;
  
  r1.x = dot(r1.xyz, cbSharedLightData.vHalfLightBoxFadeNeg.xyz);
  r1.x = max(-cbSharedLightData.vHalfLightBoxFadeNeg.w, r1.x);
  r1.x = min(cbSharedLightData.vHalfLightBoxFadeNeg.w, r1.x);
  r1.xyz = cbSharedLightData.vHalfLightBoxFadeNeg.xyz * r1.xxx + cbSharedLightData.vLightPosView.xyz;
  r0.xyz = -r0.xyz * r0.www + r1.xyz;
  r0.x = dot(r0.xyz, r0.xyz);
  r0.x = sqrt(r0.x);
  r0.xy = saturate(cbSharedLightData.vParams0.yw * r0.xx + cbSharedLightData.vParams0.xz);
  r0.x = r0.x * r0.y;
  o0.xyz = cbSharedLightData.vLightDiffuse.xyz * r0.xxx;
  o0.w = 1;
  
  //o0 = 0;
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.6 on Sat Nov 07 09:32:13 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 gm_vTextureSizeInv;         // Offset:    0 Size:     8 [unused]
//   float3 gd_vEyeUpperLeft;           // Offset:   16 Size:    12
//   float3 gd_vEyeLowerRight;          // Offset:   32 Size:    12
//   row_major float4x4 gm_mProjectionT;// Offset:   48 Size:    64 [unused]
//   row_major float4x4 gm_mProjectionTI;// Offset:  112 Size:    64 [unused]
//   float4 g_vParams0;                 // Offset:  176 Size:    16 [unused]
//   float4 g_vParams1;                 // Offset:  192 Size:    16 [unused]
//   float4 g_vParams2;                 // Offset:  208 Size:    16 [unused]
//   float4 g_vParams3;                 // Offset:  224 Size:    16 [unused]
//   float4 g_vParamsPC;                // Offset:  240 Size:    16 [unused]
//
// }
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct
//   {
//       
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mViewToViewport;// Offset:   64
//       row_major float4x4 mViewToWorld;// Offset:  128
//       float4 vViewRemap;             // Offset:  192
//       float4 vViewDepthRemap;        // Offset:  208
//       float4 vEyeVectorUL;           // Offset:  224
//       float4 vEyeVectorLR;           // Offset:  240
//       float4 v4ShadowRange;          // Offset:  256
//       float4 vViewSpaceUpVector;     // Offset:  272
//       float4 vGlobalLitFactor;       // Offset:  288
//       float4 vViewportSize;          // Offset:  304
//       float4 vEngineTime;            // Offset:  320
//       float4 vShaderColor0;          // Offset:  336
//       float4 vShaderColor1;          // Offset:  352
//       float4 vShaderColor2;          // Offset:  368
//       float4 vShaderColor3;          // Offset:  384
//       float4 vShaderColor4;          // Offset:  400
//       float4 vClipPlane;             // Offset:  416
//
//   } cbSharedPerViewData;             // Offset:    0 Size:   432
//
// }
//
// cbuffer _cbSharedLightData
// {
//
//   struct
//   {
//       
//       float4 vParams0;               // Offset:    0
//       float4 vParams1;               // Offset:   16
//       float4 vParams2;               // Offset:   32
//       float4 vLightDiffuse;          // Offset:   48
//       float4 vHalfLightBoxFadeNeg;   // Offset:   64
//       float4 vHalfLightBoxFadePos;   // Offset:   80
//       float4 vRcpLightBoxFadeNeg;    // Offset:   96
//       float4 vRcpLightBoxFadePos;    // Offset:  112
//       float4 vLightPosView;          // Offset:  128
//       float4 vLightDirView;          // Offset:  144
//       float4 vProjectorTilingOffset; // Offset:  160
//       row_major float4x4 mViewToShadowProjTrans;// Offset:  176
//       row_major float4x4 mViewToLightProjTrans;// Offset:  240
//       float4 vLightParams;           // Offset:  304
//       float4 vRestrictLightBoxVectorX;// Offset:  320
//       float4 vRestrictLightBoxVectorY;// Offset:  336
//       float4 vRestrictLightBoxVectorZ;// Offset:  352
//       float4 vRestrictLightBoxPosition;// Offset:  368
//
//   } cbSharedLightData;               // Offset:    0 Size:   384
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerShadowColorPointSampled    sampler      NA          NA    0        1
// mapShadowColorPointSampled        texture  float4          2d    0        1
// _cbSharedPerViewData              cbuffer      NA          NA    1        1
// _cbSharedLightData                cbuffer      NA          NA    2        1
// $Globals                          cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float       
// SV_SampleIndex           0   x           3   SAMPLE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_1
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb4[3], immediateIndexed
dcl_constantbuffer cb1[13], immediateIndexed
dcl_constantbuffer cb2[9], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xyw
dcl_output o0.xyzw
dcl_temps 2
div r0.xy, v1.xyxx, v1.wwww
sample r1.xy, r0.xyxx, t0.zwxy, s0
dp2 r0.w, r1.xyxx, l(1.000000, 0.00392156886, 0.000000, 0.000000)
mul r0.w, r0.w, cb1[12].w
add r1.xyz, -cb4[1].xyzx, cb4[2].xyzx
mov r0.z, l(1.000000)
mad r0.xyz, r0.xyzx, r1.xyzx, cb4[1].xyzx
mad r1.xyz, r0.xyzx, r0.wwww, -cb2[8].xyzx
dp3 r1.x, r1.xyzx, cb2[4].xyzx
max r1.x, r1.x, -cb2[4].w
min r1.x, r1.x, cb2[4].w
mad r1.xyz, cb2[4].xyzx, r1.xxxx, cb2[8].xyzx
mad r0.xyz, -r0.xyzx, r0.wwww, r1.xyzx
dp3 r0.x, r0.xyzx, r0.xyzx
sqrt r0.x, r0.x
mad_sat r0.xy, cb2[0].ywyy, r0.xxxx, cb2[0].xzxx
mul r0.x, r0.y, r0.x
mul o0.xyz, r0.xxxx, cb2[3].xyzx
mov o0.w, l(1.000000)
ret 
// Approximately 20 instruction slots used

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