//FXAA.
// ---- Created with 3Dmigoto v1.3.16 on Fri Sep 02 18:53:48 2022

cbuffer perMaterialBuffer : register(b0)
{
  row_major float4x4 transform : packoffset(c0);
  float2 textureSize : packoffset(c4);
  float4 color : packoffset(c5);
  float4 size0 : packoffset(c6);
  float4 renderSize : packoffset(c7);
}

SamplerState tex0_s : register(s0);
Texture2D<float4> tex0_tex : register(t0);


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


void main(
  float4 v0 : SV_Position0,
  float4 v1 : TEXCOORD0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 iniparams10 = IniParams.Load(int2(10,0));
  
  r0.xyzw = float4(1,1,1,1) / renderSize.xyxy;
  r1.xyzw = r0.zwzw * float4(1,0,0,1) + v1.zwzw;
  r2.xyzw = tex0_tex.SampleLevel(tex0_s, r1.xy, 0).xyzw * iniparams10.y;
  r1.xyzw = tex0_tex.SampleLevel(tex0_s, r1.zw, 0).xyzw * iniparams10.y;
  
  
  
  r1.x = r1.y * 1.9632107 + r1.x;
  r1.y = r2.y * 1.9632107 + r2.x;
  r1.zw = v1.zw + r0.zw;
  r2.xyzw = tex0_tex.SampleLevel(tex0_s, r1.zw, 0).xyzw * iniparams10.y;
  
  r1.z = r2.y * 1.9632107 + r2.x;
  r1.w = r1.y + r1.z;
  r2.xyzw = tex0_tex.SampleLevel(tex0_s, v1.zw, 0).xyzw * iniparams10.y;
  
  
  
  r2.x = r2.y * 1.9632107 + r2.x;
  r2.y = r2.x + r1.x;
  r3.yw = r2.yy + -r1.ww;
  r1.w = r2.x + r1.y;
  r2.y = r1.x + r1.z;
  r2.y = -r2.y + r1.w;
  r1.w = r1.w + r1.x;
  r1.w = r1.w + r1.z;
  r1.w = 0.03125 * r1.w;
  r1.w = max(0.0078125, r1.w);
  r2.z = min(abs(r2.y), abs(r3.w));
  r3.xz = -r2.yy;
  r1.w = r2.z + r1.w;
  r1.w = 1 / r1.w;
  r3.xyzw = r3.xyzw * r1.wwww;
  r3.xyzw = max(float4(-8,-8,-8,-8), r3.xyzw);
  r3.xyzw = min(float4(8,8,8,8), r3.xyzw);
  r0.xyzw = r3.xyzw * r0.xyzw;
  r3.xyzw = r0.xyzw * float4(-0.5,-0.5,0.5,0.5) + v1.xyxy;
  r0.xyzw = r0.zwzw * float4(-0.166666672,-0.166666672,0.166666672,0.166666672) + v1.xyxy;
  r4.xyzw = tex0_tex.SampleLevel(tex0_s, r3.xy, 0).xyzw;
  r3.xyzw = tex0_tex.SampleLevel(tex0_s, r3.zw, 0).xyzw;
  r2.yzw = r4.xyz + r3.xyz;
  r2.yzw = float3(0.25,0.25,0.25) * r2.yzw;
  r3.xyzw = tex0_tex.SampleLevel(tex0_s, r0.xy, 0).xyzw;
  r0.xyzw = tex0_tex.SampleLevel(tex0_s, r0.zw, 0).xyzw;
  r0.xyz = r3.xyz + r0.xyz;
  r2.yzw = r0.xyz * float3(0.25,0.25,0.25) + r2.yzw;
  r0.xyz = float3(0.5,0.5,0.5) * r0.xyz;
  r0.w = r2.z * 1.9632107 + r2.y;
  r1.w = min(r1.x, r1.z);
  r1.x = max(r1.x, r1.z);
  r1.z = min(r2.x, r1.y);
  r1.y = max(r2.x, r1.y);
  r1.x = max(r1.y, r1.x);
  r1.y = min(r1.z, r1.w);
  r3.xyzw = tex0_tex.SampleLevel(tex0_s, v1.xy, 0).xyzw;
  r1.z = r3.y * 1.9632107 + r3.x;
  r1.y = min(r1.z, r1.y);
  r1.x = max(r1.z, r1.x);
  r1.x = cmp(r1.x < r0.w);
  r0.w = cmp(r0.w < r1.y);
  r0.w = (int)r1.x | (int)r0.w;
  o0.xyz = r0.www ? r0.xyz : r2.yzw;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.16 on Fri Sep 02 18:53:48 2022
//
//
// Buffer Definitions:
//
// cbuffer perMaterialBuffer
// {
//
//   row_major float4x4 transform;      // Offset:    0 Size:    64 [unused]
//   float2 textureSize;                // Offset:   64 Size:     8 [unused]
//   float4 color;                      // Offset:   80 Size:    16 [unused]
//   float4 size0;                      // Offset:   96 Size:    16 [unused]
//   float4 renderSize;                 // Offset:  112 Size:    16
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// tex0                              sampler      NA          NA    0        1
// tex0_tex                          texture  float4          2d    0        1
// perMaterialBuffer                 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
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[8], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v1.xyzw
dcl_output o0.xyzw
dcl_temps 5
div r0.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000), cb0[7].xyxy
mad r1.xyzw, r0.zwzw, l(1.000000, 0.000000, 0.000000, 1.000000), v1.zwzw
sample_l r2.xyzw, r1.xyxx, t0.xyzw, s0, l(0.000000)
sample_l r1.xyzw, r1.zwzz, t0.xyzw, s0, l(0.000000)
mad r1.x, r1.y, l(1.96321070), r1.x
mad r1.y, r2.y, l(1.96321070), r2.x
add r1.zw, r0.zzzw, v1.zzzw
sample_l r2.xyzw, r1.zwzz, t0.xyzw, s0, l(0.000000)
mad r1.z, r2.y, l(1.96321070), r2.x
add r1.w, r1.z, r1.y
sample_l r2.xyzw, v1.zwzz, t0.xyzw, s0, l(0.000000)
mad r2.x, r2.y, l(1.96321070), r2.x
add r2.y, r1.x, r2.x
add r3.yw, -r1.wwww, r2.yyyy
add r1.w, r1.y, r2.x
add r2.y, r1.z, r1.x
add r2.y, r1.w, -r2.y
add r1.w, r1.x, r1.w
add r1.w, r1.z, r1.w
mul r1.w, r1.w, l(0.031250)
max r1.w, r1.w, l(0.00781250000)
min r2.z, |r3.w|, |r2.y|
mov r3.xz, -r2.yyyy
add r1.w, r1.w, r2.z
div r1.w, l(1.000000, 1.000000, 1.000000, 1.000000), r1.w
mul r3.xyzw, r1.wwww, r3.xyzw
max r3.xyzw, r3.xyzw, l(-8.000000, -8.000000, -8.000000, -8.000000)
min r3.xyzw, r3.xyzw, l(8.000000, 8.000000, 8.000000, 8.000000)
mul r0.xyzw, r0.xyzw, r3.xyzw
mad r3.xyzw, r0.xyzw, l(-0.500000, -0.500000, 0.500000, 0.500000), v1.xyxy
mad r0.xyzw, r0.zwzw, l(-0.166666672, -0.166666672, 0.166666672, 0.166666672), v1.xyxy
sample_l r4.xyzw, r3.xyxx, t0.xyzw, s0, l(0.000000)
sample_l r3.xyzw, r3.zwzz, t0.xyzw, s0, l(0.000000)
add r2.yzw, r3.xxyz, r4.xxyz
mul r2.yzw, r2.yyzw, l(0.000000, 0.250000, 0.250000, 0.250000)
sample_l r3.xyzw, r0.xyxx, t0.xyzw, s0, l(0.000000)
sample_l r0.xyzw, r0.zwzz, t0.xyzw, s0, l(0.000000)
add r0.xyz, r0.xyzx, r3.xyzx
mad r2.yzw, r0.xxyz, l(0.000000, 0.250000, 0.250000, 0.250000), r2.yyzw
mul r0.xyz, r0.xyzx, l(0.500000, 0.500000, 0.500000, 0.000000)
mad r0.w, r2.z, l(1.96321070), r2.y
min r1.w, r1.z, r1.x
max r1.x, r1.z, r1.x
min r1.z, r1.y, r2.x
max r1.y, r1.y, r2.x
max r1.x, r1.x, r1.y
min r1.y, r1.w, r1.z
sample_l r3.xyzw, v1.xyxx, t0.xyzw, s0, l(0.000000)
mad r1.z, r3.y, l(1.96321070), r3.x
min r1.y, r1.y, r1.z
max r1.x, r1.x, r1.z
lt r1.x, r1.x, r0.w
lt r0.w, r0.w, r1.y
or r0.w, r1.x, r0.w
movc o0.xyz, r0.wwww, r0.xyzx, r2.yzwy
mov o0.w, l(1.000000)
ret
// Approximately 57 instruction slots used

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