Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb3 : register(b3)
{
  float4 cb3[4];
}

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

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

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


Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float3 v2 : TEXCOORD1,
  out float4 o0 : SV_Target0,
  float fov : TEXCOORD2) // New input from pixel shader with UNITY_MATRIX_IT_MV[0].x
{
  float4 r0,r1,r2,r3,r4,r5;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = cb0[9].xyz * cb0[3].xyz;
  r0.xz = r0.xx + r0.yz;
  r0.y = r0.y * r0.z;
  r0.x = cb0[9].z * cb0[3].z + r0.x;
  r0.y = sqrt(r0.y);
  r0.y = dot(cb0[3].ww, r0.yy);
  r0.x = r0.x + r0.y;
  r0.yz = v1.xy / v1.ww;
  r1.xyzw = t0.Sample(s0_s, r0.yz).xyzw;
  r2.xyzw = t2.Sample(s2_s, r0.yz).xyzw;
  r0.y = cb1[7].x * r1.x + cb1[7].y;
  r0.y = 1 / r0.y;
  r0.z = cb1[5].z / v2.z;
  r1.xyz = v2.xyz * r0.zzz;
  r1.xyw = r1.xyz * r0.yyy;
float depth = r1.w;

// Load the stereo parameters as usual:

float4 stereo = StereoParams.Load(0);
float separation = stereo.x; float convergence = stereo.y;

// And finally adjust the ray, by subtracting the view-space variation of the
// stereo correction formula. The view-space variation includes part of the
// inverse projection matrix ("fov" here), which we calculated in the vertex
// shader and passed in using a spare texture coordinate (TEXCOORD2):

r1.x -= separation * (depth - convergence) * fov;
  r3.xyz = cb3[1].xyz * r1.yyy;
  r3.xyz = cb3[0].xyz * r1.xxx + r3.xyz;
  r3.xyz = cb3[2].xyz * r1.www + r3.xyz;
  r3.xyz = cb3[3].xyz + r3.xyz;
  r4.xyz = -cb1[4].xyz + r3.xyz;
  r0.z = dot(r4.xyz, r4.xyz);
  r0.z = rsqrt(r0.z);
  r5.xyz = -cb0[8].xyz + r3.xyz;
  r3.xyz = -cb2[25].xyz + r3.xyz;
  r0.w = dot(r3.xyz, r3.xyz);
  r0.w = sqrt(r0.w);
  r0.y = -r1.z * r0.y + r0.w;
  r0.y = cb2[25].w * r0.y + r1.w;
  r0.y = r0.y * cb0[10].z + cb0[10].w;
  r0.y = saturate(1 + -r0.y);
  r0.w = dot(r5.xyz, r5.xyz);
  r1.x = rsqrt(r0.w);
  r0.w = cb0[8].w * r0.w;
  r3.xyzw = t1.Sample(s1_s, r0.ww).xyzw;
  r1.xyz = r5.xyz * r1.xxx;
  r3.yzw = -r4.xyz * r0.zzz + -r1.xyz;
  r0.z = dot(r3.yzw, r3.yzw);
  r0.z = rsqrt(r0.z);
  r3.yzw = r3.yzw * r0.zzz;
  r2.xyz = r2.xyz * float3(2,2,2) + float3(-1,-1,-1);
  r0.z = 128 * r2.w;
  r0.w = dot(r2.xyz, r2.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = r2.xyz * r0.www;
  r0.w = dot(r3.yzw, r2.xyz);
  r1.x = dot(-r1.xyz, r2.xyz);
  r1.x = max(0, r1.x);
  r1.x = r1.x * r3.x;
  r3.x = saturate(r3.x);
  r1.xyz = cb0[9].xyz * r1.xxx;
  r0.w = max(0, r0.w);
  r0.w = log2(r0.w);
  r0.z = r0.z * r0.w;
  r0.z = exp2(r0.z);
  r0.z = r0.z * r3.x;
  r1.w = r0.z * r0.x;
  o0.xyzw = r1.xyzw * r0.yyyy;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.2.9 on Sun Dec 06 02:09:54 2015
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xy w
// TEXCOORD                 1   xyz         2     NONE   float   xyz 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb0[11], immediateIndexed
dcl_constantbuffer cb1[8], immediateIndexed
dcl_constantbuffer cb2[26], immediateIndexed
dcl_constantbuffer cb3[4], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_input_ps linear v1.xyw
dcl_input_ps linear v2.xyz
dcl_output o0.xyzw
dcl_temps 6
mul r0.xyz, cb0[3].xyzx, cb0[9].xyzx
add r0.xz, r0.yyzy, r0.xxxx
mul r0.y, r0.z, r0.y
mad r0.x, cb0[9].z, cb0[3].z, r0.x
sqrt r0.y, r0.y
dp2 r0.y, cb0[3].wwww, r0.yyyy
add r0.x, r0.y, r0.x
div r0.yz, v1.xxyx, v1.wwww
sample r1.xyzw, r0.yzyy, t0.xyzw, s0
sample r2.xyzw, r0.yzyy, t2.xyzw, s2
mad r0.y, cb1[7].x, r1.x, cb1[7].y
div r0.y, l(1.000000, 1.000000, 1.000000, 1.000000), r0.y
div r0.z, cb1[5].z, v2.z
mul r1.xyz, r0.zzzz, v2.xyzx
mul r1.xyw, r0.yyyy, r1.xyxz
mul r3.xyz, r1.yyyy, cb3[1].xyzx
mad r3.xyz, cb3[0].xyzx, r1.xxxx, r3.xyzx
mad r3.xyz, cb3[2].xyzx, r1.wwww, r3.xyzx
add r3.xyz, r3.xyzx, cb3[3].xyzx
add r4.xyz, r3.xyzx, -cb1[4].xyzx
dp3 r0.z, r4.xyzx, r4.xyzx
rsq r0.z, r0.z
add r5.xyz, r3.xyzx, -cb0[8].xyzx
add r3.xyz, r3.xyzx, -cb2[25].xyzx
dp3 r0.w, r3.xyzx, r3.xyzx
sqrt r0.w, r0.w
mad r0.y, -r1.z, r0.y, r0.w
mad r0.y, cb2[25].w, r0.y, r1.w
mad r0.y, r0.y, cb0[10].z, cb0[10].w
add_sat r0.y, -r0.y, l(1.000000)
dp3 r0.w, r5.xyzx, r5.xyzx
rsq r1.x, r0.w
mul r0.w, r0.w, cb0[8].w
sample r3.xyzw, r0.wwww, t1.xyzw, s1
mul r1.xyz, r1.xxxx, r5.xyzx
mad r3.yzw, -r4.xxyz, r0.zzzz, -r1.xxyz
dp3 r0.z, r3.yzwy, r3.yzwy
rsq r0.z, r0.z
mul r3.yzw, r0.zzzz, r3.yyzw
mad r2.xyz, r2.xyzx, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mul r0.z, r2.w, l(128.000000)
dp3 r0.w, r2.xyzx, r2.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, r2.xyzx
dp3 r0.w, r3.yzwy, r2.xyzx
dp3 r1.x, -r1.xyzx, r2.xyzx
max r1.x, r1.x, l(0.000000)
mul r1.x, r3.x, r1.x
mov_sat r3.x, r3.x
mul r1.xyz, r1.xxxx, cb0[9].xyzx
max r0.w, r0.w, l(0.000000)
log r0.w, r0.w
mul r0.z, r0.w, r0.z
exp r0.z, r0.z
mul r0.z, r3.x, r0.z
mul r1.w, r0.x, r0.z
mul o0.xyzw, r0.yyyy, r1.xyzw
ret 
// Approximately 0 instruction slots used

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