//HUD 2 PS 3.
// ---- Created with 3Dmigoto v1.3.16 on Sat May 18 14:14:06 2019
Texture2D<float4> t0 : register(t0);

SamplerState s0_s : register(s0);




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


void main(
  float4 v0 : COLOR0,
  float2 v1 : TEXCOORD0,
  float4 v2 : SV_POSITION0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

// This matches the stereo correction in the vertex shader
float stereo_adjustment = StereoParams.Load(0).x * IniParams[0].x * 1;

// Load the scissor rectangle and stereoise it. Note that since both
// SV_Position and the scissor rectange are in pixels, the adjustment needs to
// be divided by the render target size and again by 2:
float4 scissor_rect = IniParams[6].xyzw;
scissor_rect.xz += floor(stereo_adjustment * IniParams[7].x / 2);

// Perform stereo adjusted scissor clipping:
if (any(v2.xy < scissor_rect.xy) || any(v2.xy >= scissor_rect.zw)) {
	o0.xyzw=float4(0.0,0.0,0.0,0.0);
	discard;
}

  t0.GetDimensions(0, fDest.x, fDest.y, fDest.z);
  r0.xy = fDest.xy;
  r0.xyzw = float4(1,1,1,1) / r0.xxyy;
  r1.xyzw = v1.xyxy + -r0.wwyy;
  r0.xyzw = v1.xyxy + r0.xyzw;
  r1.z = t0.Sample(s0_s, r1.zw).x;
  r1.x = t0.Sample(s0_s, r1.xy).x;
  r1.y = 0.224999994 * r1.z;
  r1.x = r1.x * 0.125 + r1.y;
  r0.x = t0.Sample(s0_s, r0.xy).x;
  r0.y = t0.Sample(s0_s, r0.zw).x;
  r0.x = r0.x * 0.224999994 + r1.x;
  r0.x = r0.y * 0.125 + r0.x;
  r0.w = v0.w * r0.x;
  r0.xyz = v0.xyz;
  o0.xyzw = float4(1,1,1,0.800000012) * r0.xyzw;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sat May 18 14:14:06 2019
//
//
// Note: shader requires additional functionality:
//       Early depth-stencil
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xy          1     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 | forceEarlyDepthStencil
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v0.xyzw
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
dcl_temps 2
resinfo_indexable(texture2d)(float,float,float,float) r0.xy, l(0), t0.xyzw
div r0.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000), r0.xxyy
add r1.xyzw, -r0.wwyy, v1.xyxy
add r0.xyzw, r0.xyzw, v1.xyxy
sample_indexable(texture2d)(float,float,float,float) r1.z, r1.zwzz, t0.yzxw, s0
sample_indexable(texture2d)(float,float,float,float) r1.x, r1.xyxx, t0.xyzw, s0
mul r1.y, r1.z, l(0.225000)
mad r1.x, r1.x, l(0.125000), r1.y
sample_indexable(texture2d)(float,float,float,float) r0.x, r0.xyxx, t0.xyzw, s0
sample_indexable(texture2d)(float,float,float,float) r0.y, r0.zwzz, t0.yxzw, s0
mad r0.x, r0.x, l(0.225000), r1.x
mad r0.x, r0.y, l(0.125000), r0.x
mul r0.w, r0.x, v0.w
mov r0.xyz, v0.xyzx
mul o0.xyzw, r0.xyzw, l(1.000000, 1.000000, 1.000000, 0.800000)
ret
// Approximately 0 instruction slots used

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