//Smoke Halo
cbuffer _cbPerObject : register(b0)
{

  struct
  {
    row_major float4x4 go_mObjectToView;
    float4 go_vPosScale;
    float4 go_vPosBias;
    float4 go_vTexScaleBias;
    float4 go_vObjectId;
  } cbPerObject : packoffset(c0);

}

cbuffer _cbSharedPerViewData : register(b1)
{

  struct
  {
    row_major float4x4 mProjection;
    row_major float4x4 mViewToViewport;
    row_major float4x4 mViewToWorld;
    float4 vViewRemap;
    float4 vViewDepthRemap;
    float4 vEyeVectorUL;
    float4 vEyeVectorLR;
    float4 v4ShadowRange;
    float4 vViewSpaceUpVector;
    float4 vGlobalLitFactor;
    float4 vViewportSize;
    float4 vEngineTime;
    float4 vShaderColor0;
    float4 vShaderColor1;
    float4 vShaderColor2;
    float4 vShaderColor3;
    float4 vShaderColor4;
    float4 vClipPlane;
  } cbSharedPerViewData : packoffset(c0);

}

cbuffer _cbSharedParticleSpritesData : register(b3)
{

  struct
  {
    row_major float4x4 mWorldToView;
    float4 vDirScaleBias;
    float4 vVecScale;
    float4 vVecBias;
  } cbSharedParticleSpritesData : packoffset(c0);

}

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main( 
  float4 v0 : POSITION0,
  float2 v1 : NORMAL0,
  float4 v2 : COLOR0,
  float4 v3 : TEXCOORD1,
  float4 v4 : TEXCOORD0,
  float4 v5 : TEXCOORD3,
  float4 v6 : TEXCOORD2,
  float4 v7 : TEXCOORD4,
  float2 v8 : TEXCOORD5,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : TEXCOORD0,
  out float4 o2 : TEXCOORD1,
  out float4 o3 : TEXCOORD2,
  out float4 o4 : TEXCOORD3,
  out float4 o5 : TEXCOORD4)
{
  float4 r0,r1,r2;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyz = cbSharedParticleSpritesData.vVecScale.xyz * v6.xyz + cbSharedParticleSpritesData.vVecBias.xyz;
  r1.xyzw = cbPerObject.go_mObjectToView._m10_m11_m12_m13 * r0.yyyy;
  r1.xyzw = r0.xxxx * cbPerObject.go_mObjectToView._m00_m01_m02_m03 + r1.xyzw;
  r0.xyzw = r0.zzzz * cbPerObject.go_mObjectToView._m20_m21_m22_m23 + r1.xyzw;
  r0.w = dot(r0.xyzw, r0.xyzw);
  r1.x = rsqrt(r0.w);
  r0.xyz = r0.xyz * r1.xxx + float3(-0,-1,-0);
  r1.x = r0.w >= 9.99999975e-005;
  r1.x = r1.x ? 1.000000 : 0;
  r0.xyz = r1.xxx * r0.xyz + float3(0,1,0);
  r1.xyz = v0.xyz;
  r1.w = 1;
  r1.xyzw = cbPerObject.go_vPosScale.xyzw * r1.xyzw + cbPerObject.go_vPosBias.xyzw;
  r2.xyzw = cbPerObject.go_mObjectToView._m10_m11_m12_m13 * r1.yyyy;
  r2.xyzw = r1.xxxx * cbPerObject.go_mObjectToView._m00_m01_m02_m03 + r2.xyzw;
  r2.xyzw = r1.zzzz * cbPerObject.go_mObjectToView._m20_m21_m22_m23 + r2.xyzw;
  r1.xyzw = r1.wwww * cbPerObject.go_mObjectToView._m30_m31_m32_m33 + r2.xyzw;
  r0.xyz = r0.xyz * float3(0.00100000005,0.00100000005,0.00100000005) + r1.xyz;
  r0.z = r1.z / r0.z;
  r0.xy = r0.xy * r0.zz + -r1.xy;
  r0.z = dot(r0.xy, r0.xy);
  r2.x = r0.z * r0.w;
  r0.z = rsqrt(r0.z);
  r0.xy = r0.xy * r0.zz;
  r0.z = 100 * r0.w;
  r0.w = 1000000 * r2.x;
  r0.z = min(r0.z, r0.w);
  r2.xy = cbSharedParticleSpritesData.vDirScaleBias.xy * v1.xy + cbSharedParticleSpritesData.vDirScaleBias.zw;
  r0.w = dot(r2.xy, r2.xy);
  r0.z = r0.z * r0.w;
  r0.z = sqrt(r0.z);
  r2.z = rsqrt(r0.w);
  r0.w = 1 + r0.w;
  r2.zw = r2.xy * r2.zz;
  r2.z = dot(r0.xy, r2.zw);
  r0.z = r2.z * r0.z;
  r2.z = min(abs(r1.z), r0.w);
  r0.w = r2.z / r0.w;
  r0.z = r0.z * r0.w;
  r0.xy = r0.xy * r0.zz + r2.xy;
  r0.xy = r1.xy + r0.xy;
  r2.xyzw = cbSharedPerViewData.mProjection._m10_m11_m12_m13 * r0.yyyy;
  r2.xyzw = r0.xxxx * cbSharedPerViewData.mProjection._m00_m01_m02_m03 + r2.xyzw;
  o1.xy = r0.xy;
  r0.xyzw = r1.zzzz * cbSharedPerViewData.mProjection._m20_m21_m22_m23 + r2.xyzw;
  o0.xyzw = r1.wwww * cbSharedPerViewData.mProjection._m30_m31_m32_m33 + r0.xyzw;
  
  float4 stereo = StereoParams.Load(0);
  r2.x -= stereo.x * (r2.w - stereo.y);
  
  //o1.zw = r1.zw;
  o1.zw = r2.zw;
  
  o2.xyz = v2.xyz * v2.xyz;
  o2.w = v2.w;
  o3.xyzw = v4.xyzw;
  o4.xyzw = v0.wwww;
  o5.xyzw = float4(0,0,1,1);
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.9 on Fri Dec 18 13:28:21 2015
//
//
// Buffer Definitions: 
//
// cbuffer _cbPerObject
// {
//
//   struct
//   {
//       
//       row_major float4x4 go_mObjectToView;// Offset:    0
//       float4 go_vPosScale;           // Offset:   64
//       float4 go_vPosBias;            // Offset:   80
//       float4 go_vTexScaleBias;       // Offset:   96
//       float4 go_vObjectId;           // Offset:  112
//
//   } cbPerObject;                     // Offset:    0 Size:   128
//
// }
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct
//   {
//       
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mViewToViewport;// Offset:   64
//       row_major float4x4 mViewToWorld;// Offset:  128
//       float4 vViewRemap;             // Offset:  192
//       float4 vViewDepthRemap;        // Offset:  208
//       float4 vEyeVectorUL;           // Offset:  224
//       float4 vEyeVectorLR;           // Offset:  240
//       float4 v4ShadowRange;          // Offset:  256
//       float4 vViewSpaceUpVector;     // Offset:  272
//       float4 vGlobalLitFactor;       // Offset:  288
//       float4 vViewportSize;          // Offset:  304
//       float4 vEngineTime;            // Offset:  320
//       float4 vShaderColor0;          // Offset:  336
//       float4 vShaderColor1;          // Offset:  352
//       float4 vShaderColor2;          // Offset:  368
//       float4 vShaderColor3;          // Offset:  384
//       float4 vShaderColor4;          // Offset:  400
//       float4 vClipPlane;             // Offset:  416
//
//   } cbSharedPerViewData;             // Offset:    0 Size:   432
//
// }
//
// cbuffer _cbSharedParticleSpritesData
// {
//
//   struct
//   {
//       
//       row_major float4x4 mWorldToView;// Offset:    0
//       float4 vDirScaleBias;          // Offset:   64
//       float4 vVecScale;              // Offset:   80
//       float4 vVecBias;               // Offset:   96
//
//   } cbSharedParticleSpritesData;     // Offset:    0 Size:   112
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// _cbPerObject                      cbuffer      NA          NA    0        1
// _cbSharedPerViewData              cbuffer      NA          NA    1        1
// _cbSharedParticleSpritesData      cbuffer      NA          NA    3        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xy          1     NONE   float   xy  
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 1   xy          3     NONE   float       
// TEXCOORD                 0   xyzw        4     NONE   float   xyzw
// TEXCOORD                 3   x           5     NONE   float       
// TEXCOORD                 2   xyzw        6     NONE   float   xyz 
// TEXCOORD                 4   xyzw        7     NONE   float       
// TEXCOORD                 5   xy          8     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyzw
// TEXCOORD                 2   xyzw        3     NONE   float   xyzw
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
// TEXCOORD                 4   xyzw        5     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[6], immediateIndexed
dcl_constantbuffer cb1[4], immediateIndexed
dcl_constantbuffer cb3[7], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xy
dcl_input v2.xyzw
dcl_input v4.xyzw
dcl_input v6.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_output o5.xyzw
dcl_temps 3
mad r0.xyz, cb3[5].xyzx, v6.xyzx, cb3[6].xyzx
mul r1.xyzw, r0.yyyy, cb0[1].xyzw
mad r1.xyzw, r0.xxxx, cb0[0].xyzw, r1.xyzw
mad r0.xyzw, r0.zzzz, cb0[2].xyzw, r1.xyzw
dp4 r0.w, r0.xyzw, r0.xyzw
rsq r1.x, r0.w
mad r0.xyz, r0.xyzx, r1.xxxx, l(-0.000000, -1.000000, -0.000000, 0.000000)
ge r1.x, r0.w, l(0.000100)
and r1.x, r1.x, l(0x3f800000)
mad r0.xyz, r1.xxxx, r0.xyzx, l(0.000000, 1.000000, 0.000000, 0.000000)
mov r1.xyz, v0.xyzx
mov r1.w, l(1.000000)
mad r1.xyzw, cb0[4].xyzw, r1.xyzw, cb0[5].xyzw
mul r2.xyzw, r1.yyyy, cb0[1].xyzw
mad r2.xyzw, r1.xxxx, cb0[0].xyzw, r2.xyzw
mad r2.xyzw, r1.zzzz, cb0[2].xyzw, r2.xyzw
mad r1.xyzw, r1.wwww, cb0[3].xyzw, r2.xyzw
mad r0.xyz, r0.xyzx, l(0.001000, 0.001000, 0.001000, 0.000000), r1.xyzx
div r0.z, r1.z, r0.z
mad r0.xy, r0.xyxx, r0.zzzz, -r1.xyxx
dp2 r0.z, r0.xyxx, r0.xyxx
mul r2.x, r0.w, r0.z
rsq r0.z, r0.z
mul r0.xy, r0.zzzz, r0.xyxx
mul r0.z, r0.w, l(100.000000)
mul r0.w, r2.x, l(1000000.000000)
min r0.z, r0.w, r0.z
mad r2.xy, cb3[4].xyxx, v1.xyxx, cb3[4].zwzz
dp2 r0.w, r2.xyxx, r2.xyxx
mul r0.z, r0.w, r0.z
sqrt r0.z, r0.z
rsq r2.z, r0.w
add r0.w, r0.w, l(1.000000)
mul r2.zw, r2.zzzz, r2.xxxy
dp2 r2.z, r0.xyxx, r2.zwzz
mul r0.z, r0.z, r2.z
min r2.z, r0.w, |r1.z|
div r0.w, r2.z, r0.w
mul r0.z, r0.w, r0.z
mad r0.xy, r0.xyxx, r0.zzzz, r2.xyxx
add r0.xy, r0.xyxx, r1.xyxx
mul r2.xyzw, r0.yyyy, cb1[1].xyzw
mad r2.xyzw, r0.xxxx, cb1[0].xyzw, r2.xyzw
mov o1.xy, r0.xyxx
mad r0.xyzw, r1.zzzz, cb1[2].xyzw, r2.xyzw
mad o0.xyzw, r1.wwww, cb1[3].xyzw, r0.xyzw
mov o1.zw, r1.zzzw
mul o2.xyz, v2.xyzx, v2.xyzx
mov o2.w, v2.w
mov o3.xyzw, v4.xyzw
mov o4.xyzw, v0.wwww
mov o5.xyzw, l(0,0,1.000000,1.000000)
ret 
// Approximately 53 instruction slots used

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