//P5S enemy haloing VS.
// ---- Created with 3Dmigoto v1.3.16 on Sun Mar 06 17:42:57 2022

cbuffer _Globals : register(b0)
{
  float4 vEye : packoffset(c27);
  row_major float4x4 mW2P : packoffset(c0);
  float4 vDPort : packoffset(c24);
  float4 vSPort : packoffset(c28);
}



// 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,
  float4 v3 : COLOR1,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float3 o5 : TEXCOORD4)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.xyzw = mW2P._m10_m11_m12_m13 * v0.yyyy;
  r0.xyzw = v0.xxxx * mW2P._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v0.zzzz * mW2P._m20_m21_m22_m23 + r0.xyzw;
  r0.xyzw = mW2P._m30_m31_m33_m32 + r0.xywz;
  o0.xyzw = r0.xywz;
  
  r0.x+=stereo.x*(r0.w-stereo.y);
  
  o1.xyz = v0.xyz;
  o1.w = 1;
  r0.w = frac(v2.x);
  r1.x = -r0.w * 0.00392156886 + v2.x;
  o5.x = r0.w + r0.w;
  o2.w = 1 / r1.x;
  o2.x = dot(vDPort.xy, r0.xz);
  o2.y = dot(vDPort.zw, r0.yz);
  o2.z = r0.z;
  o3.z = r0.z;
  r1.xyz = float3(5.96046448e-008,1.52587891e-005,0.00390625) * v0.www;
  r1.xyz = frac(r1.xyz);
  r1.xyz = r1.xyz * float3(2.00784326,2.00784326,2.00784326) + float3(-1,-1,-1);
  r2.xyz = vEye.xyz + -v0.xyz;
  r0.w = dot(r1.xyz, r2.xyz);
  o3.w = abs(r0.w);
  o3.x = dot(vSPort.xy, r0.xz);
  o3.y = dot(vSPort.zw, r0.yz);
  r0.xyzw = float4(-0.501960814,-0.5,-0.5,-0.5) + v3.wxyz;
  r1.xy = mW2P._m10_m11 * r0.zz;
  r0.yz = r0.yy * mW2P._m00_m01 + r1.xy;
  r0.yz = r0.ww * mW2P._m20_m21 + r0.yz;
  r0.w = cmp(v3.w >= 0.501960814);
  r0.x = r0.w ? r0.x : v3.w;
  r0.x = r0.x + r0.x;
  r0.yz = r0.xx * r0.yz;
  o4.xy = float2(1,-1) * r0.yz;
  r0.yzw = float3(-0.5,-0.5,-0.5) + v1.xyz;
  r1.xy = mW2P._m10_m11 * r0.zz;
  r0.yz = r0.yy * mW2P._m00_m01 + r1.xy;
  r0.yz = r0.ww * mW2P._m20_m21 + r0.yz;
  r0.xy = r0.xx * r0.yz;
  o4.zw = float2(1,-1) * r0.xy;
  o5.y = v2.y;
  o5.z = v1.w;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sun Mar 06 17:42:57 2022
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float4 vEye;                       // Offset:  432 Size:    16
//   row_major float4x4 mW2P;           // Offset:    0 Size:    64
//   float4 vDPort;                     // Offset:  384 Size:    16
//   float4 vSPort;                     // Offset:  448 Size:    16
//
// }
//
//
// 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
// COLOR                    1   xyzw        3     NONE   float   xyzw
//
//
// 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
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyz         5     NONE   float   xyz
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[29], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyz
dcl_temps 3
mul r0.xyzw, v0.yyyy, cb0[1].xyzw
mad r0.xyzw, v0.xxxx, cb0[0].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb0[2].xyzw, r0.xyzw
add r0.xyzw, r0.xywz, cb0[3].xywz
mov o0.xyzw, r0.xywz
mov o1.xyz, v0.xyzx
mov o1.w, l(1.000000)
frc r0.w, v2.x
mad r1.x, -r0.w, l(0.00392156886), v2.x
add o5.x, r0.w, r0.w
div o2.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.x
dp2 o2.x, cb0[24].xyxx, r0.xzxx
dp2 o2.y, cb0[24].zwzz, r0.yzyy
mov o2.z, r0.z
mov o3.z, r0.z
mul r1.xyz, v0.wwww, l(5.960464478E-008, 0.0000152587891, 0.00390625000, 0.000000)
frc r1.xyz, r1.xyzx
mad r1.xyz, r1.xyzx, l(2.00784326, 2.00784326, 2.00784326, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
add r2.xyz, -v0.xyzx, cb0[27].xyzx
dp3 r0.w, r1.xyzx, r2.xyzx
mov o3.w, |r0.w|
dp2 o3.x, cb0[28].xyxx, r0.xzxx
dp2 o3.y, cb0[28].zwzz, r0.yzyy
add r0.xyzw, v3.wxyz, l(-0.501960814, -0.500000, -0.500000, -0.500000)
mul r1.xy, r0.zzzz, cb0[1].xyxx
mad r0.yz, r0.yyyy, cb0[0].xxyx, r1.xxyx
mad r0.yz, r0.wwww, cb0[2].xxyx, r0.yyzy
ge r0.w, v3.w, l(0.501960814)
movc r0.x, r0.w, r0.x, v3.w
add r0.x, r0.x, r0.x
mul r0.yz, r0.yyzy, r0.xxxx
mul o4.xy, r0.yzyy, l(1.000000, -1.000000, 0.000000, 0.000000)
add r0.yzw, v1.xxyz, l(0.000000, -0.500000, -0.500000, -0.500000)
mul r1.xy, r0.zzzz, cb0[1].xyxx
mad r0.yz, r0.yyyy, cb0[0].xxyx, r1.xxyx
mad r0.yz, r0.wwww, cb0[2].xxyx, r0.yyzy
mul r0.xy, r0.yzyy, r0.xxxx
mul o4.zw, r0.xxxy, l(0.000000, 0.000000, 1.000000, -1.000000)
mov o5.y, v2.y
mov o5.z, v1.w
ret
// Approximately 41 instruction slots used

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