// ---- Created with 3Dmigoto v1.3.11 on Wed Sep 05 12:10:07 2018

cbuffer PerView : register(b12)
{
  row_major float4x4 global_View : packoffset(c0);
  row_major float4x4 global_Projection : packoffset(c4);
  row_major float4x4 global_ViewProjection : packoffset(c8);
  float4 global_ViewPos : packoffset(c12);
  float4 global_ViewInfo : packoffset(c13);
  float4 global_ScaleAndBias : packoffset(c14);
}

SamplerState LinearSampler_s : register(s0);
Texture2D<float4> Base : register(t0);
Texture2D<float4> Base2 : register(t1);


// 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,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xz = Base2.SampleLevel(LinearSampler_s, v1.xy, 0).xz;
  r0.y = Base2.SampleLevel(LinearSampler_s, v3.zw, 0).y;
  r0.w = Base2.SampleLevel(LinearSampler_s, v3.xy, 0).w;
  r1.x = dot(r0.xyzw, float4(1,1,1,1));
  r1.x = cmp(r1.x < 9.99999975e-006);
  if (r1.x != 0) {
    o0.xyzw = Base.SampleLevel(LinearSampler_s, v1.xy, 0).xyzw;
  } else {
    r1.x = cmp(r0.z < r0.w);
    r1.x = r1.x ? r0.w : -r0.z;
    r0.z = cmp(r0.x < r0.y);
    r1.w = r0.z ? r0.y : -r0.x;
    r0.x = cmp(abs(r1.w) < abs(r1.x));
    r1.yz = float2(0,0);
    r0.xy = r0.xx ? r1.xy : r1.zw;
    r0.zw = float2(1,1) / global_ViewInfo.zw;
    r0.xy = r0.xy * r0.zw + v1.xy;
    o0.xyzw = Base.SampleLevel(LinearSampler_s, r0.xy, 0).xyzw;
  }
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.11 on Wed Sep 05 12:10:07 2018
//
//
// Buffer Definitions:
//
// cbuffer PerView
// {
//
//   row_major float4x4 global_View;    // Offset:    0 Size:    64 [unused]
//   row_major float4x4 global_Projection;// Offset:   64 Size:    64 [unused]
//   row_major float4x4 global_ViewProjection;// Offset:  128 Size:    64 [unused]
//   float4 global_ViewPos;             // Offset:  192 Size:    16 [unused]
//   float4 global_ViewInfo;            // Offset:  208 Size:    16
//   float4 global_ScaleAndBias;        // Offset:  224 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// LinearSampler                     sampler      NA          NA    0        1
// Base                              texture  float4          2d    0        1
// Base2                             texture  float4          2d    1        1
// PerView                           cbuffer      NA          NA   12        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1   xyzw        2     NONE   float
// TEXCOORD                 2   xyzw        3     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_constantbuffer cb12[14], 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 linear v1.xy
dcl_input_ps linear v3.xyzw
dcl_output o0.xyzw
dcl_temps 2
sample_l_indexable(texture2d)(float,float,float,float) r0.xz, v1.xyxx, t1.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.y, v3.zwzz, t1.xyzw, s0, l(0.000000)
sample_l_indexable(texture2d)(float,float,float,float) r0.w, v3.xyxx, t1.xyzw, s0, l(0.000000)
dp4 r1.x, r0.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
lt r1.x, r1.x, l(0.000010)
if_nz r1.x
  sample_l_indexable(texture2d)(float,float,float,float) o0.xyzw, v1.xyxx, t0.xyzw, s0, l(0.000000)
else
  lt r1.x, r0.z, r0.w
  movc r1.x, r1.x, r0.w, -r0.z
  lt r0.z, r0.x, r0.y
  movc r1.w, r0.z, r0.y, -r0.x
  lt r0.x, |r1.w|, |r1.x|
  mov r1.yz, l(0,0,0,0)
  movc r0.xy, r0.xxxx, r1.xyxx, r1.zwzz
  div r0.zw, l(1.000000, 1.000000, 1.000000, 1.000000), cb12[13].zzzw
  mad r0.xy, r0.xyxx, r0.zwzz, v1.xyxx
  sample_l_indexable(texture2d)(float,float,float,float) o0.xyzw, r0.xyxx, t0.xyzw, s0, l(0.000000)
endif
ret
// Approximately 20 instruction slots used

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