//Dust haloing PS.
// ---- Created with 3Dmigoto v1.3.16 on Sat May 18 22:44:14 2019
Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

SamplerState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

cbuffer cb9 : register(b9)
{
  float4 cb9[2];
}




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


void main(
  float4 v0 : TEXCOORD0,
  float2 v1 : TEXCOORD1,
  float2 w1 : TEXCOORD2,
  float3 v2 : TEXCOORD3,
  float w2 : TEXCOORD5,
  float3 v3 : TEXCOORD4,
  float w3 : TEXCOORD6,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);

  r0.x = dot(v1.xy, v1.xy);
  r0.x = 1 + -r0.x;
  r0.y = cmp(r0.x < 0);
  r0.x = sqrt(r0.x);
  r0.x = -1 + r0.x;
  if (r0.y != 0) discard;
  r0.y = 1 + -r0.x;
  r0.z = t1.Sample(s1_s, w1.xy).w;
  r0.x = r0.z * r0.y + r0.x;
  r0.y = -0.00100000005 + r0.x;
  r0.x = w2.x * r0.x;
  r0.y = cmp(r0.y < 0);
  if (r0.y != 0) discard;
  r0.y = cb9[1].y;
  
  v2.x+=stereo.x*(v2.z-stereo.y)*0.5;
  
  r0.zw = v2.xy / v2.zz;
  r1.xyzw = t3.Sample(s3_s, r0.zw).xyzw;
  r2.xyz = t2.Sample(s2_s, r0.zw).xyz;
  r3.xyz = r1.xyz * r0.yyy;
  r0.z = dot(r3.xyz, float3(0.298999995,0.587000012,0.114));
  r0.yzw = -r1.xyz * r0.yyy + r0.zzz;
  r0.yzw = cb9[1].www * r0.yzw + r3.xyz;
  r1.xyz = cb9[1].xxx * r2.xyz;
  r2.w = dot(r1.xyz, float3(0.298999995,0.587000012,0.114));
  r2.xyz = -r2.xyz * cb9[1].xxx + r2.www;
  r1.xyz = cb9[1].zzz * r2.xyz + r1.xyz;
  r0.yzw = -r1.xyz + r0.yzw;
  r2.x = 1;
  r1.w = r1.w * r2.x + v3.z;
  r1.w = r1.w * r1.w;
  r1.w = r1.w * 0.25 + 1;
  r1.w = 1 / r1.w;
  r0.yzw = r1.www * r0.yzw + r1.xyz;
  r0.yzw = cb9[0].xyz * r0.yzw;
  r1.x = saturate(w3.x);
  r1.y = r1.x * r0.x;
  o0.xyz = r1.yyy * r0.yzw;
  r0.y = cb9[0].w + -1;
  r0.x = r0.x * r0.y;
  o0.w = r1.x * r0.x + 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sat May 18 22:44:14 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xyzw        0     NONE   float
// TEXCOORD                 1   xy          1     NONE   float   xy
// TEXCOORD                 2     zw        1     NONE   float     zw
// TEXCOORD                 3   xyz         2     NONE   float   xyz
// TEXCOORD                 5      w        2     NONE   float      w
// TEXCOORD                 4   xyz         3     NONE   float     z
// TEXCOORD                 6      w        3     NONE   float      w
//
//
// 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 cb9[2], immediateIndexed
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps linear v1.xy
dcl_input_ps linear v1.zw
dcl_input_ps linear v2.xyz
dcl_input_ps linear v2.w
dcl_input_ps linear v3.z
dcl_input_ps linear v3.w
dcl_output o0.xyzw
dcl_temps 4
dp2 r0.x, v1.xyxx, v1.xyxx
add r0.x, -r0.x, l(1.000000)
lt r0.y, r0.x, l(0.000000)
sqrt r0.x, r0.x
add r0.x, r0.x, l(-1.000000)
discard_nz r0.y
add r0.y, -r0.x, l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r0.z, v1.zwzz, t1.xywz, s1
mad r0.x, r0.z, r0.y, r0.x
add r0.y, r0.x, l(-0.001000)
mul r0.x, r0.x, v2.w
lt r0.y, r0.y, l(0.000000)
discard_nz r0.y
mov r0.y, cb9[1].y
div r0.zw, v2.xxxy, v2.zzzz
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r0.zwzz, t3.xyzw, s3
sample_indexable(texture2d)(float,float,float,float) r2.xyz, r0.zwzz, t2.xyzw, s2
mul r3.xyz, r0.yyyy, r1.xyzx
dp3 r0.z, r3.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
mad r0.yzw, -r1.xxyz, r0.yyyy, r0.zzzz
mad r0.yzw, cb9[1].wwww, r0.yyzw, r3.xxyz
mul r1.xyz, r2.xyzx, cb9[1].xxxx
dp3 r2.w, r1.xyzx, l(0.299000, 0.587000, 0.114000, 0.000000)
mad r2.xyz, -r2.xyzx, cb9[1].xxxx, r2.wwww
mad r1.xyz, cb9[1].zzzz, r2.xyzx, r1.xyzx
add r0.yzw, r0.yyzw, -r1.xxyz
mov r2.x, l(1.000000)
mad r1.w, r1.w, r2.x, v3.z
mul r1.w, r1.w, r1.w
mad r1.w, r1.w, l(0.250000), l(1.000000)
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mad r0.yzw, r1.wwww, r0.yyzw, r1.xxyz
mul r0.yzw, r0.yyzw, cb9[0].xxyz
mov_sat r1.x, v3.w
mul r1.y, r0.x, r1.x
mul o0.xyz, r0.yzwy, r1.yyyy
add r0.y, l(-1.000000), cb9[0].w
mul r0.x, r0.y, r0.x
mad o0.w, r1.x, r0.x, l(1.000000)
ret
// Approximately 0 instruction slots used

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