//Vignette PS.
// ---- Created with 3Dmigoto v1.3.16 on Mon Dec 20 20:12:18 2021
Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

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

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




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


void main(
  linear noperspective float4 v0 : TEXCOORD0,
  linear noperspective float4 v1 : TEXCOORD1,
  float4 v2 : SV_POSITION0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  float4 iniparams85 = IniParams.Load(int2(85,0));
  v1.x-=stereo.x*cb1[122].x;
  
  r0.xy = -cb1[121].xy + v2.xy;
  r0.xy = cb1[122].zw * r0.xy;
  r0.xy = cb0[19].zw * r0.xy;
  r0.xy = max(float2(0.5,0.5), r0.xy);
  r0.zw = float2(-0.5,-0.5) + cb0[19].zw;
  r0.xy = min(r0.xy, r0.zw);
  r0.xy = cb0[1].zw * r0.xy;
  r0.xyz = t1.Sample(s1_s, r0.xy).xyz;
  r0.w = max(0.00100000005, cb0[20].y);
  r0.w = rcp(r0.w);
  r1.z = v1.z * r0.w;
  r1.xy = v1.xy;
  r0.w = dot(r1.xyz, r1.xyz);
  r1.x = r1.z * r1.z;
  r0.w = rcp(r0.w);
  r0.w = r1.x * r0.w;
  r0.w = r0.w * r0.w + -1;
  r0.w = cb0[20].x * r0.w + 1;
  
  //Original.
  r0.w = max(0, r0.w);
  //Removed.
  if (iniparams85.y==1) {
    r0.w = 1;
  }
  
  
  r1.xyz = t0.SampleLevel(s0_s, v0.xy, 0).xyz;
  r2.xyz = r1.xyz * r0.www;
  r3.xy = float2(1,1) + -cb0[18].yz;
  r3.xzw = r3.xxx * r2.xyz;
  r0.xyz = r3.xzw * r3.yyy + r0.xyz;
  r0.xyz = -r1.xyz * r0.www + r0.xyz;
  o0.xyz = cb0[18].xxx * r0.xyz + r2.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Mon Dec 20 20:12:18 2021
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 0   xy          0     NONE   float   xy
// TEXCOORD                 1   xyzw        1     NONE   float   xyz
// SV_POSITION              0   xyzw        2      POS   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[21], immediateIndexed
dcl_constantbuffer cb1[123], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear noperspective v0.xy
dcl_input_ps linear noperspective v1.xyz
dcl_input_ps_siv linear noperspective v2.xy, position
dcl_output o0.xyzw
dcl_temps 4
add r0.xy, v2.xyxx, -cb1[121].xyxx
mul r0.xy, r0.xyxx, cb1[122].zwzz
mul r0.xy, r0.xyxx, cb0[19].zwzz
max r0.xy, r0.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
add r0.zw, cb0[19].zzzw, l(0.000000, 0.000000, -0.500000, -0.500000)
min r0.xy, r0.zwzz, r0.xyxx
mul r0.xy, r0.xyxx, cb0[1].zwzz
sample_indexable(texture2d)(float,float,float,float) r0.xyz, r0.xyxx, t1.xyzw, s1
max r0.w, cb0[20].y, l(0.001000)
rcp r0.w, r0.w
mul r1.z, r0.w, v1.z
mov r1.xy, v1.xyxx
dp3 r0.w, r1.xyzx, r1.xyzx
mul r1.x, r1.z, r1.z
rcp r0.w, r0.w
mul r0.w, r0.w, r1.x
mad r0.w, r0.w, r0.w, l(-1.000000)
mad r0.w, cb0[20].x, r0.w, l(1.000000)
max r0.w, r0.w, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r1.xyz, v0.xyxx, t0.xyzw, s0, l(0.000000)
mul r2.xyz, r0.wwww, r1.xyzx
add r3.xy, -cb0[18].yzyy, l(1.000000, 1.000000, 0.000000, 0.000000)
mul r3.xzw, r2.xxyz, r3.xxxx
mad r0.xyz, r3.xzwx, r3.yyyy, r0.xyzx
mad r0.xyz, -r1.xyzx, r0.wwww, r0.xyzx
mad o0.xyz, cb0[18].xxxx, r0.xyzx, r2.xyzx
mov o0.w, l(1.000000)
ret
// Approximately 0 instruction slots used

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