//Lens flares VS 1.
// ---- Created with geo-11 v0.6.193 on Sun May 19 23:52:02 2024

cbuffer PER_BATCH : register(b0)
{
  float4 ScreenWidthHeight : packoffset(c0);
  float4 wposAndSize : packoffset(c1);
  float2 baseTexSize : packoffset(c2);
  row_major float3x4 xform : packoffset(c3);
  float4 ghostTileInfo : packoffset(c6);
  float4 dynamics : packoffset(c7);
}



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


void main(
  float3 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  float4 v2 : COLOR0,
  out float4 o0 : SV_Position0,
  out float2 o1 : TEXCOORD0,
  out float4 o2 : COLOR0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.xy = v1.xy * float2(2,2) + float2(-1,-1);
  r0.xy = wposAndSize.ww * r0.xy;
  r0.yz = xform._m10_m11 * r0.yy;
  r0.xy = r0.xx * xform._m00_m01 + r0.yz;
  r0.xy = xform._m20_m21 + r0.xy;
  r0.z = max(ScreenWidthHeight.x, ScreenWidthHeight.y);
  r0.zw = ScreenWidthHeight.yx / r0.zz;
  r0.xy = r0.xy * r0.zw;
  r0.z = max(baseTexSize.x, baseTexSize.y);
  r0.zw = baseTexSize.xy / r0.zz;
  r1.xy = v0.xy * float2(1,-1) + float2(0,1);
  r1.xy = r1.xy + r1.xy;
  r0.xy = r0.xy * r0.zw + r1.xy;
  o0.xy = float2(-1,-1) + r0.xy;
  o0.zw = float2(0.5,1);
  
  o0.x+=stereo.x;
  
  o1.xy = v1.xy;
  r0.xyz = v2.zyx * v0.zzz;
  r0.w = v2.w;
  o2.xyzw = dynamics.xxxx * r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.0.10011.16384
//
//   using 3Dmigoto v0.6.193 on Sun May 19 23:52:02 2024
//
//
// Buffer Definitions:
//
// cbuffer PER_BATCH
// {
//
//   float4 ScreenWidthHeight;          // Offset:    0 Size:    16
//   float4 wposAndSize;                // Offset:   16 Size:    16
//   float2 baseTexSize;                // Offset:   32 Size:     8
//   row_major float3x4 xform;          // Offset:   48 Size:    48
//   float4 ghostTileInfo;              // Offset:   96 Size:    16 [unused]
//   float4 dynamics;                   // Offset:  112 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// PER_BATCH                         cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz
// TEXCOORD                 0   xy          1     NONE   float   xy
// COLOR                    0   xyzw        2     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// COLOR                    0   xyzw        2     NONE   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer CB0[8], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyzw
dcl_temps 2
mad r0.xy, v1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mul r0.xy, r0.xyxx, cb0[1].wwww
mul r0.yz, r0.yyyy, cb0[4].xxyx
mad r0.xy, r0.xxxx, cb0[3].xyxx, r0.yzyy
add r0.xy, r0.xyxx, cb0[5].xyxx
max r0.z, cb0[0].y, cb0[0].x
div r0.zw, cb0[0].yyyx, r0.zzzz
mul r0.xy, r0.zwzz, r0.xyxx
max r0.z, cb0[2].y, cb0[2].x
div r0.zw, cb0[2].xxxy, r0.zzzz
mad r1.xy, v0.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000), l(0.000000, 1.000000, 0.000000, 0.000000)
add r1.xy, r1.xyxx, r1.xyxx
mad r0.xy, r0.xyxx, r0.zwzz, r1.xyxx
add o0.xy, r0.xyxx, l(-1.000000, -1.000000, 0.000000, 0.000000)
mov o0.zw, l(0,0,0.500000,1.000000)
mov o1.xy, v1.xyxx
mul r0.xyz, v0.zzzz, v2.zyxz
mov r0.w, v2.w
mul o2.xyzw, r0.xyzw, cb0[7].xxxx
ret
// Approximately 20 instruction slots used

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