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

cbuffer cbInstanceData : register(b4)
{

  struct
  {
    float4x3 mWorld;
    float4 atlasUvScaleOffset;
    float4 userClipPlane;
    uint4 matricesData;
    uint envData;
    bool dynamicLightDisable;
    uint2 envPad;
    float4 mulCol;
    float4 aSh[3];
    float4 ShLightMask;
    float4 vDominantRotateParam;
    float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;
    float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;
    float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;
    float ditherFadeAlpha;
  } VC_InstanceData[2] : packoffset(c0);

}

cbuffer cbMatrixWVP : register(b0)
{
  row_major float4x4 VC_View_MatrixCamera : packoffset(c0);
  float4x4 VC_View_MatrixViewProj : packoffset(c4);
  float4 VC_ViewFrustumPlanes[4] : packoffset(c8);
}

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

cbuffer cbTexScroll : register(b11)
{
  float4 VC_TexScroll_0 : packoffset(c0);
  float4 VC_TexScroll_1 : packoffset(c1);
  float4 VC_TexScroll_2 : packoffset(c2);
  float4 VC_TexScroll_3 : packoffset(c3);
}



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


void main( 
  float3 v0 : POSITION0,
  uint4 v1 : NORMAL0,
  int4 v2 : TEXCOORD0,
  int2 v3 : TEXCOORD1,
  out float4 o0 : SV_Position0,
  out float2 o1 : TEXCOORD11,
  out float2 p1 : TEXCOORD9,
  out float4 o2 : COLOR1,
  out float4 o3 : TEXCOORD8,
  out float2 o4 : TEXCOORD5,
  out float p4 : TEXCOORD6,
  out float p4 : TEXCOORD12)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.x = (int)v1.w + (int)VC_InstanceData[0].matricesData.x;
  r0.x = (int)r0.x * 3;
  r1.xyz = v0.xyz;
  r1.w = 1;
  r2.x = dot(r1.xyzw, VC_aObjMatrix[r0.x/3]._m00_m10_m20_m30);
  r2.y = dot(r1.xyzw, VC_aObjMatrix[r0.x/3]._m01_m11_m21_m31);
  r2.z = dot(r1.xyzw, VC_aObjMatrix[r0.x/3]._m02_m12_m22_m32);
  r0.xyz = -VC_View_MatrixCamera._m30_m31_m32 + r2.xyz;
  r0.w = 1;
  r1.z = dot(r0.xyzw, VC_View_MatrixViewProj._m02_m12_m22_m32);
  r1.w = dot(r0.xyzw, VC_View_MatrixViewProj._m03_m13_m23_m33);
  o0.zw = r1.zw;
  o1.xy = r1.zw;
  o0.x = dot(r0.xyzw, VC_View_MatrixViewProj._m00_m10_m20_m30);
  o0.y = dot(r0.xyzw, VC_View_MatrixViewProj._m01_m11_m21_m31);
  r0.xy = (int2)v3.xy;
  r0.xy = VC_TexScroll_2.xy * r0.xy;
  p1.xy = r0.xy * float2(0.00048828125,0.00048828125) + VC_TexScroll_2.zw;
  o2.xyzw = float4(0,0,0,1);
  r0.xyzw = (int4)v2.xyzw;
  r0.xy = VC_TexScroll_0.xy * r0.xy;
  r0.zw = VC_TexScroll_1.xy * r0.zw;
  o3.zw = r0.zw * float2(0.00048828125,0.00048828125) + VC_TexScroll_1.zw;
  o3.xy = r0.xy * float2(0.00048828125,0.00048828125) + VC_TexScroll_0.zw;
  o4.xyzw = float4(0,0,0,0);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Original ASM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20546
//
//
// Buffer Definitions: 
//
// cbuffer cbInstanceData
// {
//
//   struct PerInstanceData
//   {
//       
//       float4x3 mWorld;               // Offset:    0
//       float4 atlasUvScaleOffset;     // Offset:   48
//       float4 userClipPlane;          // Offset:   64
//       uint4 matricesData;            // Offset:   80
//       uint envData;                  // Offset:   96
//       bool dynamicLightDisable;      // Offset:  100
//       uint2 envPad;                  // Offset:  104
//       float4 mulCol;                 // Offset:  112
//       float4 aSh[3];                 // Offset:  128
//       float4 ShLightMask;            // Offset:  176
//       float4 vDominantRotateParam;   // Offset:  192
//       float4 parallaxCorrectedCubemapOrigin_envMapInterpRatio;// Offset:  208
//       float4 parallaxCorrectedCubemapAabbMin_envMapColorScale0;// Offset:  224
//       float4 parallaxCorrectedCubemapAabbMax_envMapColorScale1;// Offset:  240
//       float ditherFadeAlpha;         // Offset:  256
//
//   } VC_InstanceData[2];              // Offset:    0 Size:   532
//
// }
//
// cbuffer cbMatrixWVP
// {
//
//   row_major float4x4 VC_View_MatrixCamera;// Offset:    0 Size:    64
//   float4x4 VC_View_MatrixViewProj;   // Offset:   64 Size:    64
//   float4 VC_ViewFrustumPlanes[4];    // Offset:  128 Size:    64 [unused]
//
// }
//
// cbuffer cbObjMatrix
// {
//
//   float4x3 VC_aObjMatrix[2];         // Offset:    0 Size:    96
//
// }
//
// cbuffer cbTexScroll
// {
//
//   float4 VC_TexScroll_0;             // Offset:    0 Size:    16
//   float4 VC_TexScroll_1;             // Offset:   16 Size:    16
//   float4 VC_TexScroll_2;             // Offset:   32 Size:    16
//   float4 VC_TexScroll_3;             // Offset:   48 Size:    16 [unused]
//
// }
//
//
// 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
// cbTexScroll                       cbuffer      NA          NA   11        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyz         0     NONE   float   xyz 
// NORMAL                   0   xyzw        1     NONE    uint      w
// TEXCOORD                 0   xyzw        2     NONE     int   xyzw
// TEXCOORD                 1   xy          3     NONE     int   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Position              0   xyzw        0      POS   float   xyzw
// TEXCOORD                11   xy          1     NONE   float   xy  
// TEXCOORD                 9     zw        1     NONE   float     zw
// COLOR                    1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 8   xyzw        3     NONE   float   xyzw
// TEXCOORD                 5   xy          4     NONE   float   xy  
// TEXCOORD                 6     z         4     NONE   float     z 
// TEXCOORD                12      w        4     NONE   float      w
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb4[6], immediateIndexed
dcl_constantbuffer cb0[8], immediateIndexed
dcl_constantbuffer cb5[6], dynamicIndexed
dcl_constantbuffer cb11[3], immediateIndexed
dcl_input v0.xyz
dcl_input v1.w
dcl_input v2.xyzw
dcl_input v3.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o1.zw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xy
dcl_output o4.z
dcl_output o4.w
dcl_temps 3
iadd r0.x, v1.w, cb4[5].x
imul null, r0.x, r0.x, l(3)
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
dp4 r2.x, r1.xyzw, cb5[r0.x + 0].xyzw
dp4 r2.y, r1.xyzw, cb5[r0.x + 1].xyzw
dp4 r2.z, r1.xyzw, cb5[r0.x + 2].xyzw
add r0.xyz, r2.xyzx, -cb0[3].xyzx
mov r0.w, l(1.000000)
dp4 r1.z, r0.xyzw, cb0[6].xyzw
dp4 r1.w, r0.xyzw, cb0[7].xyzw
mov o0.zw, r1.zzzw
mov o1.xy, r1.zwzz
dp4 o0.x, r0.xyzw, cb0[4].xyzw
dp4 o0.y, r0.xyzw, cb0[5].xyzw
itof r0.xy, v3.xyxx
mul r0.xy, r0.xyxx, cb11[2].xyxx
mad o1.zw, r0.xxxy, l(0.000000, 0.000000, 0.000488, 0.000488), cb11[2].zzzw
mov o2.xyzw, l(0,0,0,1.000000)
itof r0.xyzw, v2.xyzw
mul r0.xy, r0.xyxx, cb11[0].xyxx
mul r0.zw, r0.zzzw, cb11[1].xxxy
mad o3.zw, r0.zzzw, l(0.000000, 0.000000, 0.000488, 0.000488), cb11[1].zzzw
mad o3.xy, r0.xyxx, l(0.000488, 0.000488, 0.000000, 0.000000), cb11[0].zwzz
mov o4.xyzw, l(0,0,0,0)
ret 
// Approximately 26 instruction slots used

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