// 2D Stars

cbuffer g_CameraVS_CB : register(b0)
{

  struct
  {
    row_major float4x4 vs_viewProj;
    row_major float4x4 vs_view;
    float4 vs_worldCamPos;
    float4 vs_projection_params;
    float4 vs_inverse_projection_xy;
    float4 vs_frustum_params;
    float4 vs_inverse_projection2;
    float4 vs_cameraOrigin;
  } g_CameraVS : packoffset(c0);

}

cbuffer g_SkyVS_CB : register(b1)
{

  struct
  {
    row_major float4x4 view;
    float4 sunAngles;
    float4 A;
    float4 B;
    float4 C;
    float4 D;
    float4 E;
    float4 F;
    float4 G;
    float4 H;
    float4 I;
    float4 meanLuminanceSRGB;
    float4 s;
    float4 pows;
    float4 inv_pows_minus_powe;
    row_major float4x4 viewRotated;
  } g_SkyVS : packoffset(c0);

}



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


void main( 
  float4 v0 : POSITION0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  o0.xyzw = v0.xyww;
  
  float4 stereo = StereoParams.Load(0);
  o0.x += stereo.x * stereo.y;
  
  
  o1.w = 1;
  r0.xy = v0.xy * g_CameraVS.vs_inverse_projection_xy.xy + g_CameraVS.vs_inverse_projection_xy.zw;
  r0.z = 1;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  o1.x = dot(g_SkyVS.view._m00_m01_m02, r0.xyz);
  o1.y = dot(g_SkyVS.view._m10_m11_m12, r0.xyz);
  o1.z = dot(g_SkyVS.view._m20_m21_m22, r0.xyz);
  o2.x = dot(g_SkyVS.viewRotated._m00_m01_m02, r0.xyz);
  o2.y = dot(g_SkyVS.viewRotated._m10_m11_m12, r0.xyz);
  o2.z = dot(g_SkyVS.viewRotated._m20_m21_m22, r0.xyz);
  o2.w = 0;
  o3.xyzw = float4(0,0,0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.39 on Sun Jul 03 08:59:36 2016
//
//
// Buffer Definitions: 
//
// cbuffer g_CameraVS_CB
// {
//
//   struct CameraVS
//   {
//       
//       row_major float4x4 vs_viewProj;// Offset:    0
//       row_major float4x4 vs_view;    // Offset:   64
//       float4 vs_worldCamPos;         // Offset:  128
//       float4 vs_projection_params;   // Offset:  144
//       float4 vs_inverse_projection_xy;// Offset:  160
//       float4 vs_frustum_params;      // Offset:  176
//       float4 vs_inverse_projection2; // Offset:  192
//       float4 vs_cameraOrigin;        // Offset:  208
//
//   } g_CameraVS;                      // Offset:    0 Size:   224
//
// }
//
// cbuffer g_SkyVS_CB
// {
//
//   struct SkyVS
//   {
//       
//       row_major float4x4 view;       // Offset:    0
//       float4 sunAngles;              // Offset:   64
//       float4 A;                      // Offset:   80
//       float4 B;                      // Offset:   96
//       float4 C;                      // Offset:  112
//       float4 D;                      // Offset:  128
//       float4 E;                      // Offset:  144
//       float4 F;                      // Offset:  160
//       float4 G;                      // Offset:  176
//       float4 H;                      // Offset:  192
//       float4 I;                      // Offset:  208
//       float4 meanLuminanceSRGB;      // Offset:  224
//       float4 s;                      // Offset:  240
//       float4 pows;                   // Offset:  256
//       float4 inv_pows_minus_powe;    // Offset:  272
//       row_major float4x4 viewRotated;// Offset:  288
//
//   } g_SkyVS;                         // Offset:    0 Size:   352
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_CameraVS_CB                     cbuffer      NA          NA    0        1
// g_SkyVS_CB                        cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xy w
//
//
// 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[11], immediateIndexed
dcl_constantbuffer cb1[21], immediateIndexed
dcl_input v0.xyw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_temps 1
mov o0.xyzw, v0.xyww
mov o1.w, l(1.000000)
mad r0.xy, v0.xyxx, cb0[10].xyxx, cb0[10].zwzz
mov r0.z, l(1.000000)
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 o1.x, cb1[0].xyzx, r0.xyzx
dp3 o1.y, cb1[1].xyzx, r0.xyzx
dp3 o1.z, cb1[2].xyzx, r0.xyzx
dp3 o2.x, cb1[18].xyzx, r0.xyzx
dp3 o2.y, cb1[19].xyzx, r0.xyzx
dp3 o2.z, cb1[20].xyzx, r0.xyzx
mov o2.w, l(0)
mov o3.xyzw, l(0,0,0,0)
ret 
// Approximately 16 instruction slots used

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