//Caesar soap cutter PS.
// ---- Created with 3Dmigoto v1.3.16 on Sun Sep 04 13:59:27 2022

SamplerState g_sampler0_s : register(s0);
SamplerState g_sampler1_s : register(s1);
SamplerState g_samplerFalloff_s : register(s2);
SamplerState g_samplerScreen0_s : register(s3);
SamplerState g_samplerScreen1_s : register(s4);
Texture2D<float4> g_texture0 : register(t0);
Texture2D<float4> g_texture1 : register(t1);
Texture2D<float4> g_textureFalloff : register(t2);
Texture2D<float4> g_texture2 : register(t3);
Texture2D<float4> g_texture3 : register(t4);


// 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 : TEXCOORD4,
  float4 v4 : TEXCOORD5,
  float4 v5 : COLOR0,
  float4 v6 : COLOR1,
  float4 v7 : TEXCOORD2,
  float4 v8 : TEXCOORD6,
  float4 v9 : TEXCOORD7,
  out float4 o0 : SV_Target0,
  out float4 o1 : SV_Target1)
{
  float4 r0,r1,r2,r3,r4,r5,r6;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  r0.x = dot(v4.xyz, v4.xyz);
  r0.x = rsqrt(r0.x);
  r0.x = v4.z * r0.x;
  r0.x = min(1, abs(r0.x));
  r0.y = v4.w;
  r0.xyzw = g_textureFalloff.Sample(g_samplerFalloff_s, r0.xy).xyzw;
  r1.xyzw = g_texture0.Sample(g_sampler0_s, v2.xy).xyzw;
  r2.xyzw = g_texture1.Sample(g_sampler1_s, v2.zw).xyzw;
  r0.xz = v7.yx * r2.ww;
  r3.xyz = float3(-1,-1,-1) + r1.xyz;
  r3.xyz = v7.xxx * r3.xyz + float3(1,1,1);
  r3.xyz = saturate(r3.xyz * r2.xyz);
  r3.w = saturate(r1.w * v7.x + r0.x);
  r4.xyzw = float4(-1,-1,-1,-1) + r1.xyzw;
  r4.xyzw = v7.xxxx * r4.xyzw + float4(1,1,1,1);
  r5.xyzw = float4(-1,-1,-1,-1) + r2.xyzw;
  r5.xyzw = v7.yyyy * r5.xyzw + float4(1,1,1,1);
  r4.xyzw = saturate(r5.xyzw * r4.xyzw);
  r5.xyz = cmp(float3(2.5,1.5,0.5) < v7.zzz);
  r0.x = saturate(v7.x);
  r0.w = 1 + -r0.x;
  r6.xyzw = r2.xyzw * r0.wwww;
  r6.xyzw = r1.xyzw * r0.xxxx + r6.xyzw;
  r0.x = -r2.w * v7.x + 1;
  r2.xyz = r2.xyz * r0.zzz;
  r1.xyz = r1.xyz * r0.xxx + r2.xyz;
  r1.xyzw = r5.zzzz ? r6.xyzw : r1.xyzw;
  r1.xyzw = r5.yyyy ? r4.xyzw : r1.xyzw;
  r1.xyzw = r5.xxxx ? r3.xyzw : r1.xyzw;
  r2.xyzw = v1.xyzw * r1.xyzw;
  r0.x = r2.w * r0.y;
  r0.y = cmp(v5.x >= r0.x);
  if (r0.y != 0) discard;
  r3.xy = v8.xy * v0.xy + v8.zw;
  r3.z = 1 + -r3.y;
  
  r3.x-=stereo.x*(1-stereo.y/v0.w);
  
  r3.xyzw = g_texture2.Sample(g_samplerScreen0_s, r3.xz).xyzw;
  r0.y = v3.y * r3.w;
  r1.xyz = -r1.xyz * v1.xyz + r3.xyz;
  r0.yzw = r0.yyy * r1.xyz + r2.xyz;
  r1.xy = v9.xy * v0.xy + v9.zw;
  r1.z = 1 + -r1.y;
  
  r1.x-=stereo.x*(1-stereo.y/v0.w)*1;
  
  r1.xyzw = g_texture3.Sample(g_samplerScreen1_s, r1.xz).xyzw;
  r1.w = v3.z * r1.w;
  r1.xyz = r1.xyz + -r0.yzw;
  r0.yzw = r1.www * r1.xyz + r0.yzw;
  r0.x = v5.y * r0.x;
  r0.yzw = -v6.xyz + r0.yzw;
  o0.xyz = v3.xxx * r0.yzw + v6.xyz;
  o0.w = r0.x;
  o1.xy = v5.wz;
  o1.z = 0;
  o1.w = r0.x;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Sun Sep 04 13:59:27 2022
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// g_sampler0                        sampler      NA          NA    0        1
// g_sampler1                        sampler      NA          NA    1        1
// g_samplerFalloff                  sampler      NA          NA    2        1
// g_samplerScreen0                  sampler      NA          NA    3        1
// g_samplerScreen1                  sampler      NA          NA    4        1
// g_texture0                        texture  float4          2d    0        1
// g_texture1                        texture  float4          2d    1        1
// g_textureFalloff                  texture  float4          2d    2        1
// g_texture2                        texture  float4          2d    3        1
// g_texture3                        texture  float4          2d    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xy
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 4   xyz         3     NONE   float   xyz
// TEXCOORD                 5   xyzw        4     NONE   float   xyzw
// COLOR                    0   xyzw        5     NONE   float   xyzw
// COLOR                    1   xyzw        6     NONE   float   xyz
// TEXCOORD                 2   xyz         7     NONE   float   xyz
// TEXCOORD                 6   xyzw        8     NONE   float   xyzw
// TEXCOORD                 7   xyzw        9     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
// SV_Target                1   xyzw        1   TARGET   float   xyzw
//
ps_4_0
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_resource_texture2d (float,float,float,float) t0
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_resource_texture2d (float,float,float,float) t4
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyzw
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xyzw
dcl_input_ps linear v5.xyzw
dcl_input_ps linear v6.xyz
dcl_input_ps linear v7.xyz
dcl_input_ps linear v8.xyzw
dcl_input_ps linear v9.xyzw
dcl_output o0.xyzw
dcl_output o1.xyzw
dcl_temps 7
dp3 r0.x, v4.xyzx, v4.xyzx
rsq r0.x, r0.x
mul r0.x, r0.x, v4.z
min r0.x, |r0.x|, l(1.000000)
mov r0.y, v4.w
sample r0.xyzw, r0.xyxx, t2.xyzw, s2
sample r1.xyzw, v2.xyxx, t0.xyzw, s0
sample r2.xyzw, v2.zwzz, t1.xyzw, s1
mul r0.xz, r2.wwww, v7.yyxy
add r3.xyz, r1.xyzx, l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r3.xyz, v7.xxxx, r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mul_sat r3.xyz, r2.xyzx, r3.xyzx
mad_sat r3.w, r1.w, v7.x, r0.x
add r4.xyzw, r1.xyzw, l(-1.000000, -1.000000, -1.000000, -1.000000)
mad r4.xyzw, v7.xxxx, r4.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
add r5.xyzw, r2.xyzw, l(-1.000000, -1.000000, -1.000000, -1.000000)
mad r5.xyzw, v7.yyyy, r5.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
mul_sat r4.xyzw, r4.xyzw, r5.xyzw
lt r5.xyz, l(2.500000, 1.500000, 0.500000, 0.000000), v7.zzzz
mov_sat r0.x, v7.x
add r0.w, -r0.x, l(1.000000)
mul r6.xyzw, r0.wwww, r2.xyzw
mad r6.xyzw, r1.xyzw, r0.xxxx, r6.xyzw
mad r0.x, -r2.w, v7.x, l(1.000000)
mul r2.xyz, r0.zzzz, r2.xyzx
mad r1.xyz, r1.xyzx, r0.xxxx, r2.xyzx
movc r1.xyzw, r5.zzzz, r6.xyzw, r1.xyzw
movc r1.xyzw, r5.yyyy, r4.xyzw, r1.xyzw
movc r1.xyzw, r5.xxxx, r3.xyzw, r1.xyzw
mul r2.xyzw, r1.xyzw, v1.xyzw
mul r0.x, r0.y, r2.w
ge r0.y, v5.x, r0.x
discard_nz r0.y
mad r3.xy, v8.xyxx, v0.xyxx, v8.zwzz
add r3.z, -r3.y, l(1.000000)
sample r3.xyzw, r3.xzxx, t3.xyzw, s3
mul r0.y, r3.w, v3.y
mad r1.xyz, -r1.xyzx, v1.xyzx, r3.xyzx
mad r0.yzw, r0.yyyy, r1.xxyz, r2.xxyz
mad r1.xy, v9.xyxx, v0.xyxx, v9.zwzz
add r1.z, -r1.y, l(1.000000)
sample r1.xyzw, r1.xzxx, t4.xyzw, s4
mul r1.w, r1.w, v3.z
add r1.xyz, -r0.yzwy, r1.xyzx
mad r0.yzw, r1.wwww, r1.xxyz, r0.yyzw
mul r0.x, r0.x, v5.y
add r0.yzw, r0.yyzw, -v6.xxyz
mad o0.xyz, v3.xxxx, r0.yzwy, v6.xyzx
mov o0.w, r0.x
mov o1.xy, v5.wzww
mov o1.z, l(0)
mov o1.w, r0.x
ret
// Approximately 53 instruction slots used

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