//Sun beams
cbuffer PER_BATCH : register(b0)
{
  float3 slHazeColPartialMieInScatter : packoffset(c0);
  float4 SkyDome_NightMoonDirSize : packoffset(c1);
  float4 miscCamFront : packoffset(c2);
  float3 vfColGradDelta : packoffset(c3);
  float4 vfRampParams : packoffset(c4);
  float4 PS_NearFarClipDist : packoffset(c5);
  float3 slSunDirection : packoffset(c6);
  float3 vfColGradBase : packoffset(c7);
  float3 slHazeColPartialRayleighInScatter : packoffset(c8);
  float3 vfFogColor : packoffset(c9);
  float3 slPhaseFunctionConstants : packoffset(c10);
  float4 vfParams : packoffset(c11);
  float4 vfViewPos : packoffset(c12);
}

cbuffer STATIC_INSTANCE : register(b2)
{
  row_major float3x4 ObjWorldMatrix : packoffset(c0);
}

cbuffer PER_FRAME : register(b3)
{
  float4 g_VS_WorldViewPos : packoffset(c6);
  float4 g_VS_NearFarClipDist : packoffset(c9);
  row_major float4x4 g_VS_ViewProjZeroMatr : packoffset(c10);
}

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

void main( 
  float4 v0 : POSITION0,
  float2 v1 : TEXCOORD0,
  out float4 o0 : SV_Position0,
  out float4 o1 : TEXCOORD0,
  out float3 o2 : TEXCOORD1)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.w = -g_VS_WorldViewPos.x + ObjWorldMatrix._m03;
  r0.xyz = ObjWorldMatrix._m00_m01_m02;
  r0.x = dot(r0.xyzw, v0.xyzw);
  r1.w = -g_VS_WorldViewPos.y + ObjWorldMatrix._m13;
  r1.xyz = ObjWorldMatrix._m10_m11_m12;
  r0.y = dot(r1.xyzw, v0.xyzw);
  r1.w = -g_VS_WorldViewPos.z + ObjWorldMatrix._m23;
  r1.xyz = ObjWorldMatrix._m20_m21_m22;
  r0.z = dot(r1.xyzw, v0.xyzw);
  r0.w = v0.w;
  r1.x = dot(g_VS_ViewProjZeroMatr._m00_m01_m02_m03, r0.xyzw);
  r1.y = dot(g_VS_ViewProjZeroMatr._m10_m11_m12_m13, r0.xyzw);
  r1.z = dot(g_VS_ViewProjZeroMatr._m30_m31_m32_m33, r0.xyzw);
  o0.xyzw = r1.xyzz;
  
  float4 stereo = StereoParams.Load(0);
  o0.x += stereo.x * stereo.y;
  
  r0.xyz = float3(1,0,0) * SkyDome_NightMoonDirSize.xyz;
  r0.xyz = SkyDome_NightMoonDirSize.zxy * float3(0,0,1) + -r0.xyz;
  r1.xyz = SkyDome_NightMoonDirSize.zxy * r0.xyz;
  r1.xyz = SkyDome_NightMoonDirSize.yzx * r0.yzx + -r1.xyz;
  r0.w = dot(r0.zx, v0.xy);
  r0.z = dot(r1.xyz, v0.xyz);
  o1.zw = r0.zw * SkyDome_NightMoonDirSize.ww + float2(0.5,0.5);
  o1.xy = v1.xy;
  o2.xyz = v0.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.1 on Fri Aug 28 23:06:43 2015
//
//
// Buffer Definitions: 
//
// cbuffer PER_BATCH
// {
//
//   float3 slHazeColPartialMieInScatter;// Offset:    0 Size:    12 [unused]
//   float4 SkyDome_NightMoonDirSize;   // Offset:   16 Size:    16
//   float4 miscCamFront;               // Offset:   32 Size:    16 [unused]
//   float3 vfColGradDelta;             // Offset:   48 Size:    12 [unused]
//   float4 vfRampParams;               // Offset:   64 Size:    16 [unused]
//   float4 PS_NearFarClipDist;         // Offset:   80 Size:    16 [unused]
//   float3 slSunDirection;             // Offset:   96 Size:    12 [unused]
//   float3 vfColGradBase;              // Offset:  112 Size:    12 [unused]
//   float3 slHazeColPartialRayleighInScatter;// Offset:  128 Size:    12 [unused]
//   float3 vfFogColor;                 // Offset:  144 Size:    12 [unused]
//   float3 slPhaseFunctionConstants;   // Offset:  160 Size:    12 [unused]
//   float4 vfParams;                   // Offset:  176 Size:    16 [unused]
//   float4 vfViewPos;                  // Offset:  192 Size:    16 [unused]
//
// }
//
// cbuffer STATIC_INSTANCE
// {
//
//   row_major float3x4 ObjWorldMatrix; // Offset:    0 Size:    48
//
// }
//
// cbuffer PER_FRAME
// {
//
//   float4 g_VS_WorldViewPos;          // Offset:   96 Size:    16
//   float4 g_VS_NearFarClipDist;       // Offset:  144 Size:    16 [unused]
//   row_major float4x4 g_VS_ViewProjZeroMatr;// Offset:  160 Size:    64
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// PER_BATCH                         cbuffer      NA          NA    0        1
// STATIC_INSTANCE                   cbuffer      NA          NA    2        1
// PER_FRAME                         cbuffer      NA          NA    3        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyz         2     NONE   float   xyz 
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[2], immediateIndexed
dcl_constantbuffer cb2[3], immediateIndexed
dcl_constantbuffer cb3[14], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_temps 2
add r0.w, cb2[0].w, -cb3[6].x
mov r0.xyz, cb2[0].xyzx
dp4 r0.x, r0.xyzw, v0.xyzw
add r1.w, cb2[1].w, -cb3[6].y
mov r1.xyz, cb2[1].xyzx
dp4 r0.y, r1.xyzw, v0.xyzw
add r1.w, cb2[2].w, -cb3[6].z
mov r1.xyz, cb2[2].xyzx
dp4 r0.z, r1.xyzw, v0.xyzw
mov r0.w, v0.w
dp4 r1.x, cb3[10].xyzw, r0.xyzw
dp4 r1.y, cb3[11].xyzw, r0.xyzw
dp4 r1.z, cb3[13].xyzw, r0.xyzw
mov o0.xyzw, r1.xyzz
mul r0.xyz, cb0[1].xyzx, l(1.000000, 0.000000, 0.000000, 0.000000)
mad r0.xyz, cb0[1].zxyz, l(0.000000, 0.000000, 1.000000, 0.000000), -r0.xyzx
mul r1.xyz, r0.xyzx, cb0[1].zxyz
mad r1.xyz, cb0[1].yzxy, r0.yzxy, -r1.xyzx
dp2 r0.w, r0.zxzz, v0.xyxx
dp3 r0.z, r1.xyzx, v0.xyzx
mad o1.zw, r0.zzzw, cb0[1].wwww, l(0.000000, 0.000000, 0.500000, 0.500000)
mov o1.xy, v1.xyxx
mov o2.xyz, v0.xyzx
ret 
// Approximately 24 instruction slots used

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