//Shadows VS 1
//PS b58dce3491615a9b
//cbuffer cb3 : register(b3)
//{
//  float4 cb3[8];
//}

cbuffer PER_BATCH : register(b0)
{
  row_major float4x4 TexGen0 : packoffset(c0);
  float4 g_vViewPos : packoffset(c4);
  float4 fOneDivFarDist : packoffset(c5);
  float4 fDepthTestBias : packoffset(c6);
  float4 LSPos : packoffset(c7);
  row_major float4x4 RotMatrix : packoffset(c8);
}

cbuffer PER_INSTANCE : register(b1)
{
  row_major float4x4 CompMatrix : packoffset(c0);
}

cbuffer PER_FRAME : register(b3)
{
  row_major float4x4 g_VS_ViewProjMatr : packoffset(c0);  //new
  float4 g_VS_SunLightDir : packoffset(c4); //new
  float4 g_VS_WorldViewPos : packoffset(c6); //new
  float4 g_VS_ScreenSize : packoffset(c7);
  float4 g_VS_AnimGenParams : packoffset(c8); //new
  float4 g_VS_NearFarClipDist : packoffset(c9); //new
  row_major float4x4 g_VS_ViewProjZeroMatr : packoffset(c10); //new
  float4 g_VS_HPosScale : packoffset(c21);
  
}

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

void main( 
  float4 v0 : POSITION0,
  float4 v1 : TEXCOORD0,
  float3 v2 : TEXCOORD1,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  
      out float4 nearfar : TEXCOORD2,
  out float4 res : TEXCOORD3)
  
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  o0.x = dot(CompMatrix._m00_m01_m02_m03, v0.xyzw);
  o0.y = dot(CompMatrix._m10_m11_m12_m13, v0.xyzw);
  o0.z = dot(CompMatrix._m20_m21_m22_m23, v0.xyzw);
  o0.w = dot(CompMatrix._m30_m31_m32_m33, v0.xyzw);
  r0.xyz = g_vViewPos.xyz + v2.xyz;
  r0.yw = RotMatrix._m10_m11 * r0.yy;
  r0.xy = r0.xx * RotMatrix._m00_m01 + r0.yw;
  r0.xy = r0.zz * RotMatrix._m20_m21 + r0.xy;
  r0.zw = RotMatrix._m10_m11 * g_vViewPos.yy;
  r0.zw = g_vViewPos.xx * RotMatrix._m00_m01 + r0.zw;
  r0.zw = g_vViewPos.zz * RotMatrix._m20_m21 + r0.zw;
  o1.zw = r0.xy + -r0.zw;
  o1.xy = r0.zw;
  r0.xy = g_VS_ScreenSize.xy * v1.xy;
  o2.zw = float2(0.25,0.25) * r0.xy;
  o2.xy = v1.xy;
  
      //Pass far clipping plane and screen resolution through to pixel shader:
  nearfar = g_VS_NearFarClipDist;
  res = g_VS_ScreenSize;
  
  return;
}