//deductions background
// ---- Created with 3Dmigoto v1.2.39 on Fri Jun 17 11:21:50 2016

cbuffer _Globals : register(b0)
{
  float4x4 LocalToWorld : packoffset(c0);
  float4x4 ScreenToWorldMatrix : packoffset(c4);
  float TwoSidedSign : packoffset(c8);
  bool bDecompressSceneColor : packoffset(c8.y);
  float4 PackedParameters : packoffset(c9);
  float4 MinMaxBlurClamp : packoffset(c10);
  float4 LightColorAndFalloffExponent : packoffset(c11);
  float3 DistanceFieldParameters : packoffset(c12);
  float4x4 ScreenToShadowMatrix : packoffset(c13);
  float4 ShadowBufferAndTexelSize : packoffset(c17);
  float ShadowOverrideFactor : packoffset(c18);
  float SSSMultiplier : packoffset(c18.y);
  bool bReceiveDynamicShadows : packoffset(c18.z);
  bool bEnableDistanceShadowFading : packoffset(c18.w);
  float2 DistanceFadeParameters : packoffset(c19);
  float4 IBLPositionAndWeight0 : packoffset(c20);
  float4 IBLPositionAndWeight1 : packoffset(c21);
  float4 IBLPositionAndWeight2 : packoffset(c22);
  float4 IBLPositionAndWeight3 : packoffset(c23);
  float4x4 IBLProxyOBB0 : packoffset(c24);
  float4x4 IBLProxyOBB1 : packoffset(c28);
  float4x4 IBLProxyOBB2 : packoffset(c32);
  float4 IBLUseProxyVolume : packoffset(c36);
  float4x4 IBLLastProxyOBB0 : packoffset(c37);
  float4x4 IBLLastProxyOBB1 : packoffset(c41);
  float4x4 IBLLastProxyOBB2 : packoffset(c45);
  float4 IBLUseLastProxyVolume : packoffset(c49);
  float ForcedIBLWeight : packoffset(c50);
  float AdditionalReflections : packoffset(c50.y);
  float4x4 InvViewProjectionMatrix : packoffset(c51);
  float3 CameraWorldPos : packoffset(c55);
  float3 ActorWorldPos : packoffset(c56);
  float4 ObjectWorldPositionAndRadius : packoffset(c57);
  float3 ObjectOrientation : packoffset(c58);
  float3 ObjectPostProjectionPosition : packoffset(c59);
  float3 ObjectNDCPosition : packoffset(c60);
  float4 ObjectMacroUVScales : packoffset(c61);
  float3 FoliageImpulseDirection : packoffset(c62);
  float4 FoliageNormalizedRotationAxisAndAngle : packoffset(c63);
  float4 WindDirectionAndSpeed : packoffset(c64);
  float3x3 LocalToWorldMatrix : packoffset(c65);
  float3x3 WorldToLocalMatrix : packoffset(c68);
  float3x3 WorldToViewMatrix : packoffset(c71);
  float3x3 ViewToWorldMatrix : packoffset(c74);
  float4 UniformPixelVector_0 : packoffset(c77);
  float4 UniformPixelVector_1 : packoffset(c78);
  float4 UniformPixelScalars_0 : packoffset(c79);
  float4 UniformPixelScalars_1 : packoffset(c80);
  float4 UniformPixelScalars_2 : packoffset(c81);
  float3 TemporalAAParameters : packoffset(c82);
  float4x4 PreviousLocalToWorld : packoffset(c83);
  float LocalToWorldRotDeterminantFlip : packoffset(c87);
  float3x3 WorldToLocal : packoffset(c88);
  float4 LightmapCoordinateScaleBias : packoffset(c91);
  float4 ShadowmapCoordinateScaleBias : packoffset(c92);
  float4 LightPositionAndInvRadius : packoffset(c93);
  float4 LightMapScale[2] : packoffset(c94);
}

cbuffer VSOffsetConstants : register(b1)
{
  float4x4 ViewProjectionMatrix : packoffset(c0);
  float4 CameraPositionVS : packoffset(c4);
  float4 PreViewTranslation : packoffset(c5);
}



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


void main( 
  float4 v0 : POSITION0,
  float3 v1 : TANGENT0,
  float4 v2 : NORMAL0,
  float4 v3 : COLOR1,
  float4 v4 : TEXCOORD0,
  float4 v5 : TEXCOORD1,
  float2 v6 : TEXCOORD2,
  float2 v7 : COLOR0,
  out float4 o0 : TEXCOORD10,
  out float4 o1 : TEXCOORD11,
  out float4 o2 : COLOR0,
  out float4 o3 : TEXCOORD0,
  out float4 o4 : TEXCOORD1,
  out float4 o5 : TEXCOORD2,
  out float4 o6 : TEXCOORD6,
  out float4 o7 : TEXCOORD7,
  out float4 o8 : TEXCOORD5,
  out float4 o9 : SV_Position0)
{
  float4 r0,r1,r2,r3,r4,r5;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = v1.yzx * float3(2,2,2) + float3(-1,-1,-1);
  r1.xyzw = v2.xyzw * float4(2,2,2,2) + float4(-1,-1,-1,-1);
  r2.xyz = r1.zxy * r0.xyz;
  r0.xyz = r1.yzx * r0.yzx + -r2.xyz;
  r0.xyz = r0.xyz * r1.www;
  r2.xyz = r0.zxy * r1.yzx;
  r2.xyz = r0.yzx * r1.zxy + -r2.xyz;
  r2.xyz = r2.xyz * r1.www;
  r3.xy = LocalToWorld._m01_m21 * r2.yy;
  r3.xy = LocalToWorld._m00_m20 * r2.xx + r3.xy;
  r3.xy = LocalToWorld._m02_m22 * r2.zz + r3.xy;
  r4.xy = LocalToWorld._m01_m21 * r0.yy;
  r4.xy = LocalToWorld._m00_m20 * r0.xx + r4.xy;
  r4.xy = LocalToWorld._m02_m22 * r0.zz + r4.xy;
  r3.z = r4.x;
  o1.y = r4.y;
  r4.xy = LocalToWorld._m01_m21 * r1.yy;
  r4.xy = LocalToWorld._m00_m20 * r1.xx + r4.xy;
  r4.xy = LocalToWorld._m02_m22 * r1.zz + r4.xy;
  r3.w = r4.x;
  o1.z = r4.y;
  o0.xyz = r3.xzw;
  o1.x = r3.y;
  o1.w = LocalToWorldRotDeterminantFlip * r1.w;
  o2.xyzw = v3.zyxw;
  o3.xy = v7.xy * LightmapCoordinateScaleBias.xy + LightmapCoordinateScaleBias.wz;
  o4.xy = v4.xy;
  o4.zw = v5.yx;
  o5.xy = v6.xy;
  o5.zw = float2(0,0);
  o6.w = 1;
  r3.xyzw = LocalToWorld._m01_m11_m21_m31 * v0.yyyy;
  r3.xyzw = LocalToWorld._m00_m10_m20_m30 * v0.xxxx + r3.xyzw;
  r3.xyzw = LocalToWorld._m02_m12_m22_m32 * v0.zzzz + r3.xyzw;
  r3.xyzw = LocalToWorld._m03_m13_m23_m33 * v0.wwww + r3.xyzw;
  r4.xyz = -r3.xyz * CameraPositionVS.www + CameraPositionVS.xyz;
  r5.xyz = WorldToLocal._m01_m11_m21 * r4.yyy;
  r4.xyw = WorldToLocal._m00_m10_m20 * r4.xxx + r5.xyz;
  r4.xyz = WorldToLocal._m02_m12_m22 * r4.zzz + r4.xyw;
  o6.x = dot(r2.xyz, r4.xyz);
  o7.x = dot(r2.xyz, WorldToLocal._m02_m12_m22);
  o6.y = dot(r0.xyz, r4.xyz);
  o7.y = dot(r0.xyz, WorldToLocal._m02_m12_m22);
  o6.z = dot(r1.xyz, r4.xyz);
  o7.z = dot(r1.xyz, WorldToLocal._m02_m12_m22);
  o8.xyzw = r3.xyzw;
  r0.xyzw = ViewProjectionMatrix._m01_m11_m21_m31 * r3.yyyy;
  r0.xyzw = ViewProjectionMatrix._m00_m10_m20_m30 * r3.xxxx + r0.xyzw;
  r0.xyzw = ViewProjectionMatrix._m02_m12_m22_m32 * r3.zzzz + r0.xyzw;
  r0.xyzw = ViewProjectionMatrix._m03_m13_m23_m33 * r3.wwww + r0.xyzw;
  r1.x = TemporalAAParameters.z * r0.w;
  o9.xy = r1.xx * TemporalAAParameters.xy + r0.xy;
  o9.zw = r0.zw;
float4 stereo = StereoParams.Load(0);
o9.x -= stereo.x*(o9.w - stereo.y);
//o9.x += stereo.x*(o9.w - 0.5);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
//   using 3Dmigoto v1.2.39 on Fri Jun 17 11:21:50 2016
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float4x4 LocalToWorld;             // Offset:    0 Size:    64
//   float4x4 ScreenToWorldMatrix;      // Offset:   64 Size:    64 [unused]
//   float TwoSidedSign;                // Offset:  128 Size:     4 [unused]
//   bool bDecompressSceneColor;        // Offset:  132 Size:     4 [unused]
//   float4 PackedParameters;           // Offset:  144 Size:    16 [unused]
//   float4 MinMaxBlurClamp;            // Offset:  160 Size:    16 [unused]
//   float4 LightColorAndFalloffExponent;// Offset:  176 Size:    16 [unused]
//   float3 DistanceFieldParameters;    // Offset:  192 Size:    12 [unused]
//   float4x4 ScreenToShadowMatrix;     // Offset:  208 Size:    64 [unused]
//   float4 ShadowBufferAndTexelSize;   // Offset:  272 Size:    16 [unused]
//   float ShadowOverrideFactor;        // Offset:  288 Size:     4 [unused]
//   float SSSMultiplier;               // Offset:  292 Size:     4 [unused]
//   bool bReceiveDynamicShadows;       // Offset:  296 Size:     4 [unused]
//   bool bEnableDistanceShadowFading;  // Offset:  300 Size:     4 [unused]
//   float2 DistanceFadeParameters;     // Offset:  304 Size:     8 [unused]
//   float4 IBLPositionAndWeight0;      // Offset:  320 Size:    16 [unused]
//   float4 IBLPositionAndWeight1;      // Offset:  336 Size:    16 [unused]
//   float4 IBLPositionAndWeight2;      // Offset:  352 Size:    16 [unused]
//   float4 IBLPositionAndWeight3;      // Offset:  368 Size:    16 [unused]
//   float4x4 IBLProxyOBB0;             // Offset:  384 Size:    64 [unused]
//   float4x4 IBLProxyOBB1;             // Offset:  448 Size:    64 [unused]
//   float4x4 IBLProxyOBB2;             // Offset:  512 Size:    64 [unused]
//   float4 IBLUseProxyVolume;          // Offset:  576 Size:    16 [unused]
//   float4x4 IBLLastProxyOBB0;         // Offset:  592 Size:    64 [unused]
//   float4x4 IBLLastProxyOBB1;         // Offset:  656 Size:    64 [unused]
//   float4x4 IBLLastProxyOBB2;         // Offset:  720 Size:    64 [unused]
//   float4 IBLUseLastProxyVolume;      // Offset:  784 Size:    16 [unused]
//   float ForcedIBLWeight;             // Offset:  800 Size:     4 [unused]
//   float AdditionalReflections;       // Offset:  804 Size:     4 [unused]
//   float4x4 InvViewProjectionMatrix;  // Offset:  816 Size:    64 [unused]
//   float3 CameraWorldPos;             // Offset:  880 Size:    12 [unused]
//   float3 ActorWorldPos;              // Offset:  896 Size:    12 [unused]
//   float4 ObjectWorldPositionAndRadius;// Offset:  912 Size:    16 [unused]
//   float3 ObjectOrientation;          // Offset:  928 Size:    12 [unused]
//   float3 ObjectPostProjectionPosition;// Offset:  944 Size:    12 [unused]
//   float3 ObjectNDCPosition;          // Offset:  960 Size:    12 [unused]
//   float4 ObjectMacroUVScales;        // Offset:  976 Size:    16 [unused]
//   float3 FoliageImpulseDirection;    // Offset:  992 Size:    12 [unused]
//   float4 FoliageNormalizedRotationAxisAndAngle;// Offset: 1008 Size:    16 [unused]
//   float4 WindDirectionAndSpeed;      // Offset: 1024 Size:    16 [unused]
//   float3x3 LocalToWorldMatrix;       // Offset: 1040 Size:    44 [unused]
//   float3x3 WorldToLocalMatrix;       // Offset: 1088 Size:    44 [unused]
//   float3x3 WorldToViewMatrix;        // Offset: 1136 Size:    44 [unused]
//   float3x3 ViewToWorldMatrix;        // Offset: 1184 Size:    44 [unused]
//   float4 UniformPixelVector_0;       // Offset: 1232 Size:    16 [unused]
//   float4 UniformPixelVector_1;       // Offset: 1248 Size:    16 [unused]
//   float4 UniformPixelScalars_0;      // Offset: 1264 Size:    16 [unused]
//   float4 UniformPixelScalars_1;      // Offset: 1280 Size:    16 [unused]
//   float4 UniformPixelScalars_2;      // Offset: 1296 Size:    16 [unused]
//   float3 TemporalAAParameters;       // Offset: 1312 Size:    12
//   float4x4 PreviousLocalToWorld;     // Offset: 1328 Size:    64 [unused]
//   float LocalToWorldRotDeterminantFlip;// Offset: 1392 Size:     4
//   float3x3 WorldToLocal;             // Offset: 1408 Size:    44
//   float4 LightmapCoordinateScaleBias;// Offset: 1456 Size:    16
//   float4 ShadowmapCoordinateScaleBias;// Offset: 1472 Size:    16 [unused]
//   float4 LightPositionAndInvRadius;  // Offset: 1488 Size:    16 [unused]
//   float4 LightMapScale[2];           // Offset: 1504 Size:    32 [unused]
//
// }
//
// cbuffer VSOffsetConstants
// {
//
//   float4x4 ViewProjectionMatrix;     // Offset:    0 Size:    64
//   float4 CameraPositionVS;           // Offset:   64 Size:    16
//   float4 PreViewTranslation;         // Offset:   80 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// $Globals                          cbuffer      NA          NA    0        1
// VSOffsetConstants                 cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// TANGENT                  0   xyz         1     NONE   float   xyz 
// NORMAL                   0   xyzw        2     NONE   float   xyzw
// COLOR                    1   xyzw        3     NONE   float   xyzw
// TEXCOORD                 0   xy          4     NONE   float   xy  
// TEXCOORD                 1   xy          5     NONE   float   xy  
// TEXCOORD                 2   xy          6     NONE   float   xy  
// COLOR                    0   xy          7     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// TEXCOORD                10   xyzw        0     NONE   float   xyz 
// TEXCOORD                11   xyzw        1     NONE   float   xyzw
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xy          3     NONE   float   xy  
// TEXCOORD                 1   xyzw        4     NONE   float   xyzw
// TEXCOORD                 2   xyzw        5     NONE   float   xyzw
// TEXCOORD                 6   xyzw        6     NONE   float   xyzw
// TEXCOORD                 7   xyz         7     NONE   float   xyz 
// TEXCOORD                 5   xyzw        8     NONE   float   xyzw
// SV_Position              0   xyzw        9      POS   float   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[92], immediateIndexed
dcl_constantbuffer cb1[5], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_input v4.xy
dcl_input v5.xy
dcl_input v6.xy
dcl_input v7.xy
dcl_output o0.xyz
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xy
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_output o6.xyzw
dcl_output o7.xyz
dcl_output o8.xyzw
dcl_output_siv o9.xyzw, position
dcl_temps 6
mad r0.xyz, v1.yzxy, l(2.000000, 2.000000, 2.000000, 0.000000), l(-1.000000, -1.000000, -1.000000, 0.000000)
mad r1.xyzw, v2.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-1.000000, -1.000000, -1.000000, -1.000000)
mul r2.xyz, r0.xyzx, r1.zxyz
mad r0.xyz, r1.yzxy, r0.yzxy, -r2.xyzx
mul r0.xyz, r1.wwww, r0.xyzx
mul r2.xyz, r1.yzxy, r0.zxyz
mad r2.xyz, r0.yzxy, r1.zxyz, -r2.xyzx
mul r2.xyz, r1.wwww, r2.xyzx
mul r3.xy, r2.yyyy, cb0[1].xzxx
mad r3.xy, cb0[0].xzxx, r2.xxxx, r3.xyxx
mad r3.xy, cb0[2].xzxx, r2.zzzz, r3.xyxx
mul r4.xy, r0.yyyy, cb0[1].xzxx
mad r4.xy, cb0[0].xzxx, r0.xxxx, r4.xyxx
mad r4.xy, cb0[2].xzxx, r0.zzzz, r4.xyxx
mov r3.z, r4.x
mov o1.y, r4.y
mul r4.xy, r1.yyyy, cb0[1].xzxx
mad r4.xy, cb0[0].xzxx, r1.xxxx, r4.xyxx
mad r4.xy, cb0[2].xzxx, r1.zzzz, r4.xyxx
mov r3.w, r4.x
mov o1.z, r4.y
mov o0.xyz, r3.xzwx
mov o1.x, r3.y
mul o1.w, r1.w, cb0[87].x
mov o2.xyzw, v3.zyxw
mad o3.xy, v7.xyxx, cb0[91].xyxx, cb0[91].wzww
mov o4.xy, v4.xyxx
mov o4.zw, v5.yyyx
mov o5.xy, v6.xyxx
mov o5.zw, l(0,0,0,0)
mov o6.w, l(1.000000)
mul r3.xyzw, v0.yyyy, cb0[1].xyzw
mad r3.xyzw, cb0[0].xyzw, v0.xxxx, r3.xyzw
mad r3.xyzw, cb0[2].xyzw, v0.zzzz, r3.xyzw
mad r3.xyzw, cb0[3].xyzw, v0.wwww, r3.xyzw
mad r4.xyz, -r3.xyzx, cb1[4].wwww, cb1[4].xyzx
mul r5.xyz, r4.yyyy, cb0[89].xyzx
mad r4.xyw, cb0[88].xyxz, r4.xxxx, r5.xyxz
mad r4.xyz, cb0[90].xyzx, r4.zzzz, r4.xywx
dp3 o6.x, r2.xyzx, r4.xyzx
dp3 o7.x, r2.xyzx, cb0[90].xyzx
dp3 o6.y, r0.xyzx, r4.xyzx
dp3 o7.y, r0.xyzx, cb0[90].xyzx
dp3 o6.z, r1.xyzx, r4.xyzx
dp3 o7.z, r1.xyzx, cb0[90].xyzx
mov o8.xyzw, r3.xyzw
mul r0.xyzw, r3.yyyy, cb1[1].xyzw
mad r0.xyzw, cb1[0].xyzw, r3.xxxx, r0.xyzw
mad r0.xyzw, cb1[2].xyzw, r3.zzzz, r0.xyzw
mad r0.xyzw, cb1[3].xyzw, r3.wwww, r0.xyzw
mul r1.x, r0.w, cb0[82].z
mad o9.xy, r1.xxxx, cb0[82].xyxx, r0.xyxx
mov o9.zw, r0.zzzw
ret 
// Approximately 54 instruction slots used

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