//sparks
// ---- Created with 3Dmigoto v1.2.31 on Sat Feb 20 09:45:55 2016

cbuffer _Globals : register(b0)
{
  row_major float4x4 worldViewProjectionMatrix : packoffset(c0);
  row_major float4x4 viewInverseMatrix : packoffset(c4);
  float4 cameraInvVals : packoffset(c8);
  float2 cubeFadeValues : packoffset(c9);
  float gameTime : packoffset(c9.z);
  float pad0 : packoffset(c9.w);
  float4 sun_dir : packoffset(c10);
  float4 sun_color : packoffset(c11);
}

//-----------------------------------NEW-----------
cbuffer NVStereoCB : register(b12)
{
  float nv_negative_separation_convergence;
  float nv_separation;
  float nv_unused;
  float nv_stereo_enabled;
}


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


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

  r0.xy = float2(-0.5,-0.5) + v2.yx;
  r0.xy = v3.yx * r0.xy;
  r0.xy = r0.xy + r0.xy;
  sincos(v3.z, r1.x, r2.x);
  r0.z = r2.x * r0.x;
  r0.z = r1.x * r0.y + -r0.z;
  r1.yzw = v5.xyz * r0.zzz;
  r0.x = r1.x * r0.x;
  r0.x = r2.x * r0.y + r0.x;
  r0.xyz = v4.xyz * r0.xxx + r1.yzw;
  r0.xyz = v0.xyz + r0.xyz;
  r1.xyzw = worldViewProjectionMatrix._m10_m11_m12_m13 * r0.yyyy;
  r1.xyzw = r0.xxxx * worldViewProjectionMatrix._m00_m01_m02_m03 + r1.xyzw;
  r0.xyzw = r0.zzzz * worldViewProjectionMatrix._m20_m21_m22_m23 + r1.xyzw;
  r0.xyzw = worldViewProjectionMatrix._m30_m31_m32_m33 + r0.xyzw;
float4 stereo = StereoParams.Load(0);
r0.x += stereo.x*(r0.w - stereo.y);
  o0.xyzw = r0.xyzw;
  o3.xyzw = r0.xyzw;
  o1.xyzw = v1.xyzw;
  o2.xy = v2.xy;
  o2.z = v0.w;

//this removes the stereo applied by hueristics (the driver was
//only applying stereo to some textures)
if(nv_stereo_enabled > 1)
{
o0.x += nv_separation * o0.w + nv_negative_separation_convergence;
}
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//   using 3Dmigoto v1.2.31 on Sat Feb 20 09:45:55 2016
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   row_major float4x4 worldViewProjectionMatrix;// Offset:    0 Size:    64
//   row_major float4x4 viewInverseMatrix;// Offset:   64 Size:    64 [unused]
//   float4 cameraInvVals;              // Offset:  128 Size:    16 [unused]
//   float2 cubeFadeValues;             // Offset:  144 Size:     8 [unused]
//   float gameTime;                    // Offset:  152 Size:     4 [unused]
//   float pad0;                        // Offset:  156 Size:     4 [unused]
//   float4 sun_dir;                    // Offset:  160 Size:    16 [unused]
//   float4 sun_color;                  // Offset:  176 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xy          2     NONE   float   xy  
// TEXCOORD                 1   xyzw        3     NONE   float   xyz 
// TEXCOORD                 2   xyz         4     NONE   float   xyz 
// TEXCOORD                 3   xyz         5     NONE   float   xyz 
//
//
// 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   xyz         2     NONE   float   xyz 
// TEXCOORD                 1   xyzw        3     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[4], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xy
dcl_input v3.xyz
dcl_input v4.xyz
dcl_input v5.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_output o3.xyzw
dcl_temps 3
add r0.xy, v2.yxyy, l(-0.500000, -0.500000, 0.000000, 0.000000)
mul r0.xy, r0.xyxx, v3.yxyy
add r0.xy, r0.xyxx, r0.xyxx
sincos r1.x, r2.x, v3.z
mul r0.z, r0.x, r2.x
mad r0.z, r1.x, r0.y, -r0.z
mul r1.yzw, r0.zzzz, v5.xxyz
mul r0.x, r0.x, r1.x
mad r0.x, r2.x, r0.y, r0.x
mad r0.xyz, v4.xyzx, r0.xxxx, r1.yzwy
add r0.xyz, r0.xyzx, v0.xyzx
mul r1.xyzw, r0.yyyy, cb0[1].xyzw
mad r1.xyzw, r0.xxxx, cb0[0].xyzw, r1.xyzw
mad r0.xyzw, r0.zzzz, cb0[2].xyzw, r1.xyzw
add r0.xyzw, r0.xyzw, cb0[3].xyzw
mov o0.xyzw, r0.xyzw
mov o3.xyzw, r0.xyzw
mov o1.xyzw, v1.xyzw
mov o2.xy, v2.xyxx
mov o2.z, v0.w
ret 
// Approximately 21 instruction slots used

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