// yellow marker for airplane trials.
// And for car races,
// and for the mission markers.

cbuffer rage_matrices : register(b1)
{
  row_major float4x4 gWorld : packoffset(c0);
  row_major float4x4 gWorldView : packoffset(c4);
  row_major float4x4 gWorldViewProj : packoffset(c8);
  row_major float4x4 gViewInverse : packoffset(c12);
}
Texture2D<float4> StereoParmsTexture : register(t20);

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

void main( 
  float3 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  float4 v2 : COLOR0,
  float3 v3 : NORMAL0,
  float4 v4 : TANGENT0,
  uint v5 : SV_VertexID0,
  out float4 o0 : SV_Position0,
  out float4 o1 : COLOR0,
  out float4 o2 : TEXCOORD0,
  out float4 o3 : TEXCOORD1,
  out uint o4 : TEXCOORD2)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = gWorldViewProj._m10_m11_m12_m13 * v0.yyyy;
  r0.xyzw = v0.xxxx * gWorldViewProj._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v0.zzzz * gWorldViewProj._m20_m21_m22_m23 + r0.xyzw;
  r0.xyzw = gWorldViewProj._m30_m31_m32_m33 + r0.xyzw;
  
  r1.xyzw = StereoParmsTexture.Load(float4(0,0,0,0)).xyzw;
  // r1.y = -r1.y + r0.w;
  // r1.x = dot(r1.xx, r1.yy);
  // o0.x = r1.x + r0.x;
float4 stereoParams = StereoParams.Load(0);
o0.x = r0.x;
  o0.yzw = r0.yzw;
o0.x += stereoParams.x * (o0.w - stereoParams.y);

  
  // o0.yzw = r0.yzw;
  
  o1.xyzw = v2.xyzw;
  o2.xy = v1.xy;
  r0.xyzw = gWorld._m10_m11_m12_m13 * v0.yyyy;
  r0.xyzw = v0.xxxx * gWorld._m00_m01_m02_m03 + r0.xyzw;
  r0.xyzw = v0.zzzz * gWorld._m20_m21_m22_m23 + r0.xyzw;
  o3.xyzw = gWorld._m30_m31_m32_m33 + r0.xyzw;
  o4.x = v5.x;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.1.34 on Tue Jul 28 00:46:56 2015
//
//
// Buffer Definitions: 
//
// cbuffer rage_matrices
// {
//
//   row_major float4x4 gWorld;         // Offset:    0 Size:    64
//   row_major float4x4 gWorldView;     // Offset:   64 Size:    64 [unused]
//   row_major float4x4 gWorldViewProj; // Offset:  128 Size:    64
//   row_major float4x4 gViewInverse;   // Offset:  192 Size:    64 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// StereoParmsTexture                texture  float4          2d   20        1
// rage_matrices                     cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// TEXCOORD                 0   xy          1     NONE   float   xy  
// COLOR                    0   xyzw        2     NONE   float   xyzw
// NORMAL                   0   xyz         3     NONE   float       
// TANGENT                  0   xyzw        4     NONE   float       
// SV_VertexID              0   x           5   VERTID    uint   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy  
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 2   x           4     NONE    uint   x   
//
vs_4_0
dcl_constantbuffer cb1[12], immediateIndexed
dcl_resource_texture2d (float,float,float,float) t20
dcl_input v0.xyz
dcl_input v1.xy
dcl_input v2.xyzw
dcl_input_sgv v5.x, vertex_id
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xy
dcl_output o3.xyzw
dcl_output o4.x
dcl_temps 2
mul r0.xyzw, v0.yyyy, cb1[9].xyzw
mad r0.xyzw, v0.xxxx, cb1[8].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb1[10].xyzw, r0.xyzw
add r0.xyzw, r0.xyzw, cb1[11].xyzw
ld r1.xyzw, l(0, 0, 0, 0), t20.xyzw
add r1.y, r0.w, -r1.y
dp2 r1.x, r1.xxxx, r1.yyyy
add o0.x, r0.x, r1.x
mov o0.yzw, r0.yyzw
mov o1.xyzw, v2.xyzw
mov o2.xy, v1.xyxx
mul r0.xyzw, v0.yyyy, cb1[1].xyzw
mad r0.xyzw, v0.xxxx, cb1[0].xyzw, r0.xyzw
mad r0.xyzw, v0.zzzz, cb1[2].xyzw, r0.xyzw
add o3.xyzw, r0.xyzw, cb1[3].xyzw
mov o4.x, v5.x
ret 
// Approximately 17 instruction slots used

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