// Model
Texture2D<float4> t0 : register(t0);

SamplerState s0_s : register(s0);

cbuffer cb2 : register(b2)
{
  float4 cb2[3];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[10];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[125];
}




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

void main( 
  float4 v0 : TEXCOORD10,
  float4 v1 : TEXCOORD11,
  float4 v2 : TEXCOORD0,
  float4 v3 : SV_Position0,
  uint v4 : SV_IsFrontFace0,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = t0.Sample(s0_s, v2.xy).x;
  r0.x = 0.400000006 * r0.x;
  r0.y = saturate(0.000244140625 * v3.w);
  r0.w = saturate(r0.y * -r0.x + r0.x);
  r0.xyz = max(float3(0,0,0), cb2[2].xyz);
  r1.x = cmp(0 < cb0[124].x);
  if (r1.x != 0) {
    r1.xyzw = cb0[37].xyzw * v3.yyyy;
    r1.xyzw = v3.xxxx * cb0[36].xyzw + r1.xyzw;
    r1.xyzw = v3.zzzz * cb0[38].xyzw + r1.xyzw;
    r1.xyzw = cb0[39].xyzw + r1.xyzw;
    r1.xyz = r1.xyz / r1.www;
	
	// Common SVPositionToTranslatedWorld fix:
float4 s = StereoParams.Load(0);
matrix TranslatedWorldToClip = MATRIX(cb0, 0);
matrix ClipToTranslatedWorld = MATRIX(cb0, 32);
float4 t = mul(r1.xyz, TranslatedWorldToClip);
t.x -= s.x * (t.w - s.y);
r1.xyz = mul(t, ClipToTranslatedWorld);
	
    r1.xyz = -cb0[58].xyz + r1.xyz;
    r2.xyz = -cb1[8].xyz + r1.xyz;
    r3.xyz = float3(1,1,1) + cb1[9].xyz;
    r2.xyz = cmp(r3.xyz < abs(r2.xyz));
    r1.w = (int)r2.y | (int)r2.x;
    r1.w = (int)r2.z | (int)r1.w;
    r1.x = dot(r1.xyz, float3(0.577000022,0.577000022,0.577000022));
    r1.x = 0.00200000009 * r1.x;
    r1.x = frac(r1.x);
    r1.x = cmp(0.5 < r1.x);
    r2.xyz = r1.xxx ? float3(0,1,1) : float3(1,1,0);
    r2.w = 1;
    o0.xyzw = r1.wwww ? r2.xyzw : r0.xyzw;
  } else {
    o0.xyzw = r0.xyzw;
  }
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.65 on Thu Sep 21 20:12:31 2017
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float       
// TEXCOORD                11   xyzw        1     NONE   float       
// TEXCOORD                 0   xyzw        2     NONE   float   xy  
// SV_Position              0   xyzw        3      POS   float   xyzw
// SV_IsFrontFace           0   x           4    FFACE    uint       
//
//
// 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 cb0[125], immediateIndexed
dcl_constantbuffer cb1[10], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_sampler s0, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_input_ps linear v2.xy
dcl_input_ps_siv linear noperspective v3.xyzw, position
dcl_output o0.xyzw
dcl_temps 4
sample_indexable(texture2d)(float,float,float,float) r0.x, v2.xyxx, t0.xyzw, s0
mul r0.x, r0.x, l(0.400000)
mul_sat r0.y, v3.w, l(0.000244140625)
mad_sat r0.w, r0.y, -r0.x, r0.x
max r0.xyz, cb2[2].xyzx, l(0.000000, 0.000000, 0.000000, 0.000000)
lt r1.x, l(0.000000), cb0[124].x
if_nz r1.x
  mul r1.xyzw, v3.yyyy, cb0[37].xyzw
  mad r1.xyzw, v3.xxxx, cb0[36].xyzw, r1.xyzw
  mad r1.xyzw, v3.zzzz, cb0[38].xyzw, r1.xyzw
  add r1.xyzw, r1.xyzw, cb0[39].xyzw
  div r1.xyz, r1.xyzx, r1.wwww
  add r1.xyz, r1.xyzx, -cb0[58].xyzx
  add r2.xyz, r1.xyzx, -cb1[8].xyzx
  add r3.xyz, cb1[9].xyzx, l(1.000000, 1.000000, 1.000000, 0.000000)
  lt r2.xyz, r3.xyzx, |r2.xyzx|
  or r1.w, r2.y, r2.x
  or r1.w, r2.z, r1.w
  dp3 r1.x, r1.xyzx, l(0.577000, 0.577000, 0.577000, 0.000000)
  mul r1.x, r1.x, l(0.002000)
  frc r1.x, r1.x
  lt r1.x, l(0.500000), r1.x
  movc r2.xyz, r1.xxxx, l(0,1.000000,1.000000,0), l(1.000000,1.000000,0,0)
  mov r2.w, l(1.000000)
  movc o0.xyzw, r1.wwww, r2.xyzw, r0.xyzw
else 
  mov o0.xyzw, r0.xyzw
endif 
ret 
// Approximately 0 instruction slots used

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