// HUD: Crosshair and Gun info

cbuffer cVSObject : register(b5)
{

  struct
  {
    float4x4 m_viewWorld;
    float4x4 m_world;
    float4 m_useWeightCount;
    float4 m_localParam[4];
  } g_vsObject : packoffset(c0);

}

cbuffer cVSLight : register(b3)
{

  struct
  {
    float4 m_lightDir0;
    float4 m_lightColor0;
    float4 m_lightColor1;
    float4 m_lightSourcePos;
    float4 m_lightSourceColor;
    float4 m_lightSourceDir;
    float4 m_lightSourceParam1;
    float4 m_lightSourceParam2;
    float4 m_lightSourceParam3;
    float4 m_lightPos0;
    float4 m_lightParam2;
  } g_vsLight : packoffset(c0);

}

cbuffer cVSMaterial : register(b4)
{

  struct
  {
    float4 m_materials[8];
  } g_vsMaterial : packoffset(c0);

}

cbuffer cVSWork : register(b7)
{

  struct
  {
    float4x4 m_viewInverse;
    float4x4 m_matrix[8];
  } g_vsWork : packoffset(c0);

}



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

#include <ShaderFixes/crosshair.hlsl>

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

  r0.xyz = v0.xyz;
  r0.w = 1;
  r1.x = dot(r0.xyzw, g_vsObject.m_world._m00_m10_m20_m30);
  r1.y = dot(r0.xyzw, g_vsObject.m_world._m01_m11_m21_m31);
  r1.z = dot(r0.xyzw, g_vsObject.m_world._m02_m12_m22_m32);
  r1.w = dot(r0.xyzw, g_vsObject.m_world._m03_m13_m23_m33);
  r0.x = dot(r1.xyzw, g_vsWork.m_matrix[0]._m00_m10_m20_m30);
  r0.y = dot(r1.xyzw, g_vsWork.m_matrix[0]._m01_m11_m21_m31);
  r0.z = dot(r1.xyzw, g_vsWork.m_matrix[0]._m02_m12_m22_m32);
  o0.w = dot(r1.xyzw, g_vsWork.m_matrix[0]._m03_m13_m23_m33);
  o0.xyz = r0.xyz * g_vsObject.m_localParam[0].xyz + g_vsObject.m_localParam[1].xyz;
  o1.xyzw = g_vsLight.m_lightColor0.xyzw * v1.xyzw;
  r0.xy = -g_vsMaterial.m_materials[0].xy + v2.xy;
  r0.xy = r0.xy * g_vsMaterial.m_materials[1].xy + g_vsMaterial.m_materials[0].xy;
  o2.xy = g_vsMaterial.m_materials[0].zw + r0.xy;
  r0.xy = -g_vsMaterial.m_materials[1].zw + v2.xy;
  r0.xy = r0.xy * g_vsMaterial.m_materials[2].zw + g_vsMaterial.m_materials[1].zw;
  p2.xy = g_vsMaterial.m_materials[2].xy + r0.xy;
  r0.xy = -g_vsMaterial.m_materials[3].xy + v2.xy;
  r0.xy = r0.xy * g_vsMaterial.m_materials[4].xy + g_vsMaterial.m_materials[3].xy;
  o3.xy = g_vsMaterial.m_materials[3].zw + r0.xy;
  
  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 * iniParams.x; //Croshhair
  o0.x += adjust_from_depth_buffer(0, 0);
  }
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.25 on Wed Jan 20 12:06:54 2016
//
//
// Buffer Definitions: 
//
// cbuffer cVSObject
// {
//
//   struct VSObject
//   {
//       
//       float4x4 m_viewWorld;          // Offset:    0
//       float4x4 m_world;              // Offset:   64
//       float4 m_useWeightCount;       // Offset:  128
//       float4 m_localParam[4];        // Offset:  144
//
//   } g_vsObject;                      // Offset:    0 Size:   208
//
// }
//
// cbuffer cVSLight
// {
//
//   struct VSLight
//   {
//       
//       float4 m_lightDir0;            // Offset:    0
//       float4 m_lightColor0;          // Offset:   16
//       float4 m_lightColor1;          // Offset:   32
//       float4 m_lightSourcePos;       // Offset:   48
//       float4 m_lightSourceColor;     // Offset:   64
//       float4 m_lightSourceDir;       // Offset:   80
//       float4 m_lightSourceParam1;    // Offset:   96
//       float4 m_lightSourceParam2;    // Offset:  112
//       float4 m_lightSourceParam3;    // Offset:  128
//       float4 m_lightPos0;            // Offset:  144
//       float4 m_lightParam2;          // Offset:  160
//
//   } g_vsLight;                       // Offset:    0 Size:   176
//
// }
//
// cbuffer cVSMaterial
// {
//
//   struct VSMaterial
//   {
//       
//       float4 m_materials[8];         // Offset:    0
//
//   } g_vsMaterial;                    // Offset:    0 Size:   128
//
// }
//
// cbuffer cVSWork
// {
//
//   struct VSWork
//   {
//       
//       float4x4 m_viewInverse;        // Offset:    0
//       float4x4 m_matrix[8];          // Offset:   64
//
//   } g_vsWork;                        // Offset:    0 Size:   576
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cVSLight                          cbuffer      NA          NA    3        1
// cVSMaterial                       cbuffer      NA          NA    4        1
// cVSObject                         cbuffer      NA          NA    5        1
// cVSWork                           cbuffer      NA          NA    7        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy  
//
//
// 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   xy          2     NONE   float   xy  
// TEXCOORD                 1     zw        2     NONE   float     zw
// TEXCOORD                 2   xy          3     NONE   float   xy  
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb5[11], immediateIndexed
dcl_constantbuffer cb3[2], immediateIndexed
dcl_constantbuffer cb4[5], immediateIndexed
dcl_constantbuffer cb7[8], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o2.zw
dcl_output o3.xy
dcl_temps 2
mov r0.xyz, v0.xyzx
mov r0.w, l(1.000000)
dp4 r1.x, r0.xyzw, cb5[4].xyzw
dp4 r1.y, r0.xyzw, cb5[5].xyzw
dp4 r1.z, r0.xyzw, cb5[6].xyzw
dp4 r1.w, r0.xyzw, cb5[7].xyzw
dp4 r0.x, r1.xyzw, cb7[4].xyzw
dp4 r0.y, r1.xyzw, cb7[5].xyzw
dp4 r0.z, r1.xyzw, cb7[6].xyzw
dp4 o0.w, r1.xyzw, cb7[7].xyzw
mad o0.xyz, r0.xyzx, cb5[9].xyzx, cb5[10].xyzx
mul o1.xyzw, v1.xyzw, cb3[1].xyzw
add r0.xy, v2.xyxx, -cb4[0].xyxx
mad r0.xy, r0.xyxx, cb4[1].xyxx, cb4[0].xyxx
add o2.xy, r0.xyxx, cb4[0].zwzz
add r0.xy, v2.xyxx, -cb4[1].zwzz
mad r0.xy, r0.xyxx, cb4[2].zwzz, cb4[1].zwzz
add o2.zw, r0.xxxy, cb4[2].xxxy
add r0.xy, v2.xyxx, -cb4[3].xyxx
mad r0.xy, r0.xyxx, cb4[4].xyxx, cb4[3].xyxx
add o3.xy, r0.xyxx, cb4[3].zwzz
ret 
// Approximately 22 instruction slots used

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