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

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

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


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

void main( 
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  float2 v2 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float2 o3 : TEXCOORD2)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = cb2[1].xyzw * v0.yyyy;
  r0.xyzw = cb2[0].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb2[2].xyzw * v0.zzzz + r0.xyzw;
  r0.xyzw = cb2[3].xywz * v0.wwww + r0.xywz;
  o0.xyzw = r0.xywz;
float4 stereo = StereoParams.Load(0);
r0.x += stereo.x*(r0.w - stereo.y);
  r1.xyzw = cb2[1].xyzw * v1.yyyy;
  r1.xyzw = cb2[0].xyzw * v1.xxxx + r1.xyzw;
  r1.xyzw = cb2[2].xyzw * v1.zzzz + r1.xyzw;
  r1.xyzw = cb2[3].xyzw + r1.xyzw;
  r1.xyz = float3(1,-1,1) * r1.xyz;
  r1.xyz = r1.xyz / r1.www;
  r2.xyz = float3(1,-1,1) * r0.xyw;
  r2.xyz = r2.xyz / r0.zzz;
  r1.xyz = r2.xyz + -r1.xyz;
  o1.xyz = cb0[11].yyy * r1.xyz;
  o1.w = 0;
  r1.x = 0 < cb1[5].x;
  r0.y = r1.x ? -r0.y : r0.y;
  o2.zw = r0.wz;
  r1.xz = float2(0.5,0.5);
  r1.y = cb1[5].x;
  r0.xyz = r1.xyz * r0.xyz;
  r0.w = 0.5 * r0.y;
  o2.xy = r0.xw + r0.zz;
  o3.xy = v2.xy * cb0[13].xy + cb0[13].zw;
  return;
}