//Real mirror PS.
// ---- Created with 3Dmigoto v1.3.16 on Sat May 25 00:25:26 2019
Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s0_s : register(s0);

cbuffer cb12 : register(b12)
{
  float4 cb12[30];
}




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

void main(
  float4 v0 : SV_POSITION0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4;
  uint4 bitmask, uiDest;
  float4 fDest;

  float4 stereo = StereoParams.Load(0);

  r0.zw = float2(0,0);
  r1.xy = (int2)v0.xy;
  r2.xyzw = (int4)r1.xyxy + int4(-1,0,-1,-1);
  r0.xy = r2.zw;
  r0.x = t1.Load(r0.xyz).z;
  r0.x = f32tof16(r0.x);
  r0.x = (uint)r0.x >> 7;
  r0.x = (int)r0.x ^ 383;
  r2.zw = float2(0,0);
  r0.y = t1.Load(r2.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r2.zw = float2(0,0);
  r3.xyzw = (int4)r1.xyxy + int4(0,-1,-1,1);
  r2.xy = r3.zw;
  r0.y = t1.Load(r2.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r3.zw = float2(0,0);
  r0.y = t1.Load(r3.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r1.zw = float2(0,0);
  r0.y = t1.Load(r1.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r2.xyzw = (int4)r1.xyxy + int4(1,-1,0,1);
  r1.xyzw = (int4)r1.xyxy + int4(1,1,1,0);
  r3.xy = r2.zw;
  r3.zw = float2(0,0);
  r0.y = t1.Load(r3.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r2.zw = float2(0,0);
  r0.y = t1.Load(r2.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r2.xy = r1.zw;
  r2.zw = float2(0,0);
  r0.y = t1.Load(r2.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r1.zw = float2(0,0);
  r0.y = t1.Load(r1.xyz).z;
  r0.y = f32tof16(r0.y);
  r0.y = (uint)r0.y >> 7;
  r0.y = (int)r0.y ^ 383;
  r0.x = (int)r0.y | (int)r0.x;
  r0.x = (int)r0.x & 256;
  r1.xyzw = trunc(v0.xyxy);
  r1.xyzw = float4(0.5,0.5,0.5,0.5) + r1.xyzw;
  r1.xyzw = cb12[29].zwzw * r1.xyzw;
  r2.xyzw = cb12[29].zwzw * float4(-0.5,-0.5,0.5,-0.5) + r1.zwzw;
  
  
  
  
  
  
  
  
  r3.xyzw = t0.Sample(s0_s, r2.xy).xyzw;
  
  
  
  
  
  
  
  r2.xyzw = t0.Sample(s0_s, r2.zw).xyzw;
  r2.xyzw = r3.xyzw + r2.xyzw;
  r3.xyzw = cb12[29].zwzw * float4(-0.5,0.5,0.5,0.5) + r1.xyzw;
  
  //if (r0.x>stereo.y)
  //{
	//float2 pos = r1.zw;
  //  pos.x = pos.x / 2;
  //  if (stereo.z == -1)
  //    pos.x += 0.5;
  //  r1.xyzw = stereo2mono.Sample(s0_s, pos.xy).xyzw;
  //}
  //else
  //{
	//r1.xyzw = t0.Sample(s0_s, r1.zw).xyzw;
  //}
  r1.xyzw = t0.Sample(s0_s, r1.zw).xyzw;
  r4.xyzw = t0.Sample(s0_s, r3.xy).xyzw;
  r3.xyzw = t0.Sample(s0_s, r3.zw).xyzw;
  r2.xyzw = r4.xyzw + r2.xyzw;
  r2.xyzw = r2.xyzw + r3.xyzw;
  r2.xyzw = float4(0.25,0.25,0.25,0.25) * r2.xyzw;
  o0.xyzw = r0.xxxx ? r2.xyzw : r1.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sat May 25 00:25:26 2019
//
//
// Note: shader requires additional functionality:
//       Early depth-stencil
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      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 | forceEarlyDepthStencil
dcl_constantbuffer cb12[30], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_output o0.xyzw
dcl_temps 5
mov r0.zw, l(0,0,0,0)
ftoi r1.xy, v0.xyxx
iadd r2.xyzw, r1.xyxy, l(-1, 0, -1, -1)
mov r0.xy, r2.zwzz
ld_indexable(texture2d)(float,float,float,float) r0.x, r0.xyzw, t1.zxyw
f32tof16 r0.x, r0.x
ushr r0.x, r0.x, l(7)
xor r0.x, r0.x, l(383)
mov r2.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
mov r2.zw, l(0,0,0,0)
iadd r3.xyzw, r1.xyxy, l(0, -1, -1, 1)
mov r2.xy, r3.zwzz
ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
mov r3.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r3.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
mov r1.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r1.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
iadd r2.xyzw, r1.xyxy, l(1, -1, 0, 1)
iadd r1.xyzw, r1.xyxy, l(1, 1, 1, 0)
mov r3.xy, r2.zwzz
mov r3.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r3.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
mov r2.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
mov r2.xy, r1.zwzz
mov r2.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r2.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
mov r1.zw, l(0,0,0,0)
ld_indexable(texture2d)(float,float,float,float) r0.y, r1.xyzw, t1.xzyw
f32tof16 r0.y, r0.y
ushr r0.y, r0.y, l(7)
xor r0.y, r0.y, l(383)
or r0.x, r0.y, r0.x
and r0.x, r0.x, l(256)
round_z r1.xyzw, v0.xyxy
add r1.xyzw, r1.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
mul r1.xyzw, r1.xyzw, cb12[29].zwzw
mad r2.xyzw, cb12[29].zwzw, l(-0.500000, -0.500000, 0.500000, -0.500000), r1.zwzw
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r2.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r2.xyzw, r2.zwzz, t0.xyzw, s0
add r2.xyzw, r2.xyzw, r3.xyzw
mad r3.xyzw, cb12[29].zwzw, l(-0.500000, 0.500000, 0.500000, 0.500000), r1.xyzw
sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r1.zwzz, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r4.xyzw, r3.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r3.xyzw, r3.zwzz, t0.xyzw, s0
add r2.xyzw, r2.xyzw, r4.xyzw
add r2.xyzw, r3.xyzw, r2.xyzw
mul r2.xyzw, r2.xyzw, l(0.250000, 0.250000, 0.250000, 0.250000)
movc o0.xyzw, r0.xxxx, r2.xyzw, r1.xyzw
ret
// Approximately 0 instruction slots used

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