// HUD 2

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_debug;
    float4 defunct;
    float4 vs_cameraOrigin;
    row_major float4x4 vs_invView;
  } g_CameraVS : packoffset(c0);

}

cbuffer g_MaterialVS_CB : register(b1)
{

  struct
  {
    float4 defunct3;
    float4 vs_bitangentFlip;
    float4 vs_misc_params;
    float4 vs_vtf_kOffset_kHeight;
    float4 defunct1;
    float4 defunct2;
    float4 vs_vtf_direction;
    float4 vs_UVMatrix01[4];
    float4 vs_UVMatrix23[4];
    float4 vs_bias;
  } g_MaterialVS : packoffset(c0);

}

cbuffer g_FogTexVS_CB : register(b2)
{

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

}

cbuffer g_InstanceVS_CB : register(b3)
{

  struct
  {
    row_major float4x4 vs_world[64];
  } g_InstanceVS : packoffset(c0);

}

cbuffer g_MiscGroup1VS_Frequent_CB : register(b4)
{

  struct
  {
    float4 vs_defunct1;
    float4 vs_kTint;
    float4 vs_random;
    float4 vs_fastBlendWeights;
  } g_MiscGroup1VS_Frequent : packoffset(c0);

}



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

void main(
  float4 v0 : POSITION0,
  float4 v1 : NORMAL0,
  float2 v2 : TEXCOORD0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : COLOR0,
  out float4 o3 : COLOR1)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = g_InstanceVS.vs_world[0]._m10_m11_m12 * v0.yyy;
  r0.xyz = v0.xxx * g_InstanceVS.vs_world[0]._m00_m01_m02 + r0.xyz;
  r0.xyz = v0.zzz * g_InstanceVS.vs_world[0]._m20_m21_m22 + r0.xyz;
  r0.xyz = g_InstanceVS.vs_world[0]._m30_m31_m32 + r0.xyz;
  r1.xyzw = g_CameraVS.vs_viewProj._m10_m11_m12_m13 * r0.yyyy;
  r1.xyzw = r0.xxxx * g_CameraVS.vs_viewProj._m00_m01_m02_m03 + r1.xyzw;
  r1.xyzw = r0.zzzz * g_CameraVS.vs_viewProj._m20_m21_m22_m23 + r1.xyzw;
  o0.xyzw = g_CameraVS.vs_viewProj._m30_m31_m32_m33 + r1.xyzw;
  r0.xzw = -g_CameraVS.vs_worldCamPos.xyz + r0.xyz;
  r0.y = saturate(-r0.y * 0.00100000005 + 1);
  r1.x = r0.z * g_FogTexVS.vs_fog_tex_params2.x + g_FogTexVS.vs_fog_tex_params.z;
  r1.x = max(1, r1.x);
  r1.x = log2(r1.x);
  o1.w = saturate(r1.x * g_FogTexVS.vs_fog_tex_params.w + g_FogTexVS.vs_fog_tex_params.y);
  r1.x = dot(r0.xzw, r0.xzw);
  r1.y = sqrt(r1.x);
  r1.x = rsqrt(r1.x);
  r0.xw = r1.xx * r0.wx;
  r0.z = r0.z * g_FogTexVS.vs_fog_2_tex_params2.x + g_FogTexVS.vs_fog_2_tex_params.z;
  r0.z = max(1, r0.z);
  r0.z = log2(r0.z);
  o3.w = saturate(r0.z * g_FogTexVS.vs_fog_2_tex_params.w + g_FogTexVS.vs_fog_2_tex_params.y);
  r0.xy = r0.xw * r0.yy;
  o3.xy = r0.xy * float2(0.5,0.5) + float2(0.5,0.5);
  r0.x = 1 + r1.y;
  r0.x = log2(r0.x);
  r0.x = 0.0752566829 * r0.x;
  r0.x = min(1, r0.x);
  o1.z = r0.x;
  o3.z = r0.x;
  r0.xy = v2.xy;
  r0.z = 1;
  o1.x = dot(r0.xyz, g_MaterialVS.vs_UVMatrix01[0].xyw);
  o1.y = dot(r0.xyz, g_MaterialVS.vs_UVMatrix01[1].xyw);
  o2.xyz = saturate(g_MiscGroup1VS_Frequent.vs_kTint.xyz);
  o2.w = g_MiscGroup1VS_Frequent.vs_kTint.w * v1.w;
  
  //Fix
  float4 stereo = StereoParams.Load(0);
  float4 iniParams = IniParams.Load(0);
    
  float4 tex_filter = IniParams.Load(int2(2,0));
  if (tex_filter.x == 2)
	{
		o0.x -= stereo.x * (o0.w - stereo.y) - adjust_from_depth_buffer(o0.x,o0.y);
	}
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.3.11 on Sun Jun 24 17:31:07 2018
//
//
// 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_debug;               // Offset:  176
//       float4 defunct;                // Offset:  192
//       float4 vs_cameraOrigin;        // Offset:  208
//       row_major float4x4 vs_invView; // Offset:  224
//
//   } g_CameraVS;                      // Offset:    0 Size:   288
//
// }
//
// cbuffer g_MaterialVS_CB
// {
//
//   struct MaterialVS
//   {
//
//       float4 defunct3;               // Offset:    0
//       float4 vs_bitangentFlip;       // Offset:   16
//       float4 vs_misc_params;         // Offset:   32
//       float4 vs_vtf_kOffset_kHeight; // Offset:   48
//       float4 defunct1;               // Offset:   64
//       float4 defunct2;               // Offset:   80
//       float4 vs_vtf_direction;       // Offset:   96
//       float4 vs_UVMatrix01[4];       // Offset:  112
//       float4 vs_UVMatrix23[4];       // Offset:  176
//       float4 vs_bias;                // Offset:  240
//
//   } g_MaterialVS;                    // Offset:    0 Size:   256
//
// }
//
// cbuffer g_FogTexVS_CB
// {
//
//   struct FogTexVS
//   {
//
//       float4 vs_fog_tex_params;      // Offset:    0
//       float4 vs_fog_tex_params2;     // Offset:   16
//       float4 vs_fog_2_tex_params;    // Offset:   32
//       float4 vs_fog_2_tex_params2;   // Offset:   48
//
//   } g_FogTexVS;                      // Offset:    0 Size:    64
//
// }
//
// cbuffer g_InstanceVS_CB
// {
//
//   struct InstanceVS
//   {
//
//       row_major float4x4 vs_world[64];// Offset:    0
//
//   } g_InstanceVS;                    // Offset:    0 Size:  4096
//
// }
//
// cbuffer g_MiscGroup1VS_Frequent_CB
// {
//
//   struct MiscGroup1VS_Frequent
//   {
//
//       float4 vs_defunct1;            // Offset:    0
//       float4 vs_kTint;               // Offset:   16
//       float4 vs_random;              // Offset:   32
//       float4 vs_fastBlendWeights;    // Offset:   48
//
//   } g_MiscGroup1VS_Frequent;         // Offset:    0 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_CameraVS_CB                     cbuffer      NA          NA    0        1
// g_MaterialVS_CB                   cbuffer      NA          NA    1        1
// g_FogTexVS_CB                     cbuffer      NA          NA    2        1
// g_InstanceVS_CB                   cbuffer      NA          NA    3        1
// g_MiscGroup1VS_Frequent_CB        cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// NORMAL                   0   xyzw        1     NONE   float      w
// TEXCOORD                 0   xy          2     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// COLOR                    0   xyzw        2     NONE   float   xyzw
// COLOR                    1   xyzw        3     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[9], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[4], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_constantbuffer cb4[2], immediateIndexed
dcl_input v0.xyz
dcl_input v1.w
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 2
mul r0.xyz, v0.yyyy, cb3[1].xyzx
mad r0.xyz, v0.xxxx, cb3[0].xyzx, r0.xyzx
mad r0.xyz, v0.zzzz, cb3[2].xyzx, r0.xyzx
add r0.xyz, r0.xyzx, cb3[3].xyzx
mul r1.xyzw, r0.yyyy, cb0[1].xyzw
mad r1.xyzw, r0.xxxx, cb0[0].xyzw, r1.xyzw
mad r1.xyzw, r0.zzzz, cb0[2].xyzw, r1.xyzw
add o0.xyzw, r1.xyzw, cb0[3].xyzw
add r0.xzw, r0.xxyz, -cb0[8].xxyz
mad_sat r0.y, -r0.y, l(0.001000), l(1.000000)
mad r1.x, r0.z, cb2[1].x, cb2[0].z
max r1.x, r1.x, l(1.000000)
log r1.x, r1.x
mad_sat o1.w, r1.x, cb2[0].w, cb2[0].y
dp3 r1.x, r0.xzwx, r0.xzwx
sqrt r1.y, r1.x
rsq r1.x, r1.x
mul r0.xw, r0.wwwx, r1.xxxx
mad r0.z, r0.z, cb2[3].x, cb2[2].z
max r0.z, r0.z, l(1.000000)
log r0.z, r0.z
mad_sat o3.w, r0.z, cb2[2].w, cb2[2].y
mul r0.xy, r0.yyyy, r0.xwxx
mad o3.xy, r0.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
add r0.x, r1.y, l(1.000000)
log r0.x, r0.x
mul r0.x, r0.x, l(0.0752566829)
min r0.x, r0.x, l(1.000000)
mov o1.z, r0.x
mov o3.z, r0.x
mov r0.xy, v2.xyxx
mov r0.z, l(1.000000)
dp3 o1.x, r0.xyzx, cb1[7].xywx
dp3 o1.y, r0.xyzx, cb1[8].xywx
mov_sat o2.xyz, cb4[1].xyzx
mul o2.w, v1.w, cb4[1].w
ret
// Approximately 37 instruction slots used

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