// ---- Created with 3Dmigoto v1.3.16.41 on Sat Jan 02 19:59:30 2021
//  sky glow VS


cbuffer cb0 : register(b0)
{
  float4x4 projMat : packoffset(c0);

  struct
  {
    float3 position;
    float radius;
  } spheres[64] : packoffset(c4);

}



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


void main(
  float3 v0 : TEXCOORD0,
  uint v1 : SV_InstanceID0,
  out float3 o0 : worldPos0,
  out float3 o1 : ViewPos0,
  out uint o2 : InstanceID0,
  out float4 o3 : SV_Position0)
{
// Needs manual fix for instruction:
// unknown dcl_: dcl_input_sgv v1.x, instance_id
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  // load stereo info first
  float4 st = StereoParams.Load(0);
  float separation = st.x; float convergence = st.y;

  o0.xyz = float3(0,0,0);
  r0.x = v1.x;
  r0.xyz = v0.xyz * spheres[r0.x].radius + spheres[r0.x].position.xyz;
  o1.xyz = r0.xyz;
  o2.x = v1.x;
  r0.w = 1;
  o3.x = dot(r0.xyzw, projMat._m00_m10_m20_m30);
  o3.y = dot(r0.xyzw, projMat._m01_m11_m21_m31);
  o3.z = dot(r0.xyzw, projMat._m02_m12_m22_m32);
  o3.w = dot(r0.xyzw, projMat._m03_m13_m23_m33);
 
   o3.x += o3.w * separation;  // fix
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.16.41 on Sat Jan 02 19:59:30 2021
//
//
// Buffer Definitions:
//
// cbuffer cb0
// {
//
//   float4x4 projMat;                  // Offset:    0 Size:    64
//
//   struct Sphere
//   {
//
//       float3 position;               // Offset:   64
//       float radius;                  // Offset:   76
//
//   } spheres[64];                     // Offset:   64 Size:  1024
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cb0                               cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyz         0     NONE   float   xyz
// SV_InstanceID            0   x           1   INSTID    uint   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// worldPos                 0   xyz         0     NONE   float   xyz
// ViewPos                  0   xyz         1     NONE   float   xyz
// InstanceID               0   x           2     NONE    uint   x
// SV_Position              0   xyzw        3      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[68], dynamicIndexed
dcl_input v0.xyz
dcl_input_sgv v1.x, instance_id
dcl_output o0.xyz
dcl_output o1.xyz
dcl_output o2.x
dcl_output_siv o3.xyzw, position
dcl_temps 1
mov o0.xyz, l(0,0,0,0)
mov r0.x, v1.x
mad r0.xyz, v0.xyzx, cb0[r0.x + 4].wwww, cb0[r0.x + 4].xyzx
mov o1.xyz, r0.xyzx
mov o2.x, v1.x
mov r0.w, l(1.000000)
dp4 o3.x, r0.xyzw, cb0[0].xyzw
dp4 o3.y, r0.xyzw, cb0[1].xyzw
dp4 o3.z, r0.xyzw, cb0[2].xyzw
dp4 o3.w, r0.xyzw, cb0[3].xyzw
ret
// Approximately 11 instruction slots used

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