//sun bloom, bike headlight
// ---- Created with 3Dmigoto v1.3.16 on Thu Jul 23 02:01:44 2020

cbuffer lightFlareVS : register(b0)
{
  float4 gv_renderColor : packoffset(c0);
  float4 gv_posSize : packoffset(c1);
  float4 gv_rotation : packoffset(c2);
}



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


void main(
  uint v0 : SV_VertexID0,
  out float2 o0 : TEXCOORDS0,
  out float4 o1 : SV_Position0)
{
  const float4 icb[] = { { 0, 0, 0, 0},
                              { 1.000000, 0, 0, 0},
                              { 0, 1.000000, 0, 0},
                              { 1.000000, 1.000000, 0, 0} };
// Needs manual fix for instruction:
// unknown dcl_: dcl_input_sgv v0.x, vertex_id
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = v0.x;
  o0.xy = icb[r0.x+0].xy;

float4 debug = IniParams.Load(int2(1, 0));
//o0.xy *= debug.zz;

  r0.xyzw = icb[r0.x+0].xyyx + float4(-0.5,-0.5,-0.5,-0.5);
  r0.xyw = gv_rotation.xyy * r0.xyw;
  r1.y = r0.z * gv_rotation.x + -r0.w;
  r1.x = r0.x + r0.y;
  o1.xy = r1.xy * gv_posSize.zw + gv_posSize.xy;
  o1.zw = float2(0,1);

float4 stereo = StereoParams.Load(0);
float4 iniParams = IniParams.Load(0);
float4 hud = IniParams.Load(int2(2, 0));
if(hud.x == 2){
o1.x += stereo.x * 0.6;
}else{
o1.x += stereo.x;
}

  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.3.16 on Thu Jul 23 02:01:44 2020
//
//
// Buffer Definitions:
//
// cbuffer lightFlareVS
// {
//
//   float4 gv_renderColor;             // Offset:    0 Size:    16 [unused]
//   float4 gv_posSize;                 // Offset:   16 Size:    16
//   float4 gv_rotation;                // Offset:   32 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// lightFlareVS                      cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_VertexID              0   x           0   VERTID    uint   x
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORDS                0   xy          0     NONE   float   xy
// SV_Position              0   xyzw        1      POS   float   xyzw
//
vs_4_1
dcl_globalFlags refactoringAllowed
dcl_immediateConstantBuffer { { 0, 0, 0, 0},
                              { 1.000000, 0, 0, 0},
                              { 0, 1.000000, 0, 0},
                              { 1.000000, 1.000000, 0, 0} }
dcl_constantbuffer cb0[3], immediateIndexed
dcl_input_sgv v0.x, vertex_id
dcl_output o0.xy
dcl_output_siv o1.xyzw, position
dcl_temps 2
mov r0.x, v0.x
mov o0.xy, icb[r0.x + 0].xyxx
add r0.xyzw, l(-0.500000, -0.500000, -0.500000, -0.500000), icb[r0.x + 0].xyyx
mul r0.xyw, r0.xyxw, cb0[2].xyxy
mad r1.y, r0.z, cb0[2].x, -r0.w
add r1.x, r0.y, r0.x
mad o1.xy, r1.xyxx, cb0[1].zwzz, cb0[1].xyxx
mov o1.zw, l(0,0,0,1.000000)
ret
// Approximately 9 instruction slots used

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