//HUD 3.
// ---- Created with 3Dmigoto v1.3.11 on Sun Sep 02 20:12:25 2018

cbuffer ProjParameters : register(b2)
{
  row_major float4x4 _mxView : packoffset(c0);
  row_major float4x4 _mxProj : packoffset(c4);
}



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


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

  float4 stereo = StereoParams.Load(0);
  float4 res = StereoParams.Load(int3(2,0,0));
  float4 iniparams = IniParams.Load(0);
  float4 iniparams1 = IniParams.Load(int2(1,0));
  float4 iniparams3 = IniParams.Load(int2(3,0));
  float4 iniparams5 = IniParams.Load(int2(5,0));
  float4 iniparams7 = IniParams.Load(int2(7,0));
  
  if (res.x==0 && res.y==0)
  {
	res.x=iniparams7.x;
	res.y=iniparams7.y;
  }
  
  o0.xyzw = v0.xyzw;
  o1.xyzw = v1.xyzw;
  o2.xy = v2.xy;
  r0.xyzw = _mxProj._m10_m11_m12_m13 * v3.yyyy;
  r0.xyzw = v3.xxxx * _mxProj._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v3.zzzz * _mxProj._m20_m21_m22_m23 + r0.xyzw;
  o3.xyzw = v3.wwww * _mxProj._m30_m31_m32_m33 + r0.xyzw;
  
  float ar = (4.0/3.0)/(res.x/res.y);
  if (iniparams.w!=0)
  {
	ar = iniparams.w;
  }
  
  float2 mult;
  mult.x=iniparams.z*ar;
  mult.y=iniparams.z;
  if (iniparams1.x==1 && iniparams3.w==33)
  {
    mult.x=ar;
	mult.y=1;
  }
  else if (iniparams1.x==2 && iniparams3.w==33)
  {
    mult.x=1;
	mult.y=1;
  }
  else
  {
	o3.x+=iniparams5.x*o3.w*0.25;
    o3.y+=iniparams5.y*o3.w*0.25;
  }
  o3.x=o3.x*mult.x;
  o3.y=o3.y*mult.y;
  if (iniparams3.w==33)
  {
	o3.x=o3.x*iniparams.y;
    o3.x+=stereo.x*iniparams.x*o3.w;
  }
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.11 on Sun Sep 02 20:12:25 2018
//
//
// Buffer Definitions:
//
// cbuffer ProjParameters
// {
//
//   row_major float4x4 _mxView;        // Offset:    0 Size:    64 [unused]
//   row_major float4x4 _mxProj;        // Offset:   64 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// ProjParameters                    cbuffer      NA          NA    2        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// COLOR                    1   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
// SV_Position              0   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// COLOR                    1   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
// SV_Position              0   xyzw        3      POS   float   xyzw
//
vs_4_0
dcl_constantbuffer cb2[8], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_input v3.xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output_siv o3.xyzw, position
dcl_temps 1
mov o0.xyzw, v0.xyzw
mov o1.xyzw, v1.xyzw
mov o2.xy, v2.xyxx
mul r0.xyzw, v3.yyyy, cb2[5].xyzw
mad r0.xyzw, v3.xxxx, cb2[4].xyzw, r0.xyzw
mad r0.xyzw, v3.zzzz, cb2[6].xyzw, r0.xyzw
mad o3.xyzw, v3.wwww, cb2[7].xyzw, r0.xyzw
ret
// Approximately 8 instruction slots used

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