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

cbuffer cbSceneParam : register(b8)
{
  float4 FC_FarClipInfo : packoffset(c0);
  float4 FC_ScreenSize : packoffset(c1);
  float4x3 FC_MatrixView : packoffset(c2);
  float4x4 FC_MatrixInvViewProj : packoffset(c5);
  float4x4 FC_MatrixInvProj : packoffset(c9);
  float4x4 FC_MatrixProj : packoffset(c13);
  float4 FC_DepthComputeParam : packoffset(c17);
  float4 FC_ShadowMapParam : packoffset(c18);
  float4 FC_ShadowColor : packoffset(c19);
  float4 FC_ShadowDir : packoffset(c20);
  float4x4 VC_ShadowMapMatrix : packoffset(c21);
  float FC_ShadowDepthRate : packoffset(c25);
  float FC_ShadowDepthScale : packoffset(c25.y);
  float FC_ShadowKernelScale : packoffset(c25.z);
  float FC_ShadowRandTexInvScale : packoffset(c25.w);
  float FC_ShadowTexInvScaleX : packoffset(c26);
  float FC_ShadowTexInvScaleY : packoffset(c26.y);
  float FC_ShadowDepthOffsetScale : packoffset(c26.z);
  float4 FC_ShadowViewKernelScale : packoffset(c27);
  float4x4 FC_ProjSpaceToShadowMatrix[4] : packoffset(c28);
  float4 FC_CascadeSelectDist : packoffset(c44);
  float4x4 FC_MatrixInvView : packoffset(c45);
  float4 VC_ClipPlane : packoffset(c49);
  float4x4 VC_MatrixViewProj : packoffset(c50);
}

cbuffer cbInstanceData : register(b4)
{

  struct
  {
    float4x3 mWorld;
    float4 atlasUvScaleOffset;
    float4 userClipPlane;
    uint4 matricesData;
    uint4 envData;
    float4 mulCol;
    float envMapInterpRatio;
    float envMapColorScale0;
    float envMapColorScale1;
    float giOcclusionMask;
    float4 aSh[3];
  } VC_InstanceData[2] : packoffset(c0);

}

cbuffer cbMatrixWVP : register(b0)
{
  float4x4 VC_MatrixWVP : packoffset(c0);
  float4x4 VC_PrevMatrixWVP : packoffset(c4);
  float4x4 VC_NowToPrevView : packoffset(c8);
}

cbuffer cbMatrixCamera : register(b11)
{
  row_major float4x4 VC_MatrixCamera : packoffset(c0);
}

cbuffer cbObjMatrix : register(b5)
{
  float4x3 VC_aObjMatrix[2] : packoffset(c0);
}

cbuffer cbPrevObjMatrix : register(b6)
{
  float4x3 VC_aOldObjMatrix[2] : packoffset(c0);
}



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


void main( 
  float3 v0 : POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : NORMAL0,
  uint4 v3 : TANGENT0,
  float4 v4 : TEXCOORD0,
  float4 v5 : TEXCOORD1,
  float3 v6 : TEXCOORD2,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : COLOR0,
  out float3 o2 : NORMAL0,
  out float3 o3 : TANGENT0,
  out float3 o4 : BINORMAL0,
  out float4 o5 : POSITION1,
  out float4 o6 : POSITION2,
  out float4 o7 : TEXCOORD29,
  out float2 o8 : TEXCOORD0,
  out float2 p8 : TEXCOORD2,
  out float3 o9 : TEXCOORD17)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = -FC_MatrixInvView._m30;
  r0.y = -FC_MatrixInvView._m31;
  r0.z = -FC_MatrixInvView._m32;
  r0.w = (uint)VC_InstanceData[0].matricesData.x;
  r0.w = v2.w + r0.w;
  r0.w = (uint)r0.w;
  r0.w = (int)r0.w * 3;
  r1.xyz = v0.xyz;
  r1.w = 1;
  r2.x = dot(r1.xyzw, VC_aObjMatrix[r0.w/3]._m00_m10_m20_m30);
  r2.y = dot(r1.xyzw, VC_aObjMatrix[r0.w/3]._m01_m11_m21_m31);
  r2.z = dot(r1.xyzw, VC_aObjMatrix[r0.w/3]._m02_m12_m22_m32);
  r3.xyz = r2.xyz + r0.xyz;
  o7.xyz = VC_MatrixCamera._m30_m31_m32 + -r2.xyz;
  r3.w = 1;
  r2.x = dot(r3.xyzw, VC_MatrixViewProj._m00_m10_m20_m30);
  r2.y = dot(r3.xyzw, VC_MatrixViewProj._m01_m11_m21_m31);
  r2.z = dot(r3.xyzw, VC_MatrixViewProj._m02_m12_m22_m32);
  r2.w = dot(r3.xyzw, VC_MatrixViewProj._m03_m13_m23_m33);
  o0.xyzw = r2.xyzw;
  o5.xyzw = r2.xyzw;
  o1.xyzw = v1.xyzw;
  o2.x = dot(v2.xyz, VC_aObjMatrix[r0.w/3]._m00_m10_m20);
  o2.y = dot(v2.xyz, VC_aObjMatrix[r0.w/3]._m01_m11_m21);
  o2.z = dot(v2.xyz, VC_aObjMatrix[r0.w/3]._m02_m12_m22);
  r2.xyzw = (uint4)v3.xyzw;
  r2.xyzw = float4(-127,-127,-127,-127) + r2.xyzw;
  r2.xyzw = float4(0.00787401572,0.00787401572,0.00787401572,0.00787401572) * r2.xyzw;
  o3.x = dot(r2.xyz, VC_aObjMatrix[r0.w/3]._m00_m10_m20);
  o3.y = dot(r2.xyz, VC_aObjMatrix[r0.w/3]._m01_m11_m21);
  o3.z = dot(r2.xyz, VC_aObjMatrix[r0.w/3]._m02_m12_m22);
  r0.x = (uint)v2.w;
  r0.x = (int)r0.x * 3;
  r3.z = dot(r2.xyz, VC_aObjMatrix[r0.x]._m00_m10_m20);
  r3.x = dot(r2.xyz, VC_aObjMatrix[r0.x]._m01_m11_m21);
  r3.y = dot(r2.xyz, VC_aObjMatrix[r0.x]._m02_m12_m22);
  r2.y = dot(v2.xyz, VC_aObjMatrix[r0.x]._m00_m10_m20);
  r2.z = dot(v2.xyz, VC_aObjMatrix[r0.x]._m01_m11_m21);
  r2.x = dot(v2.xyz, VC_aObjMatrix[r0.x]._m02_m12_m22);
  r0.xyz = r2.xyz * r3.xyz;
  r0.xyz = r2.zxy * r3.yzx + -r0.xyz;
  o4.xyz = r0.xyz * r2.www;
  r2.x = dot(r1.xyzw, VC_aOldObjMatrix[r0.x]._m00_m10_m20_m30);
  r2.y = dot(r1.xyzw, VC_aOldObjMatrix[r0.x]._m01_m11_m21_m31);
  r2.z = dot(r1.xyzw, VC_aOldObjMatrix[r0.x]._m02_m12_m22_m32);
  r2.w = 1;
  o6.x = dot(r2.xyzw, VC_PrevMatrixWVP._m00_m10_m20_m30);
  o6.y = dot(r2.xyzw, VC_PrevMatrixWVP._m01_m11_m21_m31);
  o6.z = dot(r2.xyzw, VC_PrevMatrixWVP._m02_m12_m22_m32);
  o6.w = dot(r2.xyzw, VC_PrevMatrixWVP._m03_m13_m23_m33);
  o8.xy = float2(0.00048828125,0.00048828125) * v4.xy;
  p8.xy = float2(0.00048828125,0.00048828125) * v5.xy;
  o9.xyz = v6.xyz;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//
// Buffer Definitions: 
//
// cbuffer cbSceneParam
// {
//
//   float4 FC_FarClipInfo;             // Offset:    0 Size:    16 [unused]
//   float4 FC_ScreenSize;              // Offset:   16 Size:    16 [unused]
//   float4x3 FC_MatrixView;            // Offset:   32 Size:    48 [unused]
//   float4x4 FC_MatrixInvViewProj;     // Offset:   80 Size:    64 [unused]
//   float4x4 FC_MatrixInvProj;         // Offset:  144 Size:    64 [unused]
//   float4x4 FC_MatrixProj;            // Offset:  208 Size:    64 [unused]
//   float4 FC_DepthComputeParam;       // Offset:  272 Size:    16 [unused]
//   float4 FC_ShadowMapParam;          // Offset:  288 Size:    16 [unused]
//   float4 FC_ShadowColor;             // Offset:  304 Size:    16 [unused]
//   float4 FC_ShadowDir;               // Offset:  320 Size:    16 [unused]
//   float4x4 VC_ShadowMapMatrix;       // Offset:  336 Size:    64 [unused]
//   float FC_ShadowDepthRate;          // Offset:  400 Size:     4 [unused]
//   float FC_ShadowDepthScale;         // Offset:  404 Size:     4 [unused]
//   float FC_ShadowKernelScale;        // Offset:  408 Size:     4 [unused]
//   float FC_ShadowRandTexInvScale;    // Offset:  412 Size:     4 [unused]
//   float FC_ShadowTexInvScaleX;       // Offset:  416 Size:     4 [unused]
//   float FC_ShadowTexInvScaleY;       // Offset:  420 Size:     4 [unused]
//   float FC_ShadowDepthOffsetScale;   // Offset:  424 Size:     4 [unused]
//   float4 FC_ShadowViewKernelScale;   // Offset:  432 Size:    16 [unused]
//   float4x4 FC_ProjSpaceToShadowMatrix[4];// Offset:  448 Size:   256 [unused]
//   float4 FC_CascadeSelectDist;       // Offset:  704 Size:    16 [unused]
//   float4x4 FC_MatrixInvView;         // Offset:  720 Size:    64
//   float4 VC_ClipPlane;               // Offset:  784 Size:    16 [unused]
//   float4x4 VC_MatrixViewProj;        // Offset:  800 Size:    64
//
// }
//
// cbuffer cbInstanceData
// {
//
//   struct PerInstanceData
//   {
//       
//       float4x3 mWorld;               // Offset:    0
//       float4 atlasUvScaleOffset;     // Offset:   48
//       float4 userClipPlane;          // Offset:   64
//       uint4 matricesData;            // Offset:   80
//       uint4 envData;                 // Offset:   96
//       float4 mulCol;                 // Offset:  112
//       float envMapInterpRatio;       // Offset:  128
//       float envMapColorScale0;       // Offset:  132
//       float envMapColorScale1;       // Offset:  136
//       float giOcclusionMask;         // Offset:  140
//       float4 aSh[3];                 // Offset:  144
//
//   } VC_InstanceData[2];              // Offset:    0 Size:   384
//
// }
//
// cbuffer cbMatrixWVP
// {
//
//   float4x4 VC_MatrixWVP;             // Offset:    0 Size:    64 [unused]
//   float4x4 VC_PrevMatrixWVP;         // Offset:   64 Size:    64
//   float4x4 VC_NowToPrevView;         // Offset:  128 Size:    64 [unused]
//
// }
//
// cbuffer cbMatrixCamera
// {
//
//   row_major float4x4 VC_MatrixCamera;// Offset:    0 Size:    64
//
// }
//
// cbuffer cbObjMatrix
// {
//
//   float4x3 VC_aObjMatrix[2];         // Offset:    0 Size:    96
//
// }
//
// cbuffer cbPrevObjMatrix
// {
//
//   float4x3 VC_aOldObjMatrix[2];      // Offset:    0 Size:    96
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// cbMatrixWVP                       cbuffer      NA          NA    0        1
// cbInstanceData                    cbuffer      NA          NA    4        1
// cbObjMatrix                       cbuffer      NA          NA    5        1
// cbPrevObjMatrix                   cbuffer      NA          NA    6        1
// cbSceneParam                      cbuffer      NA          NA    8        1
// cbMatrixCamera                    cbuffer      NA          NA   11        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// COLOR                    0   xyzw        1     NONE   float   xyzw
// NORMAL                   0   xyzw        2     NONE   float   xyzw
// TANGENT                  0   xyzw        3     NONE    uint   xyzw
// TEXCOORD                 0   xy          4     NONE   float   xy  
// TEXCOORD                 1   xy          5     NONE   float   xy  
// TEXCOORD                 2   xyz         6     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
// NORMAL                   0   xyz         2     NONE   float   xyz 
// TANGENT                  0   xyz         3     NONE   float   xyz 
// BINORMAL                 0   xyz         4     NONE   float   xyz 
// POSITION                 1   xyzw        5     NONE   float   xyzw
// POSITION                 2   xyzw        6     NONE   float   xyzw
// TEXCOORD                29   xyz         7     NONE   float   xyz 
// TEXCOORD                 0   xy          8     NONE   float   xy  
// TEXCOORD                 2     zw        8     NONE   float     zw
// TEXCOORD                17   xyz         9     NONE   float   xyz 
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb8[54], immediateIndexed
dcl_constantbuffer cb4[6], immediateIndexed
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb11[4], immediateIndexed
dcl_constantbuffer cb5[6], dynamicIndexed
dcl_constantbuffer cb6[6], dynamicIndexed
dcl_input v0.xyz
dcl_input v1.xyzw
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_input v4.xy
dcl_input v5.xy
dcl_input v6.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyz
dcl_output o3.xyz
dcl_output o4.xyz
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyz
dcl_output o8.xy
dcl_output o8.zw
dcl_output o9.xyz
dcl_temps 4
mov r0.x, -cb8[45].w
mov r0.y, -cb8[46].w
mov r0.z, -cb8[47].w
utof r0.w, cb4[5].x
add r0.w, r0.w, v2.w
ftou r0.w, r0.w
imul null, r0.w, r0.w, l(3)
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb5[r0.w + 0].xyzw
dp4 r2.y, r1.xyzw, cb5[r0.w + 1].xyzw
dp4 r2.z, r1.xyzw, cb5[r0.w + 2].xyzw
add r3.xyz, r0.xyzx, r2.xyzx
add o7.xyz, -r2.xyzx, cb11[3].xyzx
mov r3.w, l(1.000000)
dp4 r2.x, r3.xyzw, cb8[50].xyzw
dp4 r2.y, r3.xyzw, cb8[51].xyzw
dp4 r2.z, r3.xyzw, cb8[52].xyzw
dp4 r2.w, r3.xyzw, cb8[53].xyzw
mov o0.xyzw, r2.xyzw
mov o5.xyzw, r2.xyzw
mov o1.xyzw, v1.xyzw
dp3 o2.x, v2.xyzx, cb5[r0.w + 0].xyzx
dp3 o2.y, v2.xyzx, cb5[r0.w + 1].xyzx
dp3 o2.z, v2.xyzx, cb5[r0.w + 2].xyzx
utof r2.xyzw, v3.xyzw
add r2.xyzw, r2.xyzw, l(-127.000000, -127.000000, -127.000000, -127.000000)
mul r2.xyzw, r2.xyzw, l(0.007874, 0.007874, 0.007874, 0.007874)
dp3 o3.x, r2.xyzx, cb5[r0.w + 0].xyzx
dp3 o3.y, r2.xyzx, cb5[r0.w + 1].xyzx
dp3 o3.z, r2.xyzx, cb5[r0.w + 2].xyzx
ftou r0.x, v2.w
imul null, r0.x, r0.x, l(3)
dp3 r3.z, r2.xyzx, cb5[r0.x + 0].xyzx
dp3 r3.x, r2.xyzx, cb5[r0.x + 1].xyzx
dp3 r3.y, r2.xyzx, cb5[r0.x + 2].xyzx
dp3 r2.y, v2.xyzx, cb5[r0.x + 0].xyzx
dp3 r2.z, v2.xyzx, cb5[r0.x + 1].xyzx
dp3 r2.x, v2.xyzx, cb5[r0.x + 2].xyzx
mul r0.xyz, r3.xyzx, r2.xyzx
mad r0.xyz, r2.zxyz, r3.yzxy, -r0.xyzx
mul o4.xyz, r2.wwww, r0.xyzx
dp4 r2.x, r1.xyzw, cb6[r0.w + 0].xyzw
dp4 r2.y, r1.xyzw, cb6[r0.w + 1].xyzw
dp4 r2.z, r1.xyzw, cb6[r0.w + 2].xyzw
mov r2.w, l(1.000000)
dp4 o6.x, r2.xyzw, cb0[4].xyzw
dp4 o6.y, r2.xyzw, cb0[5].xyzw
dp4 o6.z, r2.xyzw, cb0[6].xyzw
dp4 o6.w, r2.xyzw, cb0[7].xyzw
mul o8.xy, v4.xyxx, l(0.000488, 0.000488, 0.000000, 0.000000)
mul o8.zw, v5.xxxy, l(0.000000, 0.000000, 0.000488, 0.000488)
mov o9.xyz, v6.xyzx
ret 
// Approximately 54 instruction slots used

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