//P5S blue door haloing PS. Related to da8181803d400db7-vs.txt
// ---- Created with 3Dmigoto v1.3.16 on Sat Mar 05 00:39:06 2022

cbuffer _Globals : register(b0)
{
  float vATest : packoffset(c0);
  float2 vSatFade : packoffset(c1) = {0,1};
  bool bSatFade : packoffset(c2) = true;
}

SamplerState __smpsStage0_s : register(s0);
SamplerState __smpsRTT_s : register(s3);
Texture2D<float4> sStage0 : register(t0);
Texture2D<float4> sRTT : register(t3);


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


void main(
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  float4 v4 : TEXCOORD3,
  float4 v5 : TEXCOORD4,
  float4 v6 : TEXCOORD5,
  float2 v7 : TEXCOORD6,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.xyzw = sStage0.Sample(__smpsStage0_s, v7.xy).xyzw;
  r1.x = -vATest + r0.w;
  r1.x = cmp(r1.x < 0);
  if (r1.x != 0) discard;
  r0.xyz = r0.xyz * float3(2,2,2) + float3(-1,-1,-1);
  o0.w = v1.w * r0.w;
  r0.w = dot(r0.xyz, r0.xyz);
  r0.w = rsqrt(r0.w);
  r0.xyz = r0.xyz * r0.www;
  r1.xyz = v3.xyz * r0.yyy;
  r1.xyz = r0.xxx * v4.xyz + r1.xyz;
  r1.xyz = r0.zzz * v2.xyz + r1.xyz;
  r0.x = dot(r0.xyz, v5.xyz);
  r0.xyz = r0.xxx * r1.xyz + v6.xyz;
  
  r0.x+=stereo.x*(r0.z-stereo.y*2)*0.5;
  
  r0.xy = r0.xy / r0.zz;
  r0.xyz = sRTT.Sample(__smpsRTT_s, r0.xy).xyz;
  r0.xyz = v1.xyz * r0.xyz;
  r0.w = max(r0.y, r0.z);
  r0.w = max(r0.x, r0.w);
  r1.xyz = r0.www * vSatFade.yyy + -r0.xyz;
  r1.xyz = vSatFade.xxx * r1.xyz + r0.xyz;
  o0.xyz = bSatFade ? r1.xyz : r0.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sat Mar 05 00:39:06 2022
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float vATest;                      // Offset:    0 Size:     4
//   float2 vSatFade;                   // Offset:   16 Size:     8
//      = 0x00000000 0x3f800000
//   bool bSatFade;                     // Offset:   32 Size:     4
//      = 0xffffffff
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// __smpsStage0                      sampler      NA          NA    0        1
// __smpsRTT                         sampler      NA          NA    3        1
// sStage0                           texture  float4          2d    0        1
// sRTT                              texture  float4          2d    3        1
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyz         2     NONE   float   xyz
// TEXCOORD                 2   xyz         3     NONE   float   xyz
// TEXCOORD                 3   xyz         4     NONE   float   xyz
// TEXCOORD                 4   xyz         5     NONE   float   xyz
// TEXCOORD                 5   xyz         6     NONE   float   xyz
// TEXCOORD                 6   xy          7     NONE   float   xy
//
//
// 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[3], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s3, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyz
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyz
dcl_input_ps linear v5.xyz
dcl_input_ps linear v6.xyz
dcl_input_ps linear v7.xy
dcl_output o0.xyzw
dcl_temps 2
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v7.xyxx, t0.xyzw, s0
add r1.x, r0.w, -cb0[0].x
lt r1.x, r1.x, l(0.000000)
discard_nz r1.x
mad r0.xyz, r0.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mul o0.w, r0.w, v1.w
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
mul r1.xyz, r0.yyyy, v3.xyzx
mad r1.xyz, r0.xxxx, v4.xyzx, r1.xyzx
mad r1.xyz, r0.zzzz, v2.xyzx, r1.xyzx
dp3 r0.x, r0.xyzx, v5.xyzx
mad r0.xyz, r0.xxxx, r1.xyzx, v6.xyzx
div r0.xy, r0.xyxx, r0.zzzz
sample_indexable(texture2d)(float,float,float,float) r0.xyz, r0.xyxx, t3.xyzw, s3
mul r0.xyz, r0.xyzx, v1.xyzx
max r0.w, r0.z, r0.y
max r0.w, r0.w, r0.x
mad r1.xyz, r0.wwww, cb0[1].yyyy, -r0.xyzx
mad r1.xyz, cb0[1].xxxx, r1.xyzx, r0.xyzx
movc o0.xyz, cb0[2].xxxx, r1.xyzx, r0.xyzx
ret
// Approximately 23 instruction slots used

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