// HUD 4 VS

cbuffer CBufferGlobalConstant_Z : register(b0)
{

  struct
  {
    float4 c[90];
  } Global : packoffset(c0);

}



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


void main(
  float4 v0 : POSITION0,
  float4 v1 : COLOR0,
  float2 v2 : TEXCOORD0,
  out float4 o0 : SV_Position0,
  out float4 o1 : COLOR0,
  out float4 o2 : TEXCOORD0,
  out float o3 : INSTANCE_COLOR0,
  out uint2 o4 : INSTANCE_INDEXES0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = -Global.c[16].zw + v0.xy;
  r0.xy = r0.xy / Global.c[16].xy;
  r0.z = v0.z * Global.c[52].z + Global.c[52].w;
  o0.xy = r0.xy * r0.zz;
  o0.w = r0.z;
  o0.z = v0.z * Global.c[51].z + Global.c[51].w;
  o1.xyzw = v1.xyzw;
  o2.xy = v2.xy;
  o2.zw = float2(0,0);
  o3.x = 0;
  o4.xy = float2(0,0);
  
  //Fix
  float4 stereo = StereoParams.Load(0);
  float4 iniParams = IniParams.Load(0);
  
  float4 tex_filter = IniParams.Load(int2(2,0));
  float4 tex_filter2 = IniParams.Load(int2(90,0));
      float4 tex_filter5 = IniParams.Load(int2(93,0));

float4 TargetMarkScale = IniParams.Load(int2(95,0));


  if (tex_filter.x != 2)
	  {
	   o0.x -= stereo.x * (o0.w - stereo.y);
	  }
	  
  if (tex_filter.x == 3)
	  {
	   o0.x += stereo.x * iniParams.x;
	  }
  
   if (tex_filter.x == 4)
    {
     o0.x += stereo.x * iniParams.x;
    }

   if (tex_filter.x == 14)
    {
      if(stereo.y>=1.2)
     {
     o0.x += stereo.x * 0.02/stereo.y*2.0;
   }
if(stereo.y<1.2 && stereo.y>=1.08)
     {
     o0.x += stereo.x * 0.03/stereo.y*1.6;
   }
if(stereo.y<1.08 && stereo.y>=0.90)
     {
     o0.x += stereo.x * 0.03/stereo.y*1.4;
   }

if(stereo.y<0.90 && stereo.y>=0.80)
     {
     o0.x += stereo.x * 0.03/stereo.y*1.2;
   }


if(stereo.y<0.80 && stereo.y>=0.70)
     {
     o0.x += stereo.x * 0.03/stereo.y*1.0;
   }

if(stereo.y<0.70)
     {
     o0.x += stereo.x * 0.03/stereo.y*0.8;
   }



    }


   if (tex_filter.x == 6)
    {
     o0.x += stereo.x * iniParams.x*0.5;
    }


   if (tex_filter.x == 7)
    {
      if(tex_filter5.x!=1.0)
     o0.x += stereo.x * iniParams.x*0.88;
     else
     o0.x += stereo.x * iniParams.x*0.5;
    }



   if (tex_filter2.x == 1 && tex_filter.x <2)
    {
     o0.x += stereo.x * iniParams.x;
    }



   if (tex_filter.x == 9)
    {
     o0.x += stereo.x * iniParams.x*2*TargetMarkScale.x;
    }







else
{
  //o0.x += stereo.x * iniParams.x;
}


  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16 on Tue May 14 21:09:03 2019
//
//
// Buffer Definitions:
//
// cbuffer CBufferGlobalConstant_Z
// {
//
//   struct StructGlobalConstant_Z
//   {
//
//       float4 c[90];                  // Offset:    0
//
//   } Global;                          // Offset:    0 Size:  1440
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// CBufferGlobalConstant_Z           cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        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   xyzw        2     NONE   float   xyzw
// INSTANCE_COLOR           0   x           3     NONE   float   x
// INSTANCE_INDEXES         0   xy          4     NONE    uint   xy
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[53], 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.xyzw
dcl_output o3.x
dcl_output o4.xy
dcl_temps 1
add r0.xy, v0.xyxx, -cb0[16].zwzz
div r0.xy, r0.xyxx, cb0[16].xyxx
mad r0.z, v0.z, cb0[52].z, cb0[52].w
mul o0.xy, r0.zzzz, r0.xyxx
mov o0.w, r0.z
mad o0.z, v0.z, cb0[51].z, cb0[51].w
mov o1.xyzw, v1.xyzw
mov o2.xy, v2.xyxx
mov o2.zw, l(0,0,0,0)
mov o3.x, l(0)
mov o4.xy, l(0,0,0,0)
ret
// Approximately 12 instruction slots used

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