//Sky stars VS.
// ---- Created with 3Dmigoto v1.3.16 on Sat Feb 13 10:44:44 2021

cbuffer _Globals : register(b0)
{
  row_major float4x4 g_mE2C : packoffset(c0);
  float g_fProjFarZ : packoffset(c4);
  float4 g_vPhaze : packoffset(c5);
  float4 g_vTable[16] : packoffset(c6);
  float4 g_vStarInfo : packoffset(c22);
}



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


void main(
  float4 v0 : POSITION0,
  float v1 : PSIZE0,
  float4 v2 : COLOR0,
  out float4 o0 : TEXCOORD0,
  out float4 o1 : TEXCOORD1,
  out float o2 : TEXCOORD2,
  out float p2 : TEXCOORD3)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.xyz = cmp(v0.xyz == float3(0,0,0));
  r0.x = r0.y ? r0.x : 0;
  r0.x = r0.z ? r0.x : 0;
  r0.yzw = g_mE2C._m10_m11_m13 * v0.yyy;
  r0.yzw = v0.xxx * g_mE2C._m00_m01_m03 + r0.yzw;
  r0.yzw = v0.zzz * g_mE2C._m20_m21_m23 + r0.yzw;
  r0.yz = r0.yz / r0.ww;
  r0.w = cmp(r0.w < 0);
  r0.w = r0.w ? -1 : 1;
  r1.z = r0.x ? -10 : g_fProjFarZ;
  r1.xyw = r0.xxx ? float3(-10,-10,-10) : r0.yzw;
  r0.xy = cmp(abs(r1.xy) < float2(1,1));
  r0.x = r0.y ? r0.x : 0;
  if (r0.x != 0) {
    r0.x = g_vStarInfo.x * v1.x;
    r0.y = cmp(r0.x < g_vStarInfo.z);
    if (r0.y != 0) {
      r1.x = -10;
      r0.y = 1;
    } else {
      r0.z = cmp(0.0633609965 < v1.x);
      if (r0.z != 0) {
        r0.z = g_vPhaze.x + v2.w;
        r0.w = g_vPhaze.y * r0.z;
        r0.zw = frac(r0.zw);
        r0.z = r0.z * g_vPhaze.y + -r0.w;
        r0.z = (int)r0.z;
        r2.xyzw = r0.wwww * float4(3,3,3,3) + float4(1,0,-1,-2);
        r3.xyzw = r0.wwww * float4(-3,-3,-3,-3) + float4(1,2,3,4);
        r2.xyzw = saturate(min(r3.xyzw, r2.xyzw));
        r0.y = dot(g_vTable[r0.z].xyzw, r2.xyzw);
      } else {
        r0.y = 1;
      }
    }
    o2.x = r0.x;
  } else {
    o2.x = v1.x;
    r0.y = 1;
  }
  p2.x = g_vStarInfo.y * r0.y;
  o0.xyzw = v2.xyzw;
  o1.xyzw = r1.xyzw;
  o1.x+=stereo.x*o1.w;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Feb 13 10:44:44 2021
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   row_major float4x4 g_mE2C;         // Offset:    0 Size:    64
//   float g_fProjFarZ;                 // Offset:   64 Size:     4
//   float4 g_vPhaze;                   // Offset:   80 Size:    16
//   float4 g_vTable[16];               // Offset:   96 Size:   256
//   float4 g_vStarInfo;                // Offset:  352 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   xyz
// PSIZE                    0   x           1     NONE   float   x
// COLOR                    0   xyzw        2     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 1   xyzw        1     NONE   float   xyzw
// TEXCOORD                 2   x           2     NONE   float   x
// TEXCOORD                 3    y          2     NONE   float    y
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[23], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.x
dcl_input v2.xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_output o2.x
dcl_output o2.y
dcl_temps 4
eq r0.xyz, v0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
and r0.x, r0.y, r0.x
and r0.x, r0.z, r0.x
mul r0.yzw, v0.yyyy, cb0[1].xxyw
mad r0.yzw, v0.xxxx, cb0[0].xxyw, r0.yyzw
mad r0.yzw, v0.zzzz, cb0[2].xxyw, r0.yyzw
div r0.yz, r0.yyzy, r0.wwww
lt r0.w, r0.w, l(0.000000)
movc r0.w, r0.w, l(-1.000000), l(1.000000)
movc r1.z, r0.x, l(-10.000000), cb0[4].x
movc r1.xyw, r0.xxxx, l(-10.000000,-10.000000,0,-10.000000), r0.yzyw
lt r0.xy, |r1.xyxx|, l(1.000000, 1.000000, 0.000000, 0.000000)
and r0.x, r0.y, r0.x
if_nz r0.x
  mul r0.x, v1.x, cb0[22].x
  lt r0.y, r0.x, cb0[22].z
  if_nz r0.y
    mov r1.x, l(-10.000000)
    mov r0.y, l(1.000000)
  else
    lt r0.z, l(0.063361), v1.x
    if_nz r0.z
      add r0.z, v2.w, cb0[5].x
      mul r0.w, r0.z, cb0[5].y
      frc r0.zw, r0.zzzw
      mad r0.z, r0.z, cb0[5].y, -r0.w
      ftoi r0.z, r0.z
      mad r2.xyzw, r0.wwww, l(3.000000, 3.000000, 3.000000, 3.000000), l(1.000000, 0.000000, -1.000000, -2.000000)
      mad r3.xyzw, r0.wwww, l(-3.000000, -3.000000, -3.000000, -3.000000), l(1.000000, 2.000000, 3.000000, 4.000000)
      min_sat r2.xyzw, r2.xyzw, r3.xyzw
      dp4 r0.y, cb0[r0.z + 6].xyzw, r2.xyzw
    else
      mov r0.y, l(1.000000)
    endif
  endif
  mov o2.x, r0.x
else
  mov o2.x, v1.x
  mov r0.y, l(1.000000)
endif
mul o2.y, r0.y, cb0[22].y
mov o0.xyzw, v2.xyzw
mov o1.xyzw, r1.xyzw
ret
// Approximately 44 instruction slots used

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