//P5S HUD VS 1.
// ---- Created with 3Dmigoto v1.3.16 on Wed Mar 02 19:20:36 2022

cbuffer _Globals : register(b0)
{
  float4 texIdx : packoffset(c0);
  float4 cDiff : packoffset(c1);
  float4 cAmb : packoffset(c2);
  float4 vDiffSrc : packoffset(c3);
  row_major float4x4 mW2P : packoffset(c4);
  float4 mL2W[192] : packoffset(c8);
  float4 depthcheck : packoffset(c35);
}

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


void main(
  float4 v0 : POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : TEXCOORD0,
  float4 v3 : TEXCOORD1,
  float4 v4 : TEXCOORD2,
  float2 v5 : TEXCOORD3,
  float v6 : BLENDWEIGHT0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniparams3 = IniParams.Load(int2(3,0));
  float4 iniparams6 = IniParams.Load(int2(6,0));
  float4 iniparams9 = IniParams.Load(int2(9,0));
  
  r0.x = (int)v6.x;
  r0.y = (int)r0.x * 3;
  r0.xz = mad((int2)r0.xx, int2(3,3), int2(1,2));
  r0.y = dot(v0.xyzw, mL2W[r0.y].xyzw);
  r0.x = dot(v0.xyzw, mL2W[r0.x].xyzw);
  r0.z = dot(v0.xyzw, mL2W[r0.z].xyzw);
  r1.xyzw = mW2P._m10_m11_m12_m13 * r0.xxxx;
  r1.xyzw = r0.yyyy * mW2P._m00_m01_m02_m03 + r1.xyzw;
  r0.xyzw = r0.zzzz * mW2P._m20_m21_m22_m23 + r1.xyzw;
  o0.xyzw = v0.wwww * mW2P._m30_m31_m32_m33 + r0.xyzw;
  
  if (o0.w!=1 && iniparams3.w==10) {
    o0.x-=stereo.x*(o0.w-stereo.y);
  } else if (o0.w==1) {
    if ((o0.z/o0.w)<0.999) {
	  if (depthcheck.w==0) {
        o0.x+=stereo.x*(o0.w-stereo.y*o0.z/32);
	  } else {
	    o0.x+=stereo.x*(o0.w-stereo.y*o0.z/32);
	  }
    }
  } else {
    o0.x-=stereo.x*stereo.y*iniparams6.y;
	o0.xyzw=o0.xyzw*iniparams9.y;
  }
  
  r0.xyzw = v1.xyzw * vDiffSrc.xxxx + vDiffSrc.wwww;
  r0.xyzw = cDiff.xyzw * r0.xyzw;
  o1.xyzw = cAmb.xyzw * r0.xyzw;
  r0.xyzw = cmp(float4(0,0,0,0) < texIdx.xyzw);
  o2.xyzw = r0.xxyy ? v3.xyyx : v2.xyyx;
  r0.xyzw = r0.zzww ? v3.xyyx : v2.xyyx;
  r1.xyzw = cmp(float4(1,1,2,2) < texIdx.zwzw);
  r0.xyzw = r1.xxyy ? v4.xyyx : r0.xyzw;
  o3.xyzw = r1.zzww ? v5.xyyx : r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Wed Mar 02 19:20:36 2022
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 texIdx;                     // Offset:    0 Size:    16
//   float4 cDiff;                      // Offset:   16 Size:    16
//   float4 cAmb;                       // Offset:   32 Size:    16
//   float4 vDiffSrc;                   // Offset:   48 Size:    16
//   row_major float4x4 mW2P;           // Offset:   64 Size:    64
//   float4 mL2W[192];                  // Offset:  128 Size:  3072
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy
// TEXCOORD                 1   xy          3     NONE   float   xy
// TEXCOORD                 2   xy          4     NONE   float   xy
// TEXCOORD                 3   xy          5     NONE   float   xy
// BLENDWEIGHT              0   x           6     NONE   float   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[200], dynamicIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_input v3.xy
dcl_input v4.xy
dcl_input v5.xy
dcl_input v6.x
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 2
ftoi r0.x, v6.x
imul null, r0.y, r0.x, l(3)
imad r0.xz, r0.xxxx, l(3, 0, 3, 0), l(1, 0, 2, 0)
dp4 r0.y, v0.xyzw, cb0[r0.y + 8].xyzw
dp4 r0.x, v0.xyzw, cb0[r0.x + 8].xyzw
dp4 r0.z, v0.xyzw, cb0[r0.z + 8].xyzw
mul r1.xyzw, r0.xxxx, cb0[5].xyzw
mad r1.xyzw, r0.yyyy, cb0[4].xyzw, r1.xyzw
mad r0.xyzw, r0.zzzz, cb0[6].xyzw, r1.xyzw
mad o0.xyzw, v0.wwww, cb0[7].xyzw, r0.xyzw
mad r0.xyzw, v1.xyzw, cb0[3].xxxx, cb0[3].wwww
mul r0.xyzw, r0.xyzw, cb0[1].xyzw
mul o1.xyzw, r0.xyzw, cb0[2].xyzw
lt r0.xyzw, l(0.000000, 0.000000, 0.000000, 0.000000), cb0[0].xyzw
movc o2.xyzw, r0.xxyy, v3.xyyx, v2.xyyx
movc r0.xyzw, r0.zzww, v3.xyyx, v2.xyyx
lt r1.xyzw, l(1.000000, 1.000000, 2.000000, 2.000000), cb0[0].zwzw
movc r0.xyzw, r1.xxyy, v4.xyyx, r0.xyzw
movc o3.xyzw, r1.zzww, v5.xyyx, r0.xyzw
ret
// Approximately 20 instruction slots used

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