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

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);
}

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

cbuffer cbObjMatrix : register(b5)
{
  float4x3 VC_aObjMatrix[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;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.w = 1;
  r1.xyz = v0.xyz;
  r1.w = 1;
  r2.x = (uint)VC_InstanceData[0].matricesData.x;
  r2.x = v2.w + r2.x;
  r2.x = (uint)r2.x;
  r2.x = (int)r2.x * 3;
  r0.x = dot(r1.xyzw, VC_aObjMatrix[r2.x]._m00_m10_m20_m30);
  r0.y = dot(r1.xyzw, VC_aObjMatrix[r2.x]._m01_m11_m21_m31);
  r0.z = dot(r1.xyzw, VC_aObjMatrix[r2.x]._m02_m12_m22_m32);
  r1.x = dot(r0.xyzw, VC_MatrixWVP._m00_m10_m20_m30);
  r1.y = dot(r0.xyzw, VC_MatrixWVP._m01_m11_m21_m31);
  r1.z = dot(r0.xyzw, VC_MatrixWVP._m02_m12_m22_m32);
  r1.w = dot(r0.xyzw, VC_MatrixWVP._m03_m13_m23_m33);
  o7.xyz = VC_MatrixCamera._m30_m31_m32 + -r0.xyz;
  o0.xyzw = r1.xyzw;
  o5.xyzw = r1.xyzw;
  o1.xyzw = v1.xyzw;
  o2.x = dot(v2.xyz, VC_aObjMatrix[r2.x]._m00_m10_m20);
  o2.y = dot(v2.xyz, VC_aObjMatrix[r2.x]._m01_m11_m21);
  o2.z = dot(v2.xyz, VC_aObjMatrix[r2.x]._m02_m12_m22);
  r0.xyzw = (uint4)v3.xyzw;
  r0.xyzw = float4(-127,-127,-127,-127) + r0.xyzw;
  r0.xyzw = float4(0.00787401572,0.00787401572,0.00787401572,0.00787401572) * r0.xyzw;
  o3.x = dot(r0.xyz, VC_aObjMatrix[r2.x]._m00_m10_m20);
  o3.y = dot(r0.xyz, VC_aObjMatrix[r2.x]._m01_m11_m21);
  o3.z = dot(r0.xyz, VC_aObjMatrix[r2.x]._m02_m12_m22);
  r1.x = (uint)v2.w;
  r1.x = (int)r1.x * 3;
  r2.z = dot(r0.xyz, VC_aObjMatrix[r1.x]._m00_m10_m20);
  r2.x = dot(r0.xyz, VC_aObjMatrix[r1.x]._m01_m11_m21);
  r2.y = dot(r0.xyz, VC_aObjMatrix[r1.x]._m02_m12_m22);
  r0.y = dot(v2.xyz, VC_aObjMatrix[r1.x]._m00_m10_m20);
  r0.z = dot(v2.xyz, VC_aObjMatrix[r1.x]._m01_m11_m21);
  r0.x = dot(v2.xyz, VC_aObjMatrix[r1.x]._m02_m12_m22);
  r1.xyz = r0.xyz * r2.xyz;
  r0.xyz = r0.zxy * r2.yzx + -r1.xyz;
  o4.xyz = r0.xyz * r0.www;
  o6.xyzw = float4(1,1,1,1);
  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 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
//
// }
//
// cbuffer cbMatrixCamera
// {
//
//   row_major float4x4 VC_MatrixCamera;// Offset:    0 Size:    64
//
// }
//
// cbuffer cbObjMatrix
// {
//
//   float4x3 VC_aObjMatrix[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
// 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 cb4[6], immediateIndexed
dcl_constantbuffer cb0[4], immediateIndexed
dcl_constantbuffer cb11[4], immediateIndexed
dcl_constantbuffer cb5[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 3
mov r0.w, l(1.000000)
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
utof r2.x, cb4[5].x
add r2.x, r2.x, v2.w
ftou r2.x, r2.x
imul null, r2.x, r2.x, l(3)
dp4 r0.x, r1.xyzw, cb5[r2.x + 0].xyzw
dp4 r0.y, r1.xyzw, cb5[r2.x + 1].xyzw
dp4 r0.z, r1.xyzw, cb5[r2.x + 2].xyzw
dp4 r1.x, r0.xyzw, cb0[0].xyzw
dp4 r1.y, r0.xyzw, cb0[1].xyzw
dp4 r1.z, r0.xyzw, cb0[2].xyzw
dp4 r1.w, r0.xyzw, cb0[3].xyzw
add o7.xyz, -r0.xyzx, cb11[3].xyzx
mov o0.xyzw, r1.xyzw
mov o5.xyzw, r1.xyzw
mov o1.xyzw, v1.xyzw
dp3 o2.x, v2.xyzx, cb5[r2.x + 0].xyzx
dp3 o2.y, v2.xyzx, cb5[r2.x + 1].xyzx
dp3 o2.z, v2.xyzx, cb5[r2.x + 2].xyzx
utof r0.xyzw, v3.xyzw
add r0.xyzw, r0.xyzw, l(-127.000000, -127.000000, -127.000000, -127.000000)
mul r0.xyzw, r0.xyzw, l(0.007874, 0.007874, 0.007874, 0.007874)
dp3 o3.x, r0.xyzx, cb5[r2.x + 0].xyzx
dp3 o3.y, r0.xyzx, cb5[r2.x + 1].xyzx
dp3 o3.z, r0.xyzx, cb5[r2.x + 2].xyzx
ftou r1.x, v2.w
imul null, r1.x, r1.x, l(3)
dp3 r2.z, r0.xyzx, cb5[r1.x + 0].xyzx
dp3 r2.x, r0.xyzx, cb5[r1.x + 1].xyzx
dp3 r2.y, r0.xyzx, cb5[r1.x + 2].xyzx
dp3 r0.y, v2.xyzx, cb5[r1.x + 0].xyzx
dp3 r0.z, v2.xyzx, cb5[r1.x + 1].xyzx
dp3 r0.x, v2.xyzx, cb5[r1.x + 2].xyzx
mul r1.xyz, r2.xyzx, r0.xyzx
mad r0.xyz, r0.zxyz, r2.yzxy, -r1.xyzx
mul o4.xyz, r0.wwww, r0.xyzx
mov o6.xyzw, l(1.000000,1.000000,1.000000,1.000000)
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 43 instruction slots used

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