//Reflections
cbuffer _Globals : register(b4)
{
  float2 gm_vTextureSizeInv : packoffset(c0);
  float1 Lighting_01_SpecularPower : packoffset(c0.z);
  float1 Detail_01_BumpScale : packoffset(c0.w);
  float4 gm_mTextureTransform_01[2] : packoffset(c1);
  float1 TextureNormal_01_BumpScale : packoffset(c3);
  float4 Multiply_01_V2 : packoffset(c4);
  float1 ColorScale_01_Scale : packoffset(c5);
  float1 ColorScale_02_Scale : packoffset(c5.y);
}

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);

}
SamplerState samplerReflection2D_s : register(s0);
Texture2D<float4> mapReflection2D : register(t0);

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

void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD2,
  float4 v3 : TEXCOORD3,
  float4 v4 : TEXCOORD4,
  float4 v5 : TEXCOORD5,
  float4 v6 : TEXCOORD6,
  float4 v7 : TEXCOORD7,
  out float4 o0 : SV_TARGET0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);
  v1.x -= -stereo.x * (v1.z/2 - stereo.y/2) / cbSharedPerViewData.mProjection._m00 * (stereo.y/2);
  
  
   
  
  r0.xyz = cbSharedPerViewData.mViewToViewport._m10_m11_m13 * v1.yyy;
  r0.xyz = v1.xxx * cbSharedPerViewData.mViewToViewport._m00_m01_m03 + r0.xyz;
  r0.xyz = v1.zzz * cbSharedPerViewData.mViewToViewport._m20_m21_m23 + r0.xyz;
  r0.xyz = v1.www * cbSharedPerViewData.mViewToViewport._m30_m31_m33 + r0.xyz;
  
  r0.xy = r0.xy / r0.zz;
  r0.z = 1 + -r0.x;
  r0.xyzw = mapReflection2D.Sample(samplerReflection2D_s, r0.zy).xyzw;
  
  r0.xyz = r0.xyz * r0.xyz;
  o0.xyz = ColorScale_02_Scale * r0.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.6 on Tue Nov 10 19:11:11 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 gm_vTextureSizeInv;         // Offset:    0 Size:     8 [unused]
//   float1 Lighting_01_SpecularPower;  // Offset:    8 Size:     4 [unused]
//   float1 Detail_01_BumpScale;        // Offset:   12 Size:     4 [unused]
//   float4 gm_mTextureTransform_01[2]; // Offset:   16 Size:    32 [unused]
//   float1 TextureNormal_01_BumpScale; // Offset:   48 Size:     4 [unused]
//   float4 Multiply_01_V2;             // Offset:   64 Size:    16 [unused]
//   float1 ColorScale_01_Scale;        // Offset:   80 Size:     4 [unused]
//   float1 ColorScale_02_Scale;        // Offset:   84 Size:     4
//
// }
//
// 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
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerReflection2D               sampler      NA          NA    0        1
// mapReflection2D                   texture  float4          2d    0        1
// _cbSharedPerViewData              cbuffer      NA          NA    1        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                 2   xyzw        2     NONE   float       
// TEXCOORD                 3   xyzw        3     NONE   float       
// TEXCOORD                 4   xyzw        4     NONE   float       
// TEXCOORD                 5   xyzw        5     NONE   float       
// TEXCOORD                 6   xyzw        6     NONE   float       
// TEXCOORD                 7   xyzw        7     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb4[6], immediateIndexed
dcl_constantbuffer cb1[8], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 1
mul r0.xyz, v1.yyyy, cb1[5].xywx
mad r0.xyz, v1.xxxx, cb1[4].xywx, r0.xyzx
mad r0.xyz, v1.zzzz, cb1[6].xywx, r0.xyzx
mad r0.xyz, v1.wwww, cb1[7].xywx, r0.xyzx
div r0.xy, r0.xyxx, r0.zzzz
add r0.z, -r0.x, l(1.000000)
sample r0.xyzw, r0.zyzz, t0.xyzw, s0
mul r0.xyz, r0.xyzx, r0.xyzx
mul o0.xyz, r0.xyzx, cb4[5].yyyy
mov o0.w, l(1.000000)
ret 
// Approximately 11 instruction slots used

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