// Shadowcaster - Unlikely: moves shadows but PS basic

cbuffer _Globals : register(b0)
{
  row_major float3x4 m_xform : packoffset(c0);
  row_major float3x4 m_xform_v : packoffset(c3);
  float4 consts : packoffset(c6);
  float4 c_scale : packoffset(c7);
  float4 c_bias : packoffset(c8);
  float4 wind : packoffset(c9);
  float4 wave : packoffset(c10);
}

cbuffer static_globals : register(b1)
{
  row_major float3x4 m_V : packoffset(c0);
  row_major float4x4 m_P : packoffset(c3);
  row_major float4x4 m_VP : packoffset(c7);
  float4 timers : packoffset(c11);
  float4 fog_plane : packoffset(c12);
  float4 fog_params : packoffset(c13);
  float4 fog_color : packoffset(c14);
  float4 L_ambient : packoffset(c15);
  float3 L_sun_color : packoffset(c16);
  float3 L_sun_dir_w : packoffset(c17);
  float4 L_hemi_color : packoffset(c18);
  float3 eye_position : packoffset(c19);
  float4 pos_decompression_params : packoffset(c20);
  float4 pos_decompression_params2 : packoffset(c21);
}



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


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

  r0.xyz = (int3)v1.zxy;
  o0.xy = consts.xy * r0.yz;
  r0.x = consts.x * r0.x;
  r1.x = dot(m_xform._m00_m01_m02_m03, v0.xyzw);
  r1.z = dot(m_xform._m20_m21_m22_m23, v0.xyzw);
  r1.y = dot(m_xform._m10_m11_m12_m13, v0.xyzw);
  r0.y = dot(r1.xyz, wave.xyz);
  r0.y = wave.w + r0.y;
  r0.y = frac(r0.y);
  r0.y = r0.y * 2.82842708 + -1.41421366;
  r0.y = r0.y * r0.y + -1;
  r0.z = -m_xform._m13 + r1.y;
  r0.y = r0.z * r0.y;
  r0.yz = wind.xz * r0.yy;
  r1.xz = r0.xx * r0.yz + r1.xz;
  r1.w = 1;
  o1.x = dot(m_VP._m00_m01_m02_m03, r1.xyzw);
  o1.y = dot(m_VP._m10_m11_m12_m13, r1.xyzw);
  o1.z = dot(m_VP._m20_m21_m22_m23, r1.xyzw);
  o1.w = dot(m_VP._m30_m31_m32_m33, r1.xyzw);

  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.29 on Wed Apr 06 22:00:33 2016
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   row_major float3x4 m_xform;        // Offset:    0 Size:    48
//   row_major float3x4 m_xform_v;      // Offset:   48 Size:    48 [unused]
//   float4 consts;                     // Offset:   96 Size:    16
//   float4 c_scale;                    // Offset:  112 Size:    16 [unused]
//   float4 c_bias;                     // Offset:  128 Size:    16 [unused]
//   float4 wind;                       // Offset:  144 Size:    16
//   float4 wave;                       // Offset:  160 Size:    16
//
// }
//
// cbuffer static_globals
// {
//
//   row_major float3x4 m_V;            // Offset:    0 Size:    48 [unused]
//   row_major float4x4 m_P;            // Offset:   48 Size:    64 [unused]
//   row_major float4x4 m_VP;           // Offset:  112 Size:    64
//   float4 timers;                     // Offset:  176 Size:    16 [unused]
//   float4 fog_plane;                  // Offset:  192 Size:    16 [unused]
//   float4 fog_params;                 // Offset:  208 Size:    16 [unused]
//   float4 fog_color;                  // Offset:  224 Size:    16 [unused]
//   float4 L_ambient;                  // Offset:  240 Size:    16 [unused]
//   float3 L_sun_color;                // Offset:  256 Size:    12 [unused]
//   float3 L_sun_dir_w;                // Offset:  272 Size:    12 [unused]
//   float4 L_hemi_color;               // Offset:  288 Size:    16 [unused]
//   float3 eye_position;               // Offset:  304 Size:    12 [unused]
//   float4 pos_decompression_params;   // Offset:  320 Size:    16 [unused]
//   float4 pos_decompression_params2;  // Offset:  336 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// static_globals                    cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE     int   xyz 
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                 1   xy          0     NONE   float   xy  
// SV_Position              0   xyzw        1      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[11], immediateIndexed
dcl_constantbuffer cb1[11], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_output o0.xy
dcl_output_siv o1.xyzw, position
dcl_temps 2
itof r0.xyz, v1.zxyz
mul o0.xy, r0.yzyy, cb0[6].xyxx
mul r0.x, r0.x, cb0[6].x
dp4 r1.x, cb0[0].xyzw, v0.xyzw
dp4 r1.z, cb0[2].xyzw, v0.xyzw
dp4 r1.y, cb0[1].xyzw, v0.xyzw
dp3 r0.y, r1.xyzx, cb0[10].xyzx
add r0.y, r0.y, cb0[10].w
frc r0.y, r0.y
mad r0.y, r0.y, l(2.828427), l(-1.41421366)
mad r0.y, r0.y, r0.y, l(-1.000000)
add r0.z, r1.y, -cb0[1].w
mul r0.y, r0.y, r0.z
mul r0.yz, r0.yyyy, cb0[9].xxzx
mad r1.xz, r0.xxxx, r0.yyzy, r1.xxzx
mov r1.w, l(1.000000)
dp4 o1.x, cb1[7].xyzw, r1.xyzw
dp4 o1.y, cb1[8].xyzw, r1.xyzw
dp4 o1.z, cb1[9].xyzw, r1.xyzw
dp4 o1.w, cb1[10].xyzw, r1.xyzw
ret 
// Approximately 21 instruction slots used

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