// DLC 2 Sparks
cbuffer cb2 : register(b2)
{
  float4 cb2[2];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[10];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[123];
}




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

void main(
  float4 v0 : TEXCOORD0,
  float4 v1 : TEXCOORD4,
  float4 v2 : TEXCOORD5,
  float4 v3 : TANGENTX0,
  float4 v4 : TANGENTZ0,
  float4 v5 : TEXCOORD7,
  float4 v6 : SV_Position0,
  uint v7 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = cb2[1].xyz + v2.xyz;
  r1.xy = float2(-0.5,-0.5) + v0.xy;
  r0.w = dot(r1.xy, r1.xy);
  r0.w = sqrt(r0.w);
  r0.w = -r0.w * 2 + 1;
  r0.w = max(9.99999997e-007, r0.w);
  r0.w = r0.w * r0.w;
  r0.w = r0.w * r0.w;
  r1.w = saturate(v2.w * r0.w);
  r1.xyz = max(float3(0,0,0), r0.xyz);
  r0.x = cmp(0 < cb0[122].x);
  if (r0.x != 0) {
    r0.xyzw = cb0[37].xyzw * v6.yyyy;
    r0.xyzw = v6.xxxx * cb0[36].xyzw + r0.xyzw;
    r0.xyzw = v6.zzzz * cb0[38].xyzw + r0.xyzw;
    r0.xyzw = cb0[39].xyzw + r0.xyzw;
    r0.xyz = r0.xyz / r0.www;
	
	// Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r0.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r0.xyz = mul(t, ClipToTranslatedWorld);
	
    r0.xyz = -cb0[56].xyz + r0.xyz;
    r2.xyz = -cb1[8].xyz + r0.xyz;
    r3.xyz = float3(1,1,1) + cb1[9].xyz;
    r2.xyz = cmp(r3.xyz < abs(r2.xyz));
    r0.w = (int)r2.y | (int)r2.x;
    r0.w = (int)r2.z | (int)r0.w;
    r0.x = dot(r0.xyz, float3(0.577000022,0.577000022,0.577000022));
    r0.x = 0.00200000009 * r0.x;
    r0.x = frac(r0.x);
    r0.x = cmp(0.5 < r0.x);
    r2.yzw = r0.xxx ? float3(0,1,1) : float3(1,1,0);
    r2.x = 1;
    r1.xyzw = r0.wwww ? r2.yzwx : r1.xyzw;
    o0.w = r1.w;
  } else {
    o0.w = r1.w;
  }
  o0.xyz = r1.xyz * v5.www + v5.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.67 on Sat Nov 18 07:29:33 2017
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float   xy  
// TEXCOORD                 4   xyz         1     NONE   float       
// TEXCOORD                 5   xyzw        2     NONE   float   xyzw
// TANGENTX                 0   xyzw        3     NONE   float       
// TANGENTZ                 0   xyzw        4     NONE   float       
// TEXCOORD                 7   xyzw        5     NONE   float   xyzw
// SV_Position              0   xyzw        6      POS   float   xyz 
// SV_IsFrontFace           0   x           7    FFACE    uint       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[123], immediateIndexed
dcl_constantbuffer cb1[10], immediateIndexed
dcl_constantbuffer cb2[2], immediateIndexed
dcl_input_ps linear v0.xy
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v5.xyzw
dcl_input_ps_siv linear noperspective v6.xyz, position
dcl_output o0.xyzw
dcl_temps 4
add r0.xyz, v2.xyzx, cb2[1].xyzx
add r1.xy, v0.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
dp2 r0.w, r1.xyxx, r1.xyxx
sqrt r0.w, r0.w
mad r0.w, -r0.w, l(2.000000), l(1.000000)
max r0.w, r0.w, l(0.000001)
mul r0.w, r0.w, r0.w
mul r0.w, r0.w, r0.w
mul_sat r1.w, r0.w, v2.w
max r1.xyz, r0.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r0.x, l(0.000000), cb0[122].x
if_nz r0.x
  mul r0.xyzw, v6.yyyy, cb0[37].xyzw
  mad r0.xyzw, v6.xxxx, cb0[36].xyzw, r0.xyzw
  mad r0.xyzw, v6.zzzz, cb0[38].xyzw, r0.xyzw
  add r0.xyzw, r0.xyzw, cb0[39].xyzw
  div r0.xyz, r0.xyzx, r0.wwww
  add r0.xyz, r0.xyzx, -cb0[56].xyzx
  add r2.xyz, r0.xyzx, -cb1[8].xyzx
  add r3.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r2.xyz, r3.xyzx, |r2.xyzx|
  or r0.w, r2.y, r2.x
  or r0.w, r2.z, r0.w
  dp3 r0.x, r0.xyzx, l(0.577000, 0.577000, 0.577000, 0.000000)
  mul r0.x, r0.x, l(0.002000)
  frc r0.x, r0.x
  lt r0.x, l(0.500000), r0.x
  movc r2.yzw, r0.xxxx, l(0,0,1.000000,1.000000), l(0,1.000000,1.000000,0)
  mov r2.x, l(1.000000)
  movc r1.xyzw, r0.wwww, r2.yzwx, r1.xyzw
  mov o0.w, r1.w
else 
  mov o0.w, r1.w
endif 
mad o0.xyz, r1.xyzx, v5.wwww, v5.xyzx
ret 
// Approximately 0 instruction slots used

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