// ---- Created with 3Dmigoto v1.2.39 on Fri Jul 01 18:52:22 2016

cbuffer g_CameraVS_CB : register(b0)
{

  struct
  {
    row_major float4x4 vs_viewProj;
    row_major float4x4 vs_view;
    float4 vs_worldCamPos;
    float4 vs_projection_params;
    float4 vs_inverse_projection_xy;
    float4 vs_frustum_params;
    float4 vs_inverse_projection2;
    float4 vs_cameraOrigin;
  } g_CameraVS : packoffset(c0);

}

cbuffer g_FogTexVS_CB : register(b1)
{

  struct
  {
    float4 vs_fog_tex_params;
  } g_FogTexVS : packoffset(c0);

}

cbuffer g_MiscGroup1VS_Frequent_CB : register(b2)
{

  struct
  {
    float4 vs_lightmapOffset;
    float4 vs_kTint;
    float4 vs_defunct;
    float4 vs_fastBlendWeights;
  } g_MiscGroup1VS_Frequent : packoffset(c0);

}

cbuffer g_MiscGroup2VS_Infrequent_CB : register(b3)
{

  struct
  {
    float4 vs_wind_params;
    float4 vs_screenSize;
    float4 vs_viewportScaleBias;
    float4 vs_halfPixelOffset;
    float4 vs_screenDoorScaleBias;
  } g_MiscGroup2VS_Infrequent : packoffset(c0);

}

cbuffer g_DebrisFadePlaneVS_CB : register(b4)
{

  struct
  {
    float4 plane;
  } g_DebrisFadePlaneVS : packoffset(c0);

}



// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : POSITION0,
  float3 v1 : TEXCOORD0,
  float4 v2 : COLOR0,
  float3 v3 : TEXCOORD1,
  out float4 o0 : SV_Position0,
  out float4 o1 : COLOR0,
  out float4 o2 : TEXCOORD0,
  out float4 o3 : COLOR1,
  out float4 o4 : TEXCOORD1,
  out float4 o5 : TEXCOORD2,
  out float4 o6 : TEXCOORD3)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = g_CameraVS.vs_viewProj._m10_m11_m12_m13 * v0.yyyy;
  r0.xyzw = v0.xxxx * g_CameraVS.vs_viewProj._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v0.zzzz * g_CameraVS.vs_viewProj._m20_m21_m22_m23 + r0.xyzw;
  r0.xyzw = v0.wwww * g_CameraVS.vs_viewProj._m30_m31_m32_m33 + r0.xyzw;
  o0.xyzw = r0.xyzw;
  
  float4 stereo = StereoParams.Load(0);
  r0.x += stereo.x * (r0.w - stereo.y);
  
  o1.xyzw = g_MiscGroup1VS_Frequent.vs_kTint.xyzw * v2.xyzw;
  o2.xy = v1.xy;
  o2.zw = g_CameraVS.vs_projection_params.xw;
  r1.x = saturate(-v0.y * g_FogTexVS.vs_fog_tex_params.x + 1);
  r1.yzw = -g_CameraVS.vs_worldCamPos.xyz + v0.xyz;
  r2.x = dot(r1.yzw, r1.yzw);
  r2.y = rsqrt(r2.x);
  r2.x = sqrt(r2.x);
  r2.x = 1 + r2.x;
  r2.x = log2(r2.x);
  r2.x = 0.0752566829 * r2.x;
  o3.y = min(1, r2.x);
  r1.yw = r2.yy * r1.yw;
  r1.z = g_FogTexVS.vs_fog_tex_params.z + r1.z;
  r1.z = max(1, r1.z);
  r1.z = log2(r1.z);
  o3.x = saturate(r1.z * g_FogTexVS.vs_fog_tex_params.w + g_FogTexVS.vs_fog_tex_params.y);
  r1.xy = r1.yw * r1.xx;
  o3.zw = r1.xy * float2(0.5,0.5) + float2(0.5,0.5);
  r0.xy = r0.xy / r0.ww;
  r0.xy = r0.xy * float2(0.5,-0.5) + float2(0.5,0.5);
  r0.xy = r0.xy * g_MiscGroup2VS_Infrequent.vs_viewportScaleBias.zw + g_MiscGroup2VS_Infrequent.vs_viewportScaleBias.xy;
  o4.xy = r0.xy;
  o6.xyzw = r0.xyzw;
  o4.z = v1.z;
  o4.w = 0;
  o5.xyzw = g_DebrisFadePlaneVS.plane.xyzw / abs(v1.zzzz);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.39 on Fri Jul 01 18:52:22 2016
//
//
// Buffer Definitions: 
//
// cbuffer g_CameraVS_CB
// {
//
//   struct CameraVS
//   {
//       
//       row_major float4x4 vs_viewProj;// Offset:    0
//       row_major float4x4 vs_view;    // Offset:   64
//       float4 vs_worldCamPos;         // Offset:  128
//       float4 vs_projection_params;   // Offset:  144
//       float4 vs_inverse_projection_xy;// Offset:  160
//       float4 vs_frustum_params;      // Offset:  176
//       float4 vs_inverse_projection2; // Offset:  192
//       float4 vs_cameraOrigin;        // Offset:  208
//
//   } g_CameraVS;                      // Offset:    0 Size:   224
//
// }
//
// cbuffer g_FogTexVS_CB
// {
//
//   struct FogTexVS
//   {
//       
//       float4 vs_fog_tex_params;      // Offset:    0
//
//   } g_FogTexVS;                      // Offset:    0 Size:    16
//
// }
//
// cbuffer g_MiscGroup1VS_Frequent_CB
// {
//
//   struct MiscGroup1VS_Frequent
//   {
//       
//       float4 vs_lightmapOffset;      // Offset:    0
//       float4 vs_kTint;               // Offset:   16
//       float4 vs_defunct;             // Offset:   32
//       float4 vs_fastBlendWeights;    // Offset:   48
//
//   } g_MiscGroup1VS_Frequent;         // Offset:    0 Size:    64
//
// }
//
// cbuffer g_MiscGroup2VS_Infrequent_CB
// {
//
//   struct MiscGroup2VS_Infrequent
//   {
//       
//       float4 vs_wind_params;         // Offset:    0
//       float4 vs_screenSize;          // Offset:   16
//       float4 vs_viewportScaleBias;   // Offset:   32
//       float4 vs_halfPixelOffset;     // Offset:   48
//       float4 vs_screenDoorScaleBias; // Offset:   64
//
//   } g_MiscGroup2VS_Infrequent;       // Offset:    0 Size:    80
//
// }
//
// cbuffer g_DebrisFadePlaneVS_CB
// {
//
//   struct DebrisFadePlaneVS
//   {
//       
//       float4 plane;                  // Offset:    0
//
//   } g_DebrisFadePlaneVS;             // Offset:    0 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_CameraVS_CB                     cbuffer      NA          NA    0        1
// g_FogTexVS_CB                     cbuffer      NA          NA    1        1
// g_MiscGroup1VS_Frequent_CB        cbuffer      NA          NA    2        1
// g_MiscGroup2VS_Infrequent_CB      cbuffer      NA          NA    3        1
// g_DebrisFadePlaneVS_CB            cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz 
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 1   xyz         3     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xyzw        2     NONE   float   xyzw
// COLOR                    1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xyzw        5     NONE   float   xyzw
// TEXCOORD                 3   xyzw        6     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[10], immediateIndexed
dcl_constantbuffer cb1[1], immediateIndexed
dcl_constantbuffer cb2[2], immediateIndexed
dcl_constantbuffer cb3[3], immediateIndexed
dcl_constantbuffer cb4[1], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_temps 3
mul r0.xyzw, v0.yyyy, cb0[1].xyzw
mad r0.xyzw, v0.xxxx, cb0[0].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb0[2].xyzw, r0.xyzw
mad r0.xyzw, v0.wwww, cb0[3].xyzw, r0.xyzw
mov o0.xyzw, r0.xyzw
mul o1.xyzw, v2.xyzw, cb2[1].xyzw
mov o2.xy, v1.xyxx
mov o2.zw, cb0[9].xxxw
mad_sat r1.x, -v0.y, cb1[0].x, l(1.000000)
add r1.yzw, v0.xxyz, -cb0[8].xxyz
dp3 r2.x, r1.yzwy, r1.yzwy
rsq r2.y, r2.x
sqrt r2.x, r2.x
add r2.x, r2.x, l(1.000000)
log r2.x, r2.x
mul r2.x, r2.x, l(0.0752566829)
min o3.y, r2.x, l(1.000000)
mul r1.yw, r1.yyyw, r2.yyyy
add r1.z, r1.z, cb1[0].z
max r1.z, r1.z, l(1.000000)
log r1.z, r1.z
mad_sat o3.x, r1.z, cb1[0].w, cb1[0].y
mul r1.xy, r1.xxxx, r1.ywyy
mad o3.zw, r1.xxxy, l(0.000000, 0.000000, 0.500000, 0.500000), l(0.000000, 0.000000, 0.500000, 0.500000)
div r0.xy, r0.xyxx, r0.wwww
mad r0.xy, r0.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mad r0.xy, r0.xyxx, cb3[2].zwzz, cb3[2].xyxx
mov o4.xy, r0.xyxx
mov o6.xyzw, r0.xyzw
mov o4.z, v1.z
mov o4.w, l(0)
div o5.xyzw, cb4[0].xyzw, |v1.zzzz|
ret 
// Approximately 33 instruction slots used

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