// ---- Created with 3Dmigoto v0.6.164 on Thu Aug 21 17:01:19 2025

cbuffer _Globals : register(b0)
{
  float2 d019_SrcTexture0SizeInv : packoffset(c64);
  float pp00_BlendAmount : packoffset(c65);
  float3 pp03_BaseColor : packoffset(c66);
  float3 pp04_SceneColor : packoffset(c67);
  row_major float3x4 pp12_ColorMatrix : packoffset(c68);
  row_major float3x4 pp14_BloomColorMatrix : packoffset(c71);
  float pp17_EdgeTrashold : packoffset(c74);
  float pp18_EdgePower : packoffset(c75);
  float pp19_EdgeWidth : packoffset(c76);
  float4 pp24_NearFarTFovRAspect : packoffset(c77);
  float pp44_SmoothEdgesAmount : packoffset(c78);
}

SamplerState s040_DepthTexture_sampler_s : register(s0);
SamplerState s050_PostProcessSrcTexture_sampler_s : register(s8);
SamplerState s051_PostProcessSrcTexture1_sampler_s : register(s9);
SamplerState s052_PostProcessSrcTexture2_sampler_s : register(s10);
SamplerState s054_PostProcessSrcTexture4_sampler_s : register(s11);
Texture2D<float4> s040_DepthTexture : register(t0);
Texture2D<float4> s050_PostProcessSrcTexture : register(t8);
Texture2D<float4> s051_PostProcessSrcTexture1 : register(t9);
Texture2D<float4> s052_PostProcessSrcTexture2 : register(t10);
Texture2D<float4> s054_PostProcessSrcTexture4 : register(t11);


// 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,
  out float4 o0 : SV_Target0)
{
  const float4 icb[] = { { 0, 0, 0.196172252, 0},
                              { -1.000000, -1.000000, 0.0765550211, 0},
                              { -1.000000, 1.000000, 0.0765550211, 0},
                              { 1.000000, -1.000000, 0.0765550211, 0},
                              { 1.000000, 1.000000, 0.0765550211, 0},
                              { 0, 1.000000, 0.124401912, 0},
                              { 1.000000, 0, 0.124401912, 0},
                              { 0, -1.000000, 0.124401912, 0},
                              { -1.000000, 0, 0.124401912, 0} };
  float4 r0,r1,r2,r3,r4,r5,r6;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = s050_PostProcessSrcTexture.Sample(s050_PostProcessSrcTexture_sampler_s, v1.xy).xyzw;
  r1.x = cmp(0 < pp17_EdgeTrashold);
  if (r1.x != 0) {
    r1.x = s040_DepthTexture.Sample(s040_DepthTexture_sampler_s, v1.xy).x;
    r2.xy = pp19_EdgeWidth * d019_SrcTexture0SizeInv.xy;
    r1.yz = -d019_SrcTexture0SizeInv.xy * pp19_EdgeWidth + v1.xy;
    r1.y = s040_DepthTexture.Sample(s040_DepthTexture_sampler_s, r1.yz).x;
    r3.xyzw = r2.xyxy * float4(-1,1,1,-1) + v1.xyxy;
    r1.z = s040_DepthTexture.Sample(s040_DepthTexture_sampler_s, r3.xy).x;
    r1.w = s040_DepthTexture.Sample(s040_DepthTexture_sampler_s, r3.zw).x;
    r3.xy = d019_SrcTexture0SizeInv.xy * pp19_EdgeWidth + v1.xy;
    r2.w = s040_DepthTexture.Sample(s040_DepthTexture_sampler_s, r3.xy).x;
    r2.z = pp24_NearFarTFovRAspect.w * r2.y;
    r2.xy = pp24_NearFarTFovRAspect.zz * r2.zx;
    r2.xz = r2.xy * r1.xx;
    r3.xz = -r2.xz;
    r3.y = r1.y + -r1.x;
    r4.x = r1.z + -r1.x;
    r5.xyzw = float4(-1,1,1,-1) * r2.zxzx;
    r6.x = r1.w + -r1.x;
    r2.y = r2.w + -r1.x;
    r4.yz = r5.xy;
    r1.xyz = r4.xyz * r3.xyz;
    r1.xyz = r4.zxy * r3.yzx + -r1.xyz;
    r1.w = dot(r1.xyz, r1.xyz);
    r1.w = rsqrt(r1.w);
    r1.xyz = r1.xyz * r1.www;
    r6.yz = r5.zw;
    r3.xyz = r6.xyz * r2.xyz;
    r2.xyz = r6.zxy * r2.yzx + -r3.xyz;
    r1.w = dot(r2.xyz, r2.xyz);
    r1.w = rsqrt(r1.w);
    r2.xyz = r2.xyz * r1.www;
    r3.xyzw = float4(0.196172252,0.196172252,0.196172252,0.196172252) * r0.xyzw;
    r4.xyzw = r3.xyzw;
    r1.w = 1;
    while (true) {
      r2.w = cmp((int)r1.w >= 9);
      if (r2.w != 0) break;
      r5.xy = icb[r1.w+0].xy * d019_SrcTexture0SizeInv.xy;
      r5.xy = r5.xy * pp44_SmoothEdgesAmount + v1.xy;
      r5.xyzw = s050_PostProcessSrcTexture.Sample(s050_PostProcessSrcTexture_sampler_s, r5.xy).xyzw;
      r4.xyzw = r5.xyzw * icb[r1.w+0].zzzz + r4.xyzw;
      r1.w = (int)r1.w + 1;
    }
    r4.x = pp18_EdgePower + r4.x;
    r1.x = dot(r1.xyz, r2.xyz);
    r1.x = cmp(r1.x < pp17_EdgeTrashold);
    r1.x = r1.x ? 1.000000 : 0;
    r2.xyzw = r4.xyzw + -r0.xyzw;
    r0.xyzw = r1.xxxx * r2.xyzw + r0.xyzw;
  }
  r1.x = pp00_BlendAmount * 7 + 1;
  r1.yzw = s054_PostProcessSrcTexture4.Sample(s054_PostProcessSrcTexture4_sampler_s, v4.xy).xyz;
  r2.xyz = s051_PostProcessSrcTexture1.Sample(s051_PostProcessSrcTexture1_sampler_s, v2.xy).xyz;
  r3.xyz = s052_PostProcessSrcTexture2.Sample(s052_PostProcessSrcTexture2_sampler_s, v3.xy).xyz;
  r4.xyz = saturate(r1.xxx * float3(1,0.5,0.25) + float3(-1,-1,-1));
  r1.xyz = r1.yzw + -r0.xyz;
  r1.xyz = r4.xxx * r1.xyz + r0.xyz;
  r2.xyz = r2.xyz + -r1.xyz;
  r1.xyz = r4.yyy * r2.xyz + r1.xyz;
  r2.xyz = r3.xyz + -r1.xyz;
  r1.xyz = r4.zzz * r2.xyz + r1.xyz;
  r3.w = 1;
  r2.x = dot(pp14_BloomColorMatrix._m00_m01_m02_m03, r3.xyzw);
  r2.y = dot(pp14_BloomColorMatrix._m10_m11_m12_m13, r3.xyzw);
  r2.z = dot(pp14_BloomColorMatrix._m20_m21_m22_m23, r3.xyzw);
  r2.xyz = max(float3(0,0,0), r2.xyz);
  r3.xyz = min(float3(1,1,1), r2.xyz);
  r3.xyz = float3(1,1,1) + -r3.xyz;
  r1.xyz = r1.xyz * r3.xyz + r2.xyz;
  r1.xyz = saturate(r1.xyz * pp04_SceneColor.xyz + pp03_BaseColor.xyz);
  r1.w = 1;
  r0.x = dot(pp12_ColorMatrix._m00_m01_m02_m03, r1.xyzw);
  r0.y = dot(pp12_ColorMatrix._m10_m11_m12_m13, r1.xyzw);
  r0.z = dot(pp12_ColorMatrix._m20_m21_m22_m23, r1.xyzw);
  o0.xyzw = r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v0.6.164 on Thu Aug 21 17:01:19 2025
//
//
// Buffer Definitions:
//
// cbuffer $Globals
// {
//
//   float2 d019_SrcTexture0SizeInv;    // Offset: 1024 Size:     8
//   float pp00_BlendAmount;            // Offset: 1040 Size:     4
//   float3 pp03_BaseColor;             // Offset: 1056 Size:    12
//   float3 pp04_SceneColor;            // Offset: 1072 Size:    12
//   row_major float3x4 pp12_ColorMatrix;// Offset: 1088 Size:    48
//   row_major float3x4 pp14_BloomColorMatrix;// Offset: 1136 Size:    48
//   float pp17_EdgeTrashold;           // Offset: 1184 Size:     4
//   float pp18_EdgePower;              // Offset: 1200 Size:     4
//   float pp19_EdgeWidth;              // Offset: 1216 Size:     4
//   float4 pp24_NearFarTFovRAspect;    // Offset: 1232 Size:    16
//   float pp44_SmoothEdgesAmount;      // Offset: 1248 Size:     4
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// s040_DepthTexture_sampler         sampler      NA          NA    0        1
// s050_PostProcessSrcTexture_sampler    sampler      NA          NA    8        1
// s051_PostProcessSrcTexture1_sampler    sampler      NA          NA    9        1
// s052_PostProcessSrcTexture2_sampler    sampler      NA          NA   10        1
// s054_PostProcessSrcTexture4_sampler    sampler      NA          NA   11        1
// s040_DepthTexture                 texture  float4          2d    0        1
// s050_PostProcessSrcTexture        texture  float4          2d    8        1
// s051_PostProcessSrcTexture1       texture  float4          2d    9        1
// s052_PostProcessSrcTexture2       texture  float4          2d   10        1
// s054_PostProcessSrcTexture4       texture  float4          2d   11        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   xy
// TEXCOORD                 1   xyzw        2     NONE   float   xy
// TEXCOORD                 2   xyzw        3     NONE   float   xy
// TEXCOORD                 3   xyzw        4     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_immediateConstantBuffer { { 0, 0, 0.196172252, 0},
                              { -1.000000, -1.000000, 0.0765550211, 0},
                              { -1.000000, 1.000000, 0.0765550211, 0},
                              { 1.000000, -1.000000, 0.0765550211, 0},
                              { 1.000000, 1.000000, 0.0765550211, 0},
                              { 0, 1.000000, 0.124401912, 0},
                              { 1.000000, 0, 0.124401912, 0},
                              { 0, -1.000000, 0.124401912, 0},
                              { -1.000000, 0, 0.124401912, 0} }
dcl_constantbuffer CB0[79], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s8, mode_default
dcl_sampler s9, mode_default
dcl_sampler s10, mode_default
dcl_sampler s11, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t8
dcl_resource_texture2d (float,float,float,float) t9
dcl_resource_texture2d (float,float,float,float) t10
dcl_resource_texture2d (float,float,float,float) t11
dcl_input_ps linear v1.xy
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xy
dcl_input_ps linear v4.xy
dcl_output o0.xyzw
dcl_temps 7
sample_indexable(texture2d)(float,float,float,float) r0.xyzw, v1.xyxx, t8.xyzw, s8
lt r1.x, l(0.000000), cb0[74].x
if_nz r1.x
  sample_indexable(texture2d)(float,float,float,float) r1.x, v1.xyxx, t0.xyzw, s0
  mul r2.xy, cb0[64].xyxx, cb0[76].xxxx
  mad r1.yz, -cb0[64].xxyx, cb0[76].xxxx, v1.xxyx
  sample_indexable(texture2d)(float,float,float,float) r1.y, r1.yzyy, t0.yxzw, s0
  mad r3.xyzw, r2.xyxy, l(-1.000000, 1.000000, 1.000000, -1.000000), v1.xyxy
  sample_indexable(texture2d)(float,float,float,float) r1.z, r3.xyxx, t0.yzxw, s0
  sample_indexable(texture2d)(float,float,float,float) r1.w, r3.zwzz, t0.yzwx, s0
  mad r3.xy, cb0[64].xyxx, cb0[76].xxxx, v1.xyxx
  sample_indexable(texture2d)(float,float,float,float) r2.w, r3.xyxx, t0.yzwx, s0
  mul r2.z, r2.y, cb0[77].w
  mul r2.xy, r2.zxzz, cb0[77].zzzz
  mul r2.xz, r1.xxxx, r2.xxyx
  mov r3.xz, -r2.xxzx
  add r3.y, -r1.x, r1.y
  add r4.x, -r1.x, r1.z
  mul r5.xyzw, r2.zxzx, l(-1.000000, 1.000000, 1.000000, -1.000000)
  add r6.x, -r1.x, r1.w
  add r2.y, -r1.x, r2.w
  mov r4.yz, r5.xxyx
  mul r1.xyz, r3.xyzx, r4.xyzx
  mad r1.xyz, r4.zxyz, r3.yzxy, -r1.xyzx
  dp3 r1.w, r1.xyzx, r1.xyzx
  rsq r1.w, r1.w
  mul r1.xyz, r1.wwww, r1.xyzx
  mov r6.yz, r5.zzwz
  mul r3.xyz, r2.xyzx, r6.xyzx
  mad r2.xyz, r6.zxyz, r2.yzxy, -r3.xyzx
  dp3 r1.w, r2.xyzx, r2.xyzx
  rsq r1.w, r1.w
  mul r2.xyz, r1.wwww, r2.xyzx
  mul r3.xyzw, r0.xyzw, l(0.196172252, 0.196172252, 0.196172252, 0.196172252)
  mov r4.xyzw, r3.xyzw
  mov r1.w, l(1)
  loop
    ige r2.w, r1.w, l(9)
    breakc_nz r2.w
    mul r5.xy, cb0[64].xyxx, icb[r1.w + 0].xyxx
    mad r5.xy, r5.xyxx, cb0[78].xxxx, v1.xyxx
    sample_indexable(texture2d)(float,float,float,float) r5.xyzw, r5.xyxx, t8.xyzw, s8
    mad r4.xyzw, r5.xyzw, icb[r1.w + 0].zzzz, r4.xyzw
    iadd r1.w, r1.w, l(1)
  endloop
  add r4.x, r4.x, cb0[75].x
  dp3 r1.x, r1.xyzx, r2.xyzx
  lt r1.x, r1.x, cb0[74].x
  and r1.x, r1.x, l(0x3f800000)
  add r2.xyzw, -r0.xyzw, r4.xyzw
  mad r0.xyzw, r1.xxxx, r2.xyzw, r0.xyzw
endif
mad r1.x, cb0[65].x, l(7.000000), l(1.000000)
sample_indexable(texture2d)(float,float,float,float) r1.yzw, v4.xyxx, t11.wxyz, s11
sample_indexable(texture2d)(float,float,float,float) r2.xyz, v2.xyxx, t9.xyzw, s9
sample_indexable(texture2d)(float,float,float,float) r3.xyz, v3.xyxx, t10.xyzw, s10
mad_sat r4.xyz, r1.xxxx, l(1.000000, 0.500000, 0.250000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
add r1.xyz, -r0.xyzx, r1.yzwy
mad r1.xyz, r4.xxxx, r1.xyzx, r0.xyzx
add r2.xyz, -r1.xyzx, r2.xyzx
mad r1.xyz, r4.yyyy, r2.xyzx, r1.xyzx
add r2.xyz, -r1.xyzx, r3.xyzx
mad r1.xyz, r4.zzzz, r2.xyzx, r1.xyzx
mov r3.w, l(1.000000)
dp4 r2.x, cb0[71].xyzw, r3.xyzw
dp4 r2.y, cb0[72].xyzw, r3.xyzw
dp4 r2.z, cb0[73].xyzw, r3.xyzw
max r2.xyz, r2.xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
min r3.xyz, r2.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
add r3.xyz, -r3.xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
mad r1.xyz, r1.xyzx, r3.xyzx, r2.xyzx
mad_sat r1.xyz, r1.xyzx, cb0[67].xyzx, cb0[66].xyzx
mov r1.w, l(1.000000)
dp4 r0.x, cb0[68].xyzw, r1.xyzw
dp4 r0.y, cb0[69].xyzw, r1.xyzw
dp4 r0.z, cb0[70].xyzw, r1.xyzw
mov o0.xyzw, r0.xyzw
ret
// Approximately 78 instruction slots used

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