// ---- Created with 3Dmigoto v1.2.35 on Tue Apr 26 22:30:55 2016

cbuffer VSCommonBuffer : register(b0)
{
  float4x4 g_viewProjectionMatrix : packoffset(c0);
  float4x4 g_viewMatrix : packoffset(c4);
  float4x4 g_projectionMatrix : packoffset(c8);
  float4x4 g_worldViewProjectionMatrix : packoffset(c12);
  float4 g_nearFarParam : packoffset(c16);
  float3 g_lightDir : packoffset(c17);
  float g_fogStartZ : packoffset(c18);
  float g_recFogEndZ : packoffset(c18.y);
  float g_fogStartY : packoffset(c18.z);
  float g_recFogEndY : packoffset(c18.w);
  float2 g_screenSize : packoffset(c19);
  float2 g_recScreenSize : packoffset(c19.z);
  float g_nearFar : packoffset(c20);
  float g_nearFarDistance : packoffset(c20.y);
  float g_far : packoffset(c20.z);
  float g_near : packoffset(c20.w);
  float3 g_eye : packoffset(c21);
  float2 g_fbTexCoef : packoffset(c22);
  float3 g_lightDir2 : packoffset(c23);
  float g_vs_fadeNearStart : packoffset(c24);
  float g_vs_fadeNearDist : packoffset(c24.y);
  float g_vs_fadeFarStart : packoffset(c24.z);
  float g_vs_fadeFarDist : packoffset(c24.w);
  float4 g_vs_softSpriteParam : packoffset(c25);
  float2 g_vs_softSpriteScaleOffset : packoffset(c26);
  float2 g_vs_softSpriteScaleOffsetDummy : packoffset(c26.z);
  float3 g_camerapos : packoffset(c27);
}



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


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

  o0.xyzw = v2.xyzw * v1.xyzw;
  r0.x = g_screenSize.y * v0.w;
  r1.xyz = v0.xyz;
  r1.w = 1;
  r2.x = dot(r1.xyzw, g_viewMatrix._m00_m10_m20_m30);
  r2.y = dot(r1.xyzw, g_viewMatrix._m01_m11_m21_m31);
  r2.z = dot(r1.xyzw, g_viewMatrix._m02_m12_m22_m32);
  r2.w = dot(r1.xyzw, g_viewMatrix._m03_m13_m23_m33);
  r0.y = dot(r2.xyzw, r2.xyzw);
  r0.y = sqrt(r0.y);
  r0.x = r0.x / r0.y;
  r0.xy = g_recScreenSize.xy * r0.xx;
  r0.z = dot(r2.xyzw, g_projectionMatrix._m03_m13_m23_m33);
  o1.xy = r0.xy * r0.zz;
  r0.x = -g_fogStartZ + r0.z;
  o3.w = r0.z;
  o1.z = saturate(g_recFogEndZ * r0.x);
  o2.xyz = g_eye.xyz + -v0.xyz;
  o2.w = 0;
  o3.x = dot(r2.xyzw, g_projectionMatrix._m00_m10_m20_m30);
  o3.y = dot(r2.xyzw, g_projectionMatrix._m01_m11_m21_m31);
  o3.z = dot(r2.xyzw, g_projectionMatrix._m02_m12_m22_m32);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer VSCommonBuffer
// {
//
//   float4x4 g_viewProjectionMatrix;   // Offset:    0 Size:    64 [unused]
//   float4x4 g_viewMatrix;             // Offset:   64 Size:    64
//   float4x4 g_projectionMatrix;       // Offset:  128 Size:    64
//   float4x4 g_worldViewProjectionMatrix;// Offset:  192 Size:    64 [unused]
//   float4 g_nearFarParam;             // Offset:  256 Size:    16 [unused]
//   float3 g_lightDir;                 // Offset:  272 Size:    12 [unused]
//   float g_fogStartZ;                 // Offset:  288 Size:     4
//   float g_recFogEndZ;                // Offset:  292 Size:     4
//   float g_fogStartY;                 // Offset:  296 Size:     4 [unused]
//   float g_recFogEndY;                // Offset:  300 Size:     4 [unused]
//   float2 g_screenSize;               // Offset:  304 Size:     8
//   float2 g_recScreenSize;            // Offset:  312 Size:     8
//   float g_nearFar;                   // Offset:  320 Size:     4 [unused]
//   float g_nearFarDistance;           // Offset:  324 Size:     4 [unused]
//   float g_far;                       // Offset:  328 Size:     4 [unused]
//   float g_near;                      // Offset:  332 Size:     4 [unused]
//   float3 g_eye;                      // Offset:  336 Size:    12
//   float2 g_fbTexCoef;                // Offset:  352 Size:     8 [unused]
//   float3 g_lightDir2;                // Offset:  368 Size:    12 [unused]
//   float g_vs_fadeNearStart;          // Offset:  384 Size:     4 [unused]
//   float g_vs_fadeNearDist;           // Offset:  388 Size:     4 [unused]
//   float g_vs_fadeFarStart;           // Offset:  392 Size:     4 [unused]
//   float g_vs_fadeFarDist;            // Offset:  396 Size:     4 [unused]
//   float4 g_vs_softSpriteParam;       // Offset:  400 Size:    16 [unused]
//   float2 g_vs_softSpriteScaleOffset; // Offset:  416 Size:     8 [unused]
//   float2 g_vs_softSpriteScaleOffsetDummy;// Offset:  424 Size:     8 [unused]
//   float3 g_camerapos;                // Offset:  432 Size:    12 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// VSCommonBuffer                    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
// COLOR                    1   xyzw        2     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// COLOR                    0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyz         1     NONE   float   xyz 
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// SV_POSITION              0   xyzw        3      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[22], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_output o0.xyzw
dcl_output o1.xyz
dcl_output o2.xyzw
dcl_output_siv o3.xyzw, position
dcl_temps 3
mul o0.xyzw, v1.xyzw, v2.xyzw
mul r0.x, v0.w, cb0[19].y
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb0[4].xyzw
dp4 r2.y, r1.xyzw, cb0[5].xyzw
dp4 r2.z, r1.xyzw, cb0[6].xyzw
dp4 r2.w, r1.xyzw, cb0[7].xyzw
dp4 r0.y, r2.xyzw, r2.xyzw
sqrt r0.y, r0.y
div r0.x, r0.x, r0.y
mul r0.xy, r0.xxxx, cb0[19].zwzz
dp4 r0.z, r2.xyzw, cb0[11].xyzw
mul o1.xy, r0.zzzz, r0.xyxx
add r0.x, r0.z, -cb0[18].x
mov o3.w, r0.z
mul_sat o1.z, r0.x, cb0[18].y
add o2.xyz, -v0.xyzx, cb0[21].xyzx
mov o2.w, l(0)
dp4 o3.x, r2.xyzw, cb0[8].xyzw
dp4 o3.y, r2.xyzw, cb0[9].xyzw
dp4 o3.z, r2.xyzw, cb0[10].xyzw
ret 
// Approximately 23 instruction slots used

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