// HALOS AROUND FIRES -> NEED MONO

cbuffer VSCommonBuffer : register(b0)
{
  float4x4 _unused_g_viewProjectionMatrix : packoffset(c0);
  float4x4 g_viewMatrix : packoffset(c4);
  float4x4 g_projectionMatrix : packoffset(c8);
  float4x4 g_worldViewProjectionMatrix : packoffset(c12);
  float4 g_dummy_16 : packoffset(c16);
  float g_fogStartZ : packoffset(c18);
  float g_recFogEndZ : packoffset(c18.y);
  float g_dummy_18_z : packoffset(c18.z);
  uint g_vs_envCbIndex : packoffset(c18.w);
  float2 g_screenSize : packoffset(c19);
  float2 g_recScreenSize : packoffset(c19.z);
  float g_nearFar : packoffset(c20);
  float g_nearFarDistance : packoffset(c20.y);
  float g_far : packoffset(c20.z);
  float g_near : packoffset(c20.w);
  float3 g_eye : packoffset(c21);
  float2 g_fbTexCoef : packoffset(c22);
  float g_vs_fadeNearStart : packoffset(c24);
  float g_vs_fadeNearDist : packoffset(c24.y);
  float g_vs_fadeFarStart : packoffset(c24.z);
  float g_vs_fadeFarDist : packoffset(c24.w);
  float4 g_vs_softSpriteParam : packoffset(c25);
  float2 g_vs_softSpriteScaleOffset : packoffset(c26);
  float2 g_vs_softSpriteScaleOffsetDummy : packoffset(c26.z);
  float3 g_vs_cameraPos : packoffset(c27);
  float4x4 g_vs_irradianceVolumeInvMatA : packoffset(c28);
  float4x4 g_vs_irradianceVolumeInvMatB : packoffset(c32);
  float g_vs_irradianceVolumeInterpRatio : packoffset(c36);
  int g_vs_bEnableLighting : packoffset(c36.y);
  float g_vs_irradianceVolumeDiffuseColorScaleA : packoffset(c36.z);
  float g_vs_irradianceVolumeDiffuseColorScaleB : packoffset(c36.w);
  float g_vs_irradianceVolumeEnableA : packoffset(c37);
  float g_vs_irradianceVolumeEnableB : packoffset(c37.y);
  int g_vs_isIVUpper : packoffset(c37.z);
  float g_vs_PS_widthScare : packoffset(c37.w);
  float4 g_vs_irradianceVolumeSamplingParamA : packoffset(c38);
  float4 g_vs_irradianceVolumeSamplingParamB : packoffset(c39);

  struct
  {
    float4 screenSize;
    float frustumNear;
    float frustumSliceScale;
    float frustumSliceBias;
    uint isDynamicLightEnable;
    uint lightTile_Width;
    uint lightTile_NumCellX;
    uint padding[2];
  } g_vs_tileBasedLightingParam : packoffset(c40);

}



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


void main(
  float3 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  out float4 o0 : TEXCOORD0,
  out float3 o1 : TEXCOORD1,
  out float p1 : TEXCOORD5,
  out float4 o2 : TEXCOORD2,
  out float4 o3 : TEXCOORD3,
  out float4 o4 : TEXCOORD4,
  out float4 o5 : SV_POSITION0)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  o0.xy = v1.xy;
  r0.xy = v1.xy * float2(2,2) + float2(-1,-1);
  r0.xy = g_fbTexCoef.yy * r0.xy;
  r1.xyz = v0.xyz;
  r1.w = 1;
  r2.x = dot(r1.xyzw, g_worldViewProjectionMatrix._m00_m10_m20_m30);
  o0.z = g_fbTexCoef.x * r2.x + r0.x;
  r2.y = dot(r1.xyzw, g_worldViewProjectionMatrix._m01_m11_m21_m31);
  r2.w = dot(r1.xyzw, g_worldViewProjectionMatrix._m03_m13_m23_m33);
  o0.w = g_fbTexCoef.x * -r2.y + r0.y;
  r0.x = -1 / g_vs_fadeNearDist;
  r0.y = 1 / g_vs_fadeFarDist;
  r0.zw = -g_vs_fadeNearStart + r2.ww;
  r0.xy = saturate(r0.zw * r0.xy);
  r0.xy = float2(1,1) + -r0.xy;
  r0.x = r0.x * r0.y;
  r0.yz = -g_vs_fadeFarStart + r2.ww;
  r0.z = saturate(r0.z / -g_vs_fadeNearDist);
  r0.y = saturate(r0.y / g_vs_fadeFarDist);
  r0.yz = float2(1,1) + -r0.yz;
  r1.xy = cmp(float2(9.99999975e-005,9.99999975e-005) >= g_vs_fadeNearDist);
  r0.x = r1.y ? r0.z : r0.x;
  r0.x = r1.x ? r0.y : r0.x;
  r0.y = r1.y ? r1.x : 0;
  p1.x = r0.y ? 1 : r0.x;
  r0.x = cmp(v0.z < -0.100000001);
  o1.y = r0.x ? -1 : 1;
  o1.z = r0.x ? 3.141593 : 0;
  o1.x = g_fbTexCoef.x * r2.w + g_fbTexCoef.y;
  o2.xyz = g_eye.xyz + -v0.xyz;
  r0.x = g_vs_softSpriteScaleOffset.x * g_vs_softSpriteParam.x;
  r0.y = r0.x * 0.5 + g_vs_softSpriteScaleOffset.y;
  r0.x = 0.5 * r0.x;
  o3.w = g_vs_softSpriteScaleOffset.y * 2 + r0.x;
  r0.x = r2.w + -r0.y;
  r0.y = r2.w + -r0.x;
  r0.z = g_near + 1;
  r0.w = r0.z + -r0.x;
  r0.z = cmp(r0.x < r0.z);
  r0.w = min(1, r0.w);
  r0.y = r0.w * r0.y + r0.x;
  r0.x = r0.z ? r0.y : r0.x;
  o3.z = r0.x;
  r0.zw = r2.xy / r2.ww;
  o3.xy = r0.zw * float2(0.5,-0.5) + float2(0.5,0.5);
  r0.z = r2.w / r0.x;
  r0.y = 1;
  r0.x = dot(r0.xy, g_projectionMatrix._m22_m32);
  r2.z = r0.z * r0.x;
  o4.xyzw = r2.xyzw;
  o5.xyzw = r2.xyzw;
  
  float4 stereo = StereoParams.Load(0);
  o5.x -= stereo.x * (o5.w - stereo.y);
  o5 = 0;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//   using 3Dmigoto v1.3.14 on Fri Mar 22 18:49:11 2019
//
//
// Buffer Definitions:
//
// cbuffer VSCommonBuffer
// {
//
//   float4x4 _unused_g_viewProjectionMatrix;// Offset:    0 Size:    64 [unused]
//   float4x4 g_viewMatrix;             // Offset:   64 Size:    64 [unused]
//   float4x4 g_projectionMatrix;       // Offset:  128 Size:    64
//   float4x4 g_worldViewProjectionMatrix;// Offset:  192 Size:    64
//   float4 g_dummy_16;                 // Offset:  256 Size:    16 [unused]
//   float g_fogStartZ;                 // Offset:  288 Size:     4 [unused]
//   float g_recFogEndZ;                // Offset:  292 Size:     4 [unused]
//   float g_dummy_18_z;                // Offset:  296 Size:     4 [unused]
//   uint g_vs_envCbIndex;              // Offset:  300 Size:     4 [unused]
//   float2 g_screenSize;               // Offset:  304 Size:     8 [unused]
//   float2 g_recScreenSize;            // Offset:  312 Size:     8 [unused]
//   float g_nearFar;                   // Offset:  320 Size:     4 [unused]
//   float g_nearFarDistance;           // Offset:  324 Size:     4 [unused]
//   float g_far;                       // Offset:  328 Size:     4 [unused]
//   float g_near;                      // Offset:  332 Size:     4
//   float3 g_eye;                      // Offset:  336 Size:    12
//   float2 g_fbTexCoef;                // Offset:  352 Size:     8
//   float g_vs_fadeNearStart;          // Offset:  384 Size:     4
//   float g_vs_fadeNearDist;           // Offset:  388 Size:     4
//   float g_vs_fadeFarStart;           // Offset:  392 Size:     4
//   float g_vs_fadeFarDist;            // Offset:  396 Size:     4
//   float4 g_vs_softSpriteParam;       // Offset:  400 Size:    16
//   float2 g_vs_softSpriteScaleOffset; // Offset:  416 Size:     8
//   float2 g_vs_softSpriteScaleOffsetDummy;// Offset:  424 Size:     8 [unused]
//   float3 g_vs_cameraPos;             // Offset:  432 Size:    12 [unused]
//   float4x4 g_vs_irradianceVolumeInvMatA;// Offset:  448 Size:    64 [unused]
//   float4x4 g_vs_irradianceVolumeInvMatB;// Offset:  512 Size:    64 [unused]
//   float g_vs_irradianceVolumeInterpRatio;// Offset:  576 Size:     4 [unused]
//   int g_vs_bEnableLighting;          // Offset:  580 Size:     4 [unused]
//   float g_vs_irradianceVolumeDiffuseColorScaleA;// Offset:  584 Size:     4 [unused]
//   float g_vs_irradianceVolumeDiffuseColorScaleB;// Offset:  588 Size:     4 [unused]
//   float g_vs_irradianceVolumeEnableA;// Offset:  592 Size:     4 [unused]
//   float g_vs_irradianceVolumeEnableB;// Offset:  596 Size:     4 [unused]
//   int g_vs_isIVUpper;                // Offset:  600 Size:     4 [unused]
//   float g_vs_PS_widthScare;          // Offset:  604 Size:     4 [unused]
//   float4 g_vs_irradianceVolumeSamplingParamA;// Offset:  608 Size:    16 [unused]
//   float4 g_vs_irradianceVolumeSamplingParamB;// Offset:  624 Size:    16 [unused]
//
//   struct TileBasedLightingParam
//   {
//
//       float4 screenSize;             // Offset:  640
//       float frustumNear;             // Offset:  656
//       float frustumSliceScale;       // Offset:  660
//       float frustumSliceBias;        // Offset:  664
//       uint isDynamicLightEnable;     // Offset:  668
//       uint lightTile_Width;          // Offset:  672
//       uint lightTile_NumCellX;       // Offset:  676
//       uint padding[2];               // Offset:  688
//
//   } g_vs_tileBasedLightingParam;     // Offset:  640 Size:    68 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// VSCommonBuffer                    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
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 1   xyz         1     NONE   float   xyz
// TEXCOORD                 5      w        1     NONE   float      w
// TEXCOORD                 2   xyz         2     NONE   float   xyz
// TEXCOORD                 3   xyzw        3     NONE   float   xyzw
// TEXCOORD                 4   xyzw        4     NONE   float   xyzw
// SV_POSITION              0   xyzw        5      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[27], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_output o0.xyzw
dcl_output o1.xyz
dcl_output o1.w
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output_siv o5.xyzw, position
dcl_temps 3
mov o0.xy, v1.xyxx
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[22].yyyy
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[12].xyzw
mad o0.z, cb0[22].x, r2.x, r0.x
dp4 r2.y, r1.xyzw, cb0[13].xyzw
dp4 r2.w, r1.xyzw, cb0[15].xyzw
mad o0.w, cb0[22].x, -r2.y, r0.y
div r0.x, l(-1.000000), cb0[24].y
div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[24].w
add r0.zw, r2.wwww, -cb0[24].xxxz
mul_sat r0.xy, r0.xyxx, r0.zwzz
add r0.xy, -r0.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r0.x, r0.y, r0.x
add r0.yz, r2.wwww, -cb0[24].zzxz
div_sat r0.z, r0.z, -cb0[24].y
div_sat r0.y, r0.y, cb0[24].w
add r0.yz, -r0.yyzy, l(0.000000, 1.000000, 1.000000, 0.000000)
ge r1.xy, l(0.000100, 0.000100, 0.000000, 0.000000), cb0[24].ywyy
movc r0.x, r1.y, r0.z, r0.x
movc r0.x, r1.x, r0.y, r0.x
and r0.y, r1.y, r1.x
movc o1.w, r0.y, l(1.000000), r0.x
lt r0.x, v0.z, l(-0.100000)
movc o1.y, r0.x, l(-1.000000), l(1.000000)
and o1.z, r0.x, l(0x40490fdb)
mad o1.x, cb0[22].x, r2.w, cb0[22].y
add o2.xyz, -v0.xyzx, cb0[21].xyzx
mul r0.x, cb0[25].x, cb0[26].x
mad r0.y, r0.x, l(0.500000), cb0[26].y
mul r0.x, r0.x, l(0.500000)
mad o3.w, cb0[26].y, l(2.000000), r0.x
add r0.x, -r0.y, r2.w
add r0.y, -r0.x, r2.w
add r0.z, l(1.000000), cb0[20].w
add r0.w, -r0.x, r0.z
lt r0.z, r0.x, r0.z
min r0.w, r0.w, l(1.000000)
mad r0.y, r0.w, r0.y, r0.x
movc r0.x, r0.z, r0.y, r0.x
mov o3.z, r0.x
div r0.zw, r2.xxxy, r2.wwww
mad o3.xy, r0.zwzz, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
div r0.z, r2.w, r0.x
mov r0.y, l(1.000000)
dp2 r0.x, r0.xyxx, cb0[10].zwzz
mul r2.z, r0.x, r0.z
mov o4.xyzw, r2.xyzw
mov o5.xyzw, r2.xyzw
ret
// Approximately 52 instruction slots used

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