// cloud 
cbuffer _Globals : register(b0)
{
  float4x4 viewProjInverse : packoffset(c0);
}

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

void main( 
  uint v0 : SV_VertexID0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float3 o2 : TEXCOORD1)
{
  const float4 icb[] = { { -1.000000, -1.000000, 0, 0},
                              { 1.000000, -1.000000, 0, 0},
                              { -1.000000, 1.000000, 0, 0},
                              { 1.000000, 1.000000, 0, 0} };

  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;
float4 stereo = StereoParams.Load(0); 
float4 iniParams = IniParams.Load(0);
float tex_filter = iniParams.z;
//reduce the horizon problem but make sky whyte...
// float tempo=iniParams.w;
float tempo=1.0;

  o0.zw = float2(0,1);
  r0.x = v0.x;
// w = 1 for o0 
  o0.xy = icb[r0.x+0].xy;
  o1.xy = icb[r0.x+0].xy * float2(0.5,0.5) + float2(0.5,0.5);
  r0.xy = icb[r0.x+0].xy;
//reduce (but not suppress) the horizon problem
r0.x = r0.x - stereo.x * (1.0 - stereo.y); 
  r0.z = 1.0;
  o2.x = dot(r0.xyz, viewProjInverse._m00_m10_m30);
  o2.y = dot(r0.xyz, viewProjInverse._m01_m11_m31)*tempo;
  o2.z = dot(r0.xyz, viewProjInverse._m02_m12_m32);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20789
//
//   using 3Dmigoto v1.2.1 on Sat Oct 17 13:50:40 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4x4 viewProjInverse;          // Offset:    0 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_VertexID              0   x           0   VERTID    uint   x   
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy  
// TEXCOORD                 1   xyz         2     NONE   float   xyz 
//
vs_4_0
dcl_immediateConstantBuffer { { -1.000000, -1.000000, 0, 0},
                              { 1.000000, -1.000000, 0, 0},
                              { -1.000000, 1.000000, 0, 0},
                              { 1.000000, 1.000000, 0, 0} }
dcl_constantbuffer cb0[3], immediateIndexed
dcl_input_sgv v0.x, vertex_id
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o2.xyz
dcl_temps 1
mov o0.zw, l(0,0,0,1.000000)
mov r0.x, v0.x
mov o0.xy, icb[r0.x + 0].xyxx
mad o1.xy, icb[r0.x + 0].xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
mov r0.xy, icb[r0.x + 0].xyxx
mov r0.z, l(1.000000)
dp3 o2.x, r0.xyzx, cb0[0].xywx
dp3 o2.y, r0.xyzx, cb0[1].xywx
dp3 o2.z, r0.xyzx, cb0[2].xywx
ret 
// Approximately 10 instruction slots used

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