//Water screen space reflections PS 2. Borders of geometry.
// ---- Created with 3Dmigoto v0.6.181 on Sun Dec 24 13:11:06 2023
Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);




// 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;
  uint4 bitmask, uiDest;
  float4 fDest;
  
  float4 stereo = StereoParams.Load(0);
  
  //v1.x+=stereo.x*(1-stereo.y/v0.w);
  
  r0.x = t1.SampleLevel(s1_s, v1.xy, 0).x;
  r0.y = t1.SampleLevel(s1_s, v1.zy, 0).x;
  r0.x = max(r0.x, r0.y);
  r0.y = t1.SampleLevel(s1_s, v1.xw, 0).x;
  r0.x = max(r0.x, r0.y);
  r0.y = t1.SampleLevel(s1_s, v1.zw, 0).x;
  r0.x = max(r0.x, r0.y);
  r0.x = min(65535, r0.x);
  r0.w = t0.SampleLevel(s0_s, v1.xy, 0).x;
  r1.x = t0.SampleLevel(s0_s, v1.zy, 0).x;
  r0.w = min(r1.x, r0.w);
  r1.x = t0.SampleLevel(s0_s, v1.xw, 0).x;
  r0.w = min(r1.x, r0.w);
  r1.x = t0.SampleLevel(s0_s, v1.zw, 0).x;
  r0.y = min(r1.x, r0.w);
  r0.w = r0.x + -r0.y;
  r0.w = max(0.00999999978, r0.w);
  r0.z = 1 / r0.w;
  o0.xyz = r0.xyz;
  o0.w = -r0.y * r0.z;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v0.6.181 on Sun Dec 24 13:11:06 2023
//
//
// 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_5_0
dcl_globalFlags refactoringAllowed
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 v1.xyzw
dcl_output o0.xyzw
dcl_temps 2
sample_l_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t1.xyzw, s1, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.y, v1.zyzz, t1.yxzw, s1, l(0.000000)
max r0.x, r0.y, r0.x
sample_l_indexable(texture2d)(float,float,float,float) r0.y, v1.xwxx, t1.yxzw, s1, l(0.000000)
max r0.x, r0.y, r0.x
sample_l_indexable(texture2d)(float,float,float,float) r0.y, v1.zwzz, t1.yxzw, s1, l(0.000000)
max r0.x, r0.y, r0.x
min r0.x, r0.x, l(65535.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.w, v1.xyxx, t0.yzwx, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r1.x, v1.zyzz, t0.xyzw, s0, l(0.000000)
min r0.w, r0.w, r1.x
sample_l_indexable(texture2d)(float,float,float,float) r1.x, v1.xwxx, t0.xyzw, s0, l(0.000000)
min r0.w, r0.w, r1.x
sample_l_indexable(texture2d)(float,float,float,float) r1.x, v1.zwzz, t0.xyzw, s0, l(0.000000)
min r0.y, r0.w, r1.x
add r0.w, -r0.y, r0.x
max r0.w, r0.w, l(0.010000)
div r0.z, l(1.000000, 1.000000, 1.000000, 1.000000), r0.w
mov o0.xyz, r0.xyzx
mul o0.w, r0.z, -r0.y
ret
// Approximately 0 instruction slots used

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