//Particles VS.
// ---- Created with 3Dmigoto v1.3.14 on Wed Feb 06 18:42:51 2019
//
//struct ParticleStructure
//{
//    float3 position;               // Offset:    0
//    uint color;                    // Offset:   12
//    float3 localPosition;          // Offset:   16
//    float reserve;                 // Offset:   28
//    float3 blendParam;             // Offset:   32
//    uint edgeOuterColor;           // Offset:   44
//    float3 rotation;               // Offset:   48
//    float particleTime;            // Offset:   60
//    float4 velocity;               // Offset:   64
//    float4 life;                   // Offset:   80
//    float3 size;                   // Offset:   96
//    uint attribute;                // Offset:  108
//    float2 texRect;                // Offset:  112
//    float texTimer;                // Offset:  120
//    float texSpeed;                // Offset:  124
//    float3 frontDiffuse;           // Offset:  128
//    uint texIndex;                 // Offset:  140
//    float4 fogInfluence;           // Offset:  144
//    uint4 meshEmitterAttr;         // Offset:  160
//    float velocityCoef;            // Offset:  176
//    float vectorFieldCoef;         // Offset:  180
//    uint uintGeneric;              // Offset:  184
//    uint uvsAttribute;             // Offset:  188
//    float2 reserved;               // Offset:  192
//    float collisionTime;           // Offset:  200
//    uint collisionAttribute;       // Offset:  204
//    float3 birthPosition;          // Offset:  208
//};
//
//cbuffer SceneInfo : register(b0)
//{
//  row_major float4x4 viewProjMat : packoffset(c0);
//  row_major float3x4 transposeViewMat : packoffset(c4);
//  row_major float3x4 transposeViewInvMat : packoffset(c7);
//  float4 projElement[2] : packoffset(c10);
//  float4 projInvElements[2] : packoffset(c12);
//  row_major float4x4 viewProjInvMat : packoffset(c14);
//  row_major float4x4 prevViewProjMat : packoffset(c18);
//  float3 ZToLinear : packoffset(c22);
//  float subdivisionLevel : packoffset(c22.w);
//  float2 screenSize : packoffset(c23);
//  float2 screenInverseSize : packoffset(c23.z);
//  float2 cullingHelper : packoffset(c24);
//  float cameraNearPlane : packoffset(c24.z);
//  float cameraFarPlane : packoffset(c24.w);
//  float4 viewFrustum[6] : packoffset(c25);
//  float4 clipplane : packoffset(c31);
//}
//
//cbuffer GpuParticleVS : register(b1)
//{
//  float depthBias : packoffset(c0);
//  float softParticleDist : packoffset(c0.y);
//  float fadeCone : packoffset(c0.z);
//  float fadeSpread : packoffset(c0.w);
//  float3 fadeConeDir : packoffset(c1);
//  float fadeAlphaRate : packoffset(c1.w);
//  float4 fadeDepth : packoffset(c2);
//  float3 occlusionSphereOffset : packoffset(c3);
//  uint effectFlags : packoffset(c3.w);
//  float occlusionSphereRadius : packoffset(c4);
//  float occlusionSizeRate : packoffset(c4.y);
//  float dofNear : packoffset(c4.z);
//  float dofMaxScale : packoffset(c4.w);
//  float dofMinAlpha : packoffset(c5);
//  uint dofUsingMipLevel : packoffset(c5.y);
//  float dofVanishDistance : packoffset(c5.z);
//  float fadeEnableAngle : packoffset(c5.w);
//  float lumaBleed : packoffset(c6);
//  float lumaSlide : packoffset(c6.y);
//  float lumaScale : packoffset(c6.z);
//  float lumaBias : packoffset(c6.w);
//  float2 texRect : packoffset(c7);
//  float lumaTexelScale : packoffset(c7.z);
//  float texEV : packoffset(c7.w);
//  float3 emitterPos : packoffset(c8);
//  float alphaRate : packoffset(c8.w);
//  float usePhysicalAlphaBlend : packoffset(c9);
//  float fadeEmitterCone : packoffset(c9.y);
//  float fadeEmitterSpread : packoffset(c9.z);
//  float fadeEmitterAlphaRate : packoffset(c9.w);
//  float fadeEmitterEnableAngle : packoffset(c10);
//  float fadeEmitterFadeinStart : packoffset(c10.y);
//  float fadeEmitterFadeinEnd : packoffset(c10.z);
//  float detonemapRate : packoffset(c10.w);
//  uint effectPlayerColor : packoffset(c11);
//  float gpuParticleReserve0 : packoffset(c11.y);
//  float gpuParticleReserve1 : packoffset(c11.z);
//  float gpuParticleReserve2 : packoffset(c11.w);
//}
//
//Texture2D<float> ReadonlyDepth : register(t0);
//StructuredBuffer<ParticleStructure> BillboardParticleStructureResults : register(t1);
//
//
//// 3Dmigoto declarations
//#define cmp -
//Texture1D<float4> IniParams : register(t120);
//Texture2D<float4> StereoParams : register(t125);
//
//
//void main(
//  int4 v0 : GENERIC0,
//  out float4 o0 : SV_Position0,
//  out float4 o1 : Color0,
//  out float4 o2 : Generic0,
//  out float4 o3 : Generic1,
//  out uint4 o4 : Generic2)
//{
//  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r26;
//  uint4 bitmask, uiDest;
//  float4 fDest;
//
//  float4 stereo = StereoParams.Load(0);
//  
//  r0.x = BillboardParticleStructureResults[v0.x].attribute;
//  r0.x = (int)r0.x & 1;
//  if (r0.x != 0) {
//    r0.x = 1;
//  } else {
//    r0.x = 0;
//  }
//  r0.x = cmp((int)r0.x == 1);
//  if (r0.x != 0) {
//    r0.x = BillboardParticleStructureResults[v0.x].position.x;
//    r0.y = BillboardParticleStructureResults[v0.x].position.y;
//    r0.z = BillboardParticleStructureResults[v0.x].position.z;
//    r0.w = BillboardParticleStructureResults[v0.x].color;
//    r1.xyzw = effectFlags & int4(0x8000,1,2,4);
//    if (r1.x != 0) {
//      r2.x = BillboardParticleStructureResults[v0.x].birthPosition.x;
//      r2.y = BillboardParticleStructureResults[v0.x].birthPosition.y;
//      r2.z = BillboardParticleStructureResults[v0.x].birthPosition.z;
//      r3.xyz = -r2.xyz + r0.xyz;
//      r4.x = dot(r3.xyz, transposeViewInvMat._m00_m01_m02);
//      r4.y = dot(r3.xyz, transposeViewInvMat._m10_m11_m12);
//      r4.z = dot(r3.xyz, transposeViewInvMat._m20_m21_m22);
//      r0.xyz = r4.xyz + r2.xyz;
//    }
//    r2.xy = (int2)v0.yz;
//    r1.x = BillboardParticleStructureResults[v0.x].size.x;
//    r3.xy = r2.xy * r1.xx;
//    r3.xy = float2(0.5,0.5) * r3.xy;
//    r1.x = BillboardParticleStructureResults[v0.x].rotation.x;
//    r4.z = transposeViewInvMat._m02;
//    r4.x = transposeViewInvMat._m12;
//    r4.y = transposeViewInvMat._m22;
//    r3.zw = float2(0,1) * r4.xz;
//    r3.zw = r4.yx * float2(1,0) + -r3.zw;
//    r5.x = transposeViewInvMat._m00;
//    r5.y = transposeViewInvMat._m20;
//    r2.w = dot(r3.zw, r5.xy);
//    r2.w = cmp(0 < r2.w);
//    if (r2.w != 0) {
//      r5.xyz = -r4.zxy * transposeViewInvMat._m12_m12_m12 + float3(0,1,0);
//      r2.w = dot(r5.xyz, r5.xyz);
//      r2.w = rsqrt(r2.w);
//      r5.xyz = r5.xyz * r2.www;
//    } else {
//      r6.xyz = r4.zxy * transposeViewInvMat._m12_m12_m12 + float3(-0,-1,-0);
//      r2.w = dot(r6.xyz, r6.xyz);
//      r2.w = rsqrt(r2.w);
//      r5.xyz = r6.xyz * r2.www;
//    }
//    sincos(r1.x, r1.x, r6.x);
//    r7.xy = transposeViewInvMat._m02_m03;
//    r7.z = transposeViewInvMat._m13;
//    r7.w = transposeViewInvMat._m23;
//    r3.zw = transposeViewInvMat._m12_m12 * r5.yz;
//    r2.w = -r7.x * r5.x + -r3.z;
//    r2.w = -transposeViewInvMat._m22 * r5.z + r2.w;
//    r3.z = 1 + -r6.x;
//    r2.w = r3.z * r2.w;
//    r6.xyz = r6.xxx * r5.xyz;
//    r3.z = -r7.x * r2.w + r6.x;
//    r3.w = -transposeViewInvMat._m22 * r5.y + r3.w;
//    r8.x = r3.w * r1.x + r3.z;
//    r3.z = -transposeViewInvMat._m12 * r2.w + r6.y;
//    r5.yz = transposeViewInvMat._m02_m02 * r5.zy;
//    r3.w = transposeViewInvMat._m22 * r5.x + -r5.y;
//    r8.y = r3.w * r1.x + r3.z;
//    r2.w = -transposeViewInvMat._m22 * r2.w + r6.z;
//    r3.z = -transposeViewInvMat._m12 * r5.x + r5.z;
//    r8.z = r3.z * r1.x + r2.w;
//    r1.x = dot(r8.xyz, r8.xyz);
//    r1.x = rsqrt(r1.x);
//    r5.xyz = r8.xyz * r1.xxx;
//    r6.xyz = r5.zxy * r4.xyz;
//    r4.xyz = r5.yzx * r4.yzx + -r6.xyz;
//	
//	r26.xyzw = viewProjMat._m10_m11_m12_m13 * r0.yyyy;
//    r26.xyzw = r0.xxxx * viewProjMat._m00_m01_m02_m03 + r26.xyzw;
//    r26.xyzw = r0.zzzz * viewProjMat._m20_m21_m22_m23 + r26.xyzw;
//    r26.xyzw = viewProjMat._m30_m31_m32_m33 + r26.xyzw;
//	
//	//r0.x-=stereo.x*(1-stereo.y*r26.w)*viewProjMat._m00;
//	
//    r6.xyzw = viewProjMat._m10_m11_m12_m13 * r0.yyyy;
//    r6.xyzw = r0.xxxx * viewProjMat._m00_m01_m02_m03 + r6.xyzw;
//    r6.xyzw = r0.zzzz * viewProjMat._m20_m21_m22_m23 + r6.xyzw;
//    r6.xyzw = viewProjMat._m30_m31_m32_m33 + r6.xyzw;
//    r1.x = cmp(0 < occlusionSphereRadius);
//    if (r1.x != 0) {
//      r3.zw = projElement[0].xy / r6.ww;
//      r6.xyz = r6.xyz / r6.www;
//      r8.zw = float2(0,0);
//      r1.x = 0;
//      r2.w = 0;
//      r4.w = occlusionSphereRadius;
//      r5.w = 0;
//      while (true) {
//        r7.x = cmp((int)r5.w >= 3);
//        if (r7.x != 0) break;
//        r7.x = 0.196349546 + r2.w;
//        r9.x = r1.x;
//        r9.y = 0;
//        r2.w = r7.x;
//        while (true) {
//          r9.z = cmp((int)r9.y >= 8);
//          if (r9.z != 0) break;
//          sincos(r2.w, r10.x, r11.x);
//          r9.z = r11.x * r4.w + occlusionSphereOffset.x;
//          r9.w = r10.x * r4.w + occlusionSphereOffset.y;
//          r9.z = r9.z * r3.z + r6.x;
//          r9.w = r9.w * r3.w + r6.y;
//          r10.x = cmp(r9.z < -1);
//          r10.y = cmp(1 < r9.z);
//          r10.x = (int)r10.y | (int)r10.x;
//          r10.y = cmp(r9.w < -1);
//          r10.x = (int)r10.y | (int)r10.x;
//          r10.y = cmp(1 < r9.w);
//          r10.x = (int)r10.y | (int)r10.x;
//          if (r10.x != 0) {
//            r10.y = -1;
//          }
//          if (r10.x == 0) {
//            r9.zw = float2(1,-1) + r9.zw;
//            r9.zw = screenSize.xy * r9.zw;
//            r9.z = r9.z * 0.5 + 0.5;
//            r9.w = r9.w * -0.5 + 0.5;
//            r8.xy = (int2)r9.zw;
//            r8.x = ReadonlyDepth.Load(r8.xyz).x;
//            r10.y = cmp(r6.z < r8.x);
//          }
//          if (r10.y != 0) {
//            r9.x = (int)r9.x + 1;
//          }
//          r9.y = (int)r9.y + 1;
//          r2.w = 0.785398185 + r2.w;
//        }
//        r1.x = r9.x;
//        r5.w = (int)r5.w + 1;
//        r4.w = -occlusionSphereRadius * 0.333333343 + r4.w;
//      }
//      r3.zw = cmp(r6.xy < float2(-1,-1));
//      r8.xy = cmp(float2(1,1) < r6.xy);
//      r2.w = (int)r3.z | (int)r8.x;
//      r2.w = (int)r3.w | (int)r2.w;
//      r2.w = (int)r8.y | (int)r2.w;
//      if (r2.w != 0) {
//        r3.z = -1;
//      }
//      if (r2.w == 0) {
//        r6.xy = float2(1,-1) + r6.xy;
//        r6.xy = screenSize.xy * r6.xy;
//        r6.xy = r6.xy * float2(0.5,-0.5) + float2(0.5,0.5);
//        r8.xy = (int2)r6.xy;
//        r8.zw = float2(0,0);
//        r2.w = ReadonlyDepth.Load(r8.xyz).x;
//        r3.z = cmp(r6.z < r2.w);
//      }
//      if (r3.z != 0) {
//        r1.x = (int)r1.x + 1;
//      }
//    } else {
//      r1.x = 0;
//    }
//    r1.x = (int)r1.x;
//    r1.x = -r1.x * 0.0399999991 + 1;
//    r2.w = cmp(dofVanishDistance < 0);
//    if (r2.w != 0) {
//      r3.z = 1;
//    }
//    if (r2.w == 0) {
//      r2.w = cmp(r6.w >= dofVanishDistance);
//      if (r2.w != 0) {
//        r3.z = 0;
//      } else {
//        r2.w = cmp(r6.w >= dofNear);
//        if (r2.w != 0) {
//          r3.z = 1;
//        } else {
//          r2.w = r6.w / dofNear;
//          r3.w = 1 + -dofMinAlpha;
//          r3.z = r2.w * r3.w + dofMinAlpha;
//        }
//      }
//    }
//    r0.xyz = r4.xyz * r3.xxx + r0.xyz;
//    r0.xyz = r5.xyz * r3.yyy + r0.xyz;
//	
//	r26.xyzw = viewProjMat._m10_m11_m12_m13 * r0.yyyy;
//    r26.xyzw = r0.xxxx * viewProjMat._m00_m01_m02_m03 + r26.xyzw;
//    r26.xyzw = r0.zzzz * viewProjMat._m20_m21_m22_m23 + r26.xyzw;
//    r26.xyzw = viewProjMat._m32_m30_m31_m33 + r26.zxyw;
//	
//	//r0.x-=stereo.x*(1-stereo.y*r26.w)*viewProjMat._m00;
//	
//    r4.xyzw = viewProjMat._m10_m11_m12_m13 * r0.yyyy;
//    r4.xyzw = r0.xxxx * viewProjMat._m00_m01_m02_m03 + r4.xyzw;
//    r4.xyzw = r0.zzzz * viewProjMat._m20_m21_m22_m23 + r4.xyzw;
//    r4.xyzw = viewProjMat._m32_m30_m31_m33 + r4.zxyw;
//    r2.w = cmp(depthBias != 0.000000);
//    if (r2.w != 0) {
//      r2.w = -depthBias + -r4.w;
//      r3.x = projElement[1].y * r2.w;
//      r2.w = r2.w * projElement[1].x + projElement[1].z;
//      r3.x = max(r2.w, r3.x);
//      r2.w = r2.w / r3.x;
//      r4.x = r2.w * r4.w;
//    }
//    r3.xyw = r1.yyy ? r0.xyz : emitterPos.xyz;
//    r1.y = cmp(r4.w < fadeDepth.x);
//    r2.w = cmp(fadeDepth.w < r4.w);
//    r1.y = (int)r1.y | (int)r2.w;
//    if (r1.y != 0) {
//      r1.y = 0;
//    } else {
//      r2.w = cmp(r4.w < fadeDepth.y);
//      if (r2.w != 0) {
//        r2.w = -fadeDepth.x + r4.w;
//        r5.x = fadeDepth.y + -fadeDepth.x;
//        r1.y = r2.w / r5.x;
//      } else {
//        r2.w = cmp(fadeDepth.z < r4.w);
//        if (r2.w != 0) {
//          r2.w = -fadeDepth.z + r4.w;
//          r5.x = fadeDepth.w + -fadeDepth.z;
//          r2.w = r2.w / r5.x;
//          r1.y = 1 + -r2.w;
//        } else {
//          r1.y = 1;
//        }
//      }
//    }
//    r1.w = cmp((int)r1.w != 0);
//    r3.xyw = r3.xyw + -r7.yzw;
//    r2.w = dot(r3.xyw, r3.xyw);
//    r2.w = rsqrt(r2.w);
//    r3.xyw = r3.xyw * r2.www;
//    r2.w = dot(fadeConeDir.xyz, r3.xyw);
//    r3.x = cmp(-r2.w < 0);
//    r1.w = r1.w ? r3.x : 0;
//    if (r1.w == 0) {
//      r2.w = -r2.w;
//    }
//    r1.w = cmp(r2.w >= fadeCone);
//    if (r1.w != 0) {
//      r1.w = r1.z ? fadeAlphaRate : 1;
//    } else {
//      r3.x = cmp(r2.w >= fadeSpread);
//      if (r3.x != 0) {
//        r2.w = -fadeSpread + r2.w;
//        r3.x = fadeCone + -fadeSpread;
//        r2.w = r2.w / r3.x;
//        if (r1.z != 0) {
//          r2.w = 1 + -r2.w;
//        }
//        r3.x = 1 + -fadeAlphaRate;
//        r1.w = r2.w * r3.x + fadeAlphaRate;
//      } else {
//        r1.w = r1.z ? 1 : fadeAlphaRate;
//      }
//    }
//    r1.z = 1 + -fadeEnableAngle;
//    r1.z = r1.w * fadeEnableAngle + r1.z;
//    r3.xyw = -emitterPos.xyz + r7.yzw;
//    r1.w = dot(r3.xyw, r3.xyw);
//    r1.w = sqrt(r1.w);
//    r2.w = 0.00999999978 + fadeEmitterFadeinEnd;
//    r2.w = max(fadeEmitterFadeinStart, r2.w);
//    r1.w = min(r2.w, r1.w);
//    r1.w = max(fadeEmitterFadeinEnd, r1.w);
//    r1.w = -fadeEmitterFadeinEnd + r1.w;
//    r2.w = -fadeEmitterFadeinEnd + r2.w;
//    r1.w = r1.w / r2.w;
//    r1.w = 1 + -r1.w;
//    r2.w = 1 + -fadeEmitterAlphaRate;
//    r3.xyw = emitterPos.xyz + -r7.yzw;
//    r5.x = dot(r3.xyw, r3.xyw);
//    r5.x = rsqrt(r5.x);
//    r3.xyw = r5.xxx * r3.xyw;
//    r0.xyz = -emitterPos.xyz + r0.xyz;
//    r5.x = dot(r0.xyz, r0.xyz);
//    r5.x = rsqrt(r5.x);
//    r0.xyz = r5.xxx * r0.xyz;
//    r0.x = dot(r0.xyz, r3.xyw);
//    r0.y = cmp(-r0.x >= fadeEmitterCone);
//    if (r0.y != 0) {
//      r0.y = 1;
//    } else {
//      r0.z = cmp(-r0.x >= fadeEmitterSpread);
//      if (r0.z != 0) {
//        r0.x = -fadeEmitterSpread + -r0.x;
//        r0.z = fadeEmitterCone + -fadeEmitterSpread;
//        r0.x = r0.x / r0.z;
//        r0.y = r0.x * r2.w + fadeEmitterAlphaRate;
//      } else {
//        r0.y = fadeEmitterAlphaRate;
//      }
//    }
//    r0.x = 1 + -fadeEmitterEnableAngle;
//    r0.y = saturate(r1.w * r2.w + r0.y);
//    r0.x = r0.y * fadeEmitterEnableAngle + r0.x;
//    r0.y = r1.z * fadeEnableAngle + fadeEnableAngle;
//    r0.z = r0.x * fadeEmitterEnableAngle + fadeEmitterEnableAngle;
//    r0.y = cmp(r0.y >= r0.z);
//    r0.x = r0.y ? r1.z : r0.x;
//    r0.x = r1.y * r0.x;
//    r0.x = r0.x * r1.x;
//    r0.x = r0.x * r3.z;
//    r0.y = (uint)r0.w >> 24;
//    r0.y = (uint)r0.y;
//    r1.w = r0.y * r0.x;
//    if (8 == 0) r0.x = 0; else if (8+8 < 32) {     r0.x = (uint)r0.w << (32-(8 + 8)); r0.x = (uint)r0.x >> (32-8);    } else r0.x = (uint)r0.w >> 8;
//    if (8 == 0) r0.y = 0; else if (8+16 < 32) {     r0.y = (uint)r0.w << (32-(8 + 16)); r0.y = (uint)r0.y >> (32-8);    } else r0.y = (uint)r0.w >> 16;
//    r0.xy = (uint2)r0.xy;
//    r1.yz = float2(0.00392156886,0.00392156886) * r0.xy;
//    r0.x = (int)r0.w & 255;
//    r0.x = (uint)r0.x;
//    r1.x = 0.00392156886 * r0.x;
//    r0.x = BillboardParticleStructureResults[v0.x].frontDiffuse.x;
//    r0.y = BillboardParticleStructureResults[v0.x].frontDiffuse.y;
//    r0.z = BillboardParticleStructureResults[v0.x].frontDiffuse.z;
//    r3.x = BillboardParticleStructureResults[v0.x].fogInfluence.x;
//    r3.y = BillboardParticleStructureResults[v0.x].fogInfluence.y;
//    r3.z = BillboardParticleStructureResults[v0.x].fogInfluence.z;
//    r3.w = BillboardParticleStructureResults[v0.x].fogInfluence.w;
//    r0.xyz = r0.xyz * r3.www + r3.xzy;
//    r0.w = 0.00392156886;
//    r0.xyzw = r1.xyzw * r0.xyzw;
//    r1.yzw = effectPlayerColor >> int3(8,16,24);
//    r1.x = effectPlayerColor;
//    r1.xyzw = (int4)r1.xyzw & int4(255,255,255,255);
//    r1.xyzw = (uint4)r1.xyzw;
//    r0.xyzw = r1.xyzw * r0.xyzw;
//    o1.xyzw = float4(0.00392156886,0.00392156886,0.00392156886,0.00392156886) * r0.xyzw;
//    r0.x = BillboardParticleStructureResults[v0.x].uvsAttribute;
//    r0.xyz = (int3)r0.xxx & int3(4,8,1);
//    if (r0.x != 0) {
//      r2.y = -r2.y;
//    }
//    if (r0.y != 0) {
//      r2.x = -r2.x;
//    }
//    if (r0.z != 0) {
//      r2.z = -r2.x;
//      r2.xy = r2.yz;
//    }
//    r0.xy = float2(1,1) + r2.xy;
//    r1.x = texRect.x * r0.x;
//    r0.x = 2 + -r0.y;
//    r1.y = texRect.y * r0.x;
//    r0.x = BillboardParticleStructureResults[v0.x].texRect.x;
//    r0.y = BillboardParticleStructureResults[v0.x].texRect.y;
//    o2.xy = r1.xy * float2(0.5,0.5) + r0.xy;
//    r0.x = BillboardParticleStructureResults[v0.x].blendParam.x;
//    r0.y = BillboardParticleStructureResults[v0.x].blendParam.y;
//    r0.z = BillboardParticleStructureResults[v0.x].blendParam.z;
//    r0.w = BillboardParticleStructureResults[v0.x].edgeOuterColor;
//    o0.xyzw = r4.yzxw;
//    o3.xyz = r0.xyz;
//    o4.x = r0.w;
//  } else {
//    o0.xyzw = float4(0,0,0,0);
//    o1.xyzw = float4(0,0,0,0);
//    o2.xyzw = float4(0,0,0,0);
//    o3.xyzw = float4(0,0,0,0);
//    o4.xyzw = float4(0,0,0,0);
//  }
//  return;
//}
//
///*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 10.1
//
//   using 3Dmigoto v1.3.14 on Wed Feb 06 18:42:51 2019
//
//
// Buffer Definitions:
//
// cbuffer SceneInfo
// {
//
//   row_major float4x4 viewProjMat;    // Offset:    0 Size:    64
//   row_major float3x4 transposeViewMat;// Offset:   64 Size:    48 [unused]
//   row_major float3x4 transposeViewInvMat;// Offset:  112 Size:    48
//   float4 projElement[2];             // Offset:  160 Size:    32
//   float4 projInvElements[2];         // Offset:  192 Size:    32 [unused]
//   row_major float4x4 viewProjInvMat; // Offset:  224 Size:    64 [unused]
//   row_major float4x4 prevViewProjMat;// Offset:  288 Size:    64 [unused]
//   float3 ZToLinear;                  // Offset:  352 Size:    12 [unused]
//   float subdivisionLevel;            // Offset:  364 Size:     4 [unused]
//   float2 screenSize;                 // Offset:  368 Size:     8
//   float2 screenInverseSize;          // Offset:  376 Size:     8 [unused]
//   float2 cullingHelper;              // Offset:  384 Size:     8 [unused]
//   float cameraNearPlane;             // Offset:  392 Size:     4 [unused]
//   float cameraFarPlane;              // Offset:  396 Size:     4 [unused]
//   float4 viewFrustum[6];             // Offset:  400 Size:    96 [unused]
//   float4 clipplane;                  // Offset:  496 Size:    16 [unused]
//
// }
//
// cbuffer GpuParticleVS
// {
//
//   float depthBias;                   // Offset:    0 Size:     4
//   float softParticleDist;            // Offset:    4 Size:     4 [unused]
//   float fadeCone;                    // Offset:    8 Size:     4
//   float fadeSpread;                  // Offset:   12 Size:     4
//   float3 fadeConeDir;                // Offset:   16 Size:    12
//   float fadeAlphaRate;               // Offset:   28 Size:     4
//   float4 fadeDepth;                  // Offset:   32 Size:    16
//   float3 occlusionSphereOffset;      // Offset:   48 Size:    12
//   uint effectFlags;                  // Offset:   60 Size:     4
//   float occlusionSphereRadius;       // Offset:   64 Size:     4
//   float occlusionSizeRate;           // Offset:   68 Size:     4 [unused]
//   float dofNear;                     // Offset:   72 Size:     4
//   float dofMaxScale;                 // Offset:   76 Size:     4 [unused]
//   float dofMinAlpha;                 // Offset:   80 Size:     4
//   uint dofUsingMipLevel;             // Offset:   84 Size:     4 [unused]
//   float dofVanishDistance;           // Offset:   88 Size:     4
//   float fadeEnableAngle;             // Offset:   92 Size:     4
//   float lumaBleed;                   // Offset:   96 Size:     4 [unused]
//   float lumaSlide;                   // Offset:  100 Size:     4 [unused]
//   float lumaScale;                   // Offset:  104 Size:     4 [unused]
//   float lumaBias;                    // Offset:  108 Size:     4 [unused]
//   float2 texRect;                    // Offset:  112 Size:     8
//   float lumaTexelScale;              // Offset:  120 Size:     4 [unused]
//   float texEV;                       // Offset:  124 Size:     4 [unused]
//   float3 emitterPos;                 // Offset:  128 Size:    12
//   float alphaRate;                   // Offset:  140 Size:     4 [unused]
//   float usePhysicalAlphaBlend;       // Offset:  144 Size:     4 [unused]
//   float fadeEmitterCone;             // Offset:  148 Size:     4
//   float fadeEmitterSpread;           // Offset:  152 Size:     4
//   float fadeEmitterAlphaRate;        // Offset:  156 Size:     4
//   float fadeEmitterEnableAngle;      // Offset:  160 Size:     4
//   float fadeEmitterFadeinStart;      // Offset:  164 Size:     4
//   float fadeEmitterFadeinEnd;        // Offset:  168 Size:     4
//   float detonemapRate;               // Offset:  172 Size:     4 [unused]
//   uint effectPlayerColor;            // Offset:  176 Size:     4
//   float gpuParticleReserve0;         // Offset:  180 Size:     4 [unused]
//   float gpuParticleReserve1;         // Offset:  184 Size:     4 [unused]
//   float gpuParticleReserve2;         // Offset:  188 Size:     4 [unused]
//
// }
//
// Resource bind info for BillboardParticleStructureResults
// {
//
//   struct ParticleStructure
//   {
//
//       float3 position;               // Offset:    0
//       uint color;                    // Offset:   12
//       float3 localPosition;          // Offset:   16
//       float reserve;                 // Offset:   28
//       float3 blendParam;             // Offset:   32
//       uint edgeOuterColor;           // Offset:   44
//       float3 rotation;               // Offset:   48
//       float particleTime;            // Offset:   60
//       float4 velocity;               // Offset:   64
//       float4 life;                   // Offset:   80
//       float3 size;                   // Offset:   96
//       uint attribute;                // Offset:  108
//       float2 texRect;                // Offset:  112
//       float texTimer;                // Offset:  120
//       float texSpeed;                // Offset:  124
//       float3 frontDiffuse;           // Offset:  128
//       uint texIndex;                 // Offset:  140
//       float4 fogInfluence;           // Offset:  144
//       uint4 meshEmitterAttr;         // Offset:  160
//       float velocityCoef;            // Offset:  176
//       float vectorFieldCoef;         // Offset:  180
//       uint uintGeneric;              // Offset:  184
//       uint uvsAttribute;             // Offset:  188
//       float2 reserved;               // Offset:  192
//       float collisionTime;           // Offset:  200
//       uint collisionAttribute;       // Offset:  204
//       float3 birthPosition;          // Offset:  208
//
//   } $Element;                        // Offset:    0 Size:   220
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// ReadonlyDepth                     texture   float          2d    0        1
// BillboardParticleStructureResults    texture  struct         r/o    1        1
// SceneInfo                         cbuffer      NA          NA    0        1
// GpuParticleVS                     cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// GENERIC                  0   xyzw        0     NONE     int   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
// Generic                  0   xyzw        2     NONE   float   xyzw
// Generic                  1   xyzw        3     NONE   float   xyzw
// Generic                  2   xyzw        4     NONE    uint   xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_constantbuffer cb0[24], immediateIndexed
dcl_constantbuffer cb1[12], immediateIndexed
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_structured t1, 220
dcl_input v0.xyz
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_temps 12
ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r0.x, v0.x, l(108), t1.xxxx
and r0.x, r0.x, l(1)
if_nz r0.x
  mov r0.x, l(1)
else
  mov r0.x, l(0)
endif
ieq r0.x, r0.x, l(1)
if_nz r0.x
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r0.xyzw, v0.x, l(0), t1.xyzw
  and r1.xyzw, cb1[3].wwww, l(0x00008000, 1, 2, 4)
  if_nz r1.x
    ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r2.xyz, v0.x, l(208), t1.xyzx
    add r3.xyz, r0.xyzx, -r2.xyzx
    dp3 r4.x, r3.xyzx, cb0[7].xyzx
    dp3 r4.y, r3.xyzx, cb0[8].xyzx
    dp3 r4.z, r3.xyzx, cb0[9].xyzx
    add r0.xyz, r2.xyzx, r4.xyzx
  endif
  itof r2.xy, v0.yzyy
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r1.x, v0.x, l(96), t1.xxxx
  mul r3.xy, r1.xxxx, r2.xyxx
  mul r3.xy, r3.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000)
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r1.x, v0.x, l(48), t1.xxxx
  mov r4.z, cb0[7].z
  mov r4.x, cb0[8].z
  mov r4.y, cb0[9].z
  mul r3.zw, r4.xxxz, l(0.000000, 0.000000, 0.000000, 1.000000)
  mad r3.zw, r4.yyyx, l(0.000000, 0.000000, 1.000000, 0.000000), -r3.zzzw
  mov r5.x, cb0[7].x
  mov r5.y, cb0[9].x
  dp2 r2.w, r3.zwzz, r5.xyxx
  lt r2.w, l(0.000000), r2.w
  if_nz r2.w
    mad r5.xyz, -r4.zxyz, cb0[8].zzzz, l(0.000000, 1.000000, 0.000000, 0.000000)
    dp3 r2.w, r5.xyzx, r5.xyzx
    rsq r2.w, r2.w
    mul r5.xyz, r2.wwww, r5.xyzx
  else
    mad r6.xyz, r4.zxyz, cb0[8].zzzz, l(-0.000000, -1.000000, -0.000000, 0.000000)
    dp3 r2.w, r6.xyzx, r6.xyzx
    rsq r2.w, r2.w
    mul r5.xyz, r2.wwww, r6.xyzx
  endif
  sincos r1.x, r6.x, r1.x
  mov r7.xy, cb0[7].zwzz
  mov r7.z, cb0[8].w
  mov r7.w, cb0[9].w
  mul r3.zw, r5.yyyz, cb0[8].zzzz
  mad r2.w, -r7.x, r5.x, -r3.z
  mad r2.w, -cb0[9].z, r5.z, r2.w
  add r3.z, -r6.x, l(1.000000)
  mul r2.w, r2.w, r3.z
  mul r6.xyz, r5.xyzx, r6.xxxx
  mad r3.z, -r7.x, r2.w, r6.x
  mad r3.w, -cb0[9].z, r5.y, r3.w
  mad r8.x, r3.w, r1.x, r3.z
  mad r3.z, -cb0[8].z, r2.w, r6.y
  mul r5.yz, r5.zzyz, cb0[7].zzzz
  mad r3.w, cb0[9].z, r5.x, -r5.y
  mad r8.y, r3.w, r1.x, r3.z
  mad r2.w, -cb0[9].z, r2.w, r6.z
  mad r3.z, -cb0[8].z, r5.x, r5.z
  mad r8.z, r3.z, r1.x, r2.w
  dp3 r1.x, r8.xyzx, r8.xyzx
  rsq r1.x, r1.x
  mul r5.xyz, r1.xxxx, r8.xyzx
  mul r6.xyz, r4.xyzx, r5.zxyz
  mad r4.xyz, r5.yzxy, r4.yzxy, -r6.xyzx
  mul r6.xyzw, r0.yyyy, cb0[1].xyzw
  mad r6.xyzw, r0.xxxx, cb0[0].xyzw, r6.xyzw
  mad r6.xyzw, r0.zzzz, cb0[2].xyzw, r6.xyzw
  add r6.xyzw, r6.xyzw, cb0[3].xyzw
  lt r1.x, l(0.000000), cb1[4].x
  if_nz r1.x
    div r3.zw, cb0[10].xxxy, r6.wwww
    div r6.xyz, r6.xyzx, r6.wwww
    mov r8.zw, l(0,0,0,0)
    mov r1.x, l(0)
    mov r2.w, l(0)
    mov r4.w, cb1[4].x
    mov r5.w, l(0)
    loop
      ige r7.x, r5.w, l(3)
      breakc_nz r7.x
      add r7.x, r2.w, l(0.196349546)
      mov r9.x, r1.x
      mov r9.y, l(0)
      mov r2.w, r7.x
      loop
        ige r9.z, r9.y, l(8)
        breakc_nz r9.z
        sincos r10.x, r11.x, r2.w
        mad r9.z, r11.x, r4.w, cb1[3].x
        mad r9.w, r10.x, r4.w, cb1[3].y
        mad r9.z, r9.z, r3.z, r6.x
        mad r9.w, r9.w, r3.w, r6.y
        lt r10.x, r9.z, l(-1.000000)
        lt r10.y, l(1.000000), r9.z
        or r10.x, r10.y, r10.x
        lt r10.y, r9.w, l(-1.000000)
        or r10.x, r10.y, r10.x
        lt r10.y, l(1.000000), r9.w
        or r10.x, r10.y, r10.x
        if_nz r10.x
          mov r10.y, l(-1)
        endif
        if_z r10.x
          add r9.zw, r9.zzzw, l(0.000000, 0.000000, 1.000000, -1.000000)
          mul r9.zw, r9.zzzw, cb0[23].xxxy
          mad r9.z, r9.z, l(0.500000), l(0.500000)
          mad r9.w, r9.w, l(-0.500000), l(0.500000)
          ftoi r8.xy, r9.zwzz
          ld_indexable(texture2d)(float,float,float,float) r8.x, r8.xyzw, t0.xyzw
          lt r10.y, r6.z, r8.x
        endif
        if_nz r10.y
          iadd r9.x, r9.x, l(1)
        endif
        iadd r9.y, r9.y, l(1)
        add r2.w, r2.w, l(0.785398185)
      endloop
      mov r1.x, r9.x
      iadd r5.w, r5.w, l(1)
      mad r4.w, -cb1[4].x, l(0.333333343), r4.w
    endloop
    lt r3.zw, r6.xxxy, l(0.000000, 0.000000, -1.000000, -1.000000)
    lt r8.xy, l(1.000000, 1.000000, 0.000000, 0.000000), r6.xyxx
    or r2.w, r3.z, r8.x
    or r2.w, r3.w, r2.w
    or r2.w, r8.y, r2.w
    if_nz r2.w
      mov r3.z, l(-1)
    endif
    if_z r2.w
      add r6.xy, r6.xyxx, l(1.000000, -1.000000, 0.000000, 0.000000)
      mul r6.xy, r6.xyxx, cb0[23].xyxx
      mad r6.xy, r6.xyxx, l(0.500000, -0.500000, 0.000000, 0.000000), l(0.500000, 0.500000, 0.000000, 0.000000)
      ftoi r8.xy, r6.xyxx
      mov r8.zw, l(0,0,0,0)
      ld_indexable(texture2d)(float,float,float,float) r2.w, r8.xyzw, t0.yzwx
      lt r3.z, r6.z, r2.w
    endif
    if_nz r3.z
      iadd r1.x, r1.x, l(1)
    endif
  else
    mov r1.x, l(0)
  endif
  itof r1.x, r1.x
  mad r1.x, -r1.x, l(0.040000), l(1.000000)
  lt r2.w, cb1[5].z, l(0.000000)
  if_nz r2.w
    mov r3.z, l(1.000000)
  endif
  if_z r2.w
    ge r2.w, r6.w, cb1[5].z
    if_nz r2.w
      mov r3.z, l(0)
    else
      ge r2.w, r6.w, cb1[4].z
      if_nz r2.w
        mov r3.z, l(1.000000)
      else
        div r2.w, r6.w, cb1[4].z
        add r3.w, -cb1[5].x, l(1.000000)
        mad r3.z, r2.w, r3.w, cb1[5].x
      endif
    endif
  endif
  mad r0.xyz, r4.xyzx, r3.xxxx, r0.xyzx
  mad r0.xyz, r5.xyzx, r3.yyyy, r0.xyzx
  mul r4.xyzw, r0.yyyy, cb0[1].xyzw
  mad r4.xyzw, r0.xxxx, cb0[0].xyzw, r4.xyzw
  mad r4.xyzw, r0.zzzz, cb0[2].xyzw, r4.xyzw
  add r4.xyzw, r4.zxyw, cb0[3].zxyw
  ne r2.w, cb1[0].x, l(0.000000)
  if_nz r2.w
    add r2.w, -r4.w, -cb1[0].x
    mul r3.x, r2.w, cb0[11].y
    mad r2.w, r2.w, cb0[11].x, cb0[11].z
    max r3.x, r3.x, r2.w
    div r2.w, r2.w, r3.x
    mul r4.x, r4.w, r2.w
  endif
  movc r3.xyw, r1.yyyy, r0.xyxz, cb1[8].xyxz
  lt r1.y, r4.w, cb1[2].x
  lt r2.w, cb1[2].w, r4.w
  or r1.y, r1.y, r2.w
  if_nz r1.y
    mov r1.y, l(0)
  else
    lt r2.w, r4.w, cb1[2].y
    if_nz r2.w
      add r2.w, r4.w, -cb1[2].x
      add r5.x, -cb1[2].x, cb1[2].y
      div r1.y, r2.w, r5.x
    else
      lt r2.w, cb1[2].z, r4.w
      if_nz r2.w
        add r2.w, r4.w, -cb1[2].z
        add r5.x, -cb1[2].z, cb1[2].w
        div r2.w, r2.w, r5.x
        add r1.y, -r2.w, l(1.000000)
      else
        mov r1.y, l(1.000000)
      endif
    endif
  endif
  ine r1.w, r1.w, l(0)
  add r3.xyw, -r7.yzyw, r3.xyxw
  dp3 r2.w, r3.xywx, r3.xywx
  rsq r2.w, r2.w
  mul r3.xyw, r2.wwww, r3.xyxw
  dp3 r2.w, cb1[1].xyzx, r3.xywx
  lt r3.x, -r2.w, l(0.000000)
  and r1.w, r1.w, r3.x
  if_z r1.w
    mov r2.w, -r2.w
  endif
  ge r1.w, r2.w, cb1[0].z
  if_nz r1.w
    movc r1.w, r1.z, cb1[1].w, l(1.000000)
  else
    ge r3.x, r2.w, cb1[0].w
    if_nz r3.x
      add r2.w, r2.w, -cb1[0].w
      add r3.x, -cb1[0].w, cb1[0].z
      div r2.w, r2.w, r3.x
      if_nz r1.z
        add r2.w, -r2.w, l(1.000000)
      endif
      add r3.x, -cb1[1].w, l(1.000000)
      mad r1.w, r2.w, r3.x, cb1[1].w
    else
      movc r1.w, r1.z, l(1.000000), cb1[1].w
    endif
  endif
  add r1.z, -cb1[5].w, l(1.000000)
  mad r1.z, r1.w, cb1[5].w, r1.z
  add r3.xyw, r7.yzyw, -cb1[8].xyxz
  dp3 r1.w, r3.xywx, r3.xywx
  sqrt r1.w, r1.w
  add r2.w, cb1[10].z, l(0.010000)
  max r2.w, r2.w, cb1[10].y
  min r1.w, r1.w, r2.w
  max r1.w, r1.w, cb1[10].z
  add r1.w, r1.w, -cb1[10].z
  add r2.w, r2.w, -cb1[10].z
  div r1.w, r1.w, r2.w
  add r1.w, -r1.w, l(1.000000)
  add r2.w, -cb1[9].w, l(1.000000)
  add r3.xyw, -r7.yzyw, cb1[8].xyxz
  dp3 r5.x, r3.xywx, r3.xywx
  rsq r5.x, r5.x
  mul r3.xyw, r3.xyxw, r5.xxxx
  add r0.xyz, r0.xyzx, -cb1[8].xyzx
  dp3 r5.x, r0.xyzx, r0.xyzx
  rsq r5.x, r5.x
  mul r0.xyz, r0.xyzx, r5.xxxx
  dp3 r0.x, r0.xyzx, r3.xywx
  ge r0.y, -r0.x, cb1[9].y
  if_nz r0.y
    mov r0.y, l(1.000000)
  else
    ge r0.z, -r0.x, cb1[9].z
    if_nz r0.z
      add r0.x, -r0.x, -cb1[9].z
      add r0.z, -cb1[9].z, cb1[9].y
      div r0.x, r0.x, r0.z
      mad r0.y, r0.x, r2.w, cb1[9].w
    else
      mov r0.y, cb1[9].w
    endif
  endif
  add r0.x, -cb1[10].x, l(1.000000)
  mad_sat r0.y, r1.w, r2.w, r0.y
  mad r0.x, r0.y, cb1[10].x, r0.x
  mad r0.y, r1.z, cb1[5].w, cb1[5].w
  mad r0.z, r0.x, cb1[10].x, cb1[10].x
  ge r0.y, r0.y, r0.z
  movc r0.x, r0.y, r1.z, r0.x
  mul r0.x, r0.x, r1.y
  mul r0.x, r1.x, r0.x
  mul r0.x, r3.z, r0.x
  ushr r0.y, r0.w, l(24)
  utof r0.y, r0.y
  mul r1.w, r0.x, r0.y
  ubfe r0.xy, l(8, 8, 0, 0), l(8, 16, 0, 0), r0.wwww
  utof r0.xy, r0.xyxx
  mul r1.yz, r0.xxyx, l(0.000000, 0.00392156886, 0.00392156886, 0.000000)
  and r0.x, r0.w, l(255)
  utof r0.x, r0.x
  mul r1.x, r0.x, l(0.00392156886)
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r0.xyz, v0.x, l(128), t1.xyzx
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r3.xyzw, v0.x, l(144), t1.xyzw
  mad r0.xyz, r0.xyzx, r3.wwww, r3.xzyx
  mov r0.w, l(0.00392156886)
  mul r0.xyzw, r0.xyzw, r1.xyzw
  ushr r1.yzw, cb1[11].xxxx, l(0, 8, 16, 24)
  mov r1.x, cb1[11].x
  and r1.xyzw, r1.xyzw, l(255, 255, 255, 255)
  utof r1.xyzw, r1.xyzw
  mul r0.xyzw, r0.xyzw, r1.xyzw
  mul o1.xyzw, r0.xyzw, l(0.00392156886, 0.00392156886, 0.00392156886, 0.00392156886)
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r0.x, v0.x, l(188), t1.xxxx
  and r0.xyz, r0.xxxx, l(4, 8, 1, 0)
  if_nz r0.x
    mov r2.y, -r2.y
  endif
  if_nz r0.y
    mov r2.x, -r2.x
  endif
  if_nz r0.z
    mov r2.z, -r2.x
    mov r2.xy, r2.yzyy
  endif
  add r0.xy, r2.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000)
  mul r1.x, r0.x, cb1[7].x
  add r0.x, -r0.y, l(2.000000)
  mul r1.y, r0.x, cb1[7].y
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r0.xy, v0.x, l(112), t1.xyxx
  mad o2.xy, r1.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000), r0.xyxx
  ld_structured_indexable(structured_buffer, stride=220)(mixed,mixed,mixed,mixed) r0.xyzw, v0.x, l(32), t1.xyzw
  mov o0.xyzw, r4.yzxw
  mov o3.xyz, r0.xyzx
  mov o4.x, r0.w
else
  mov o0.xyzw, l(0,0,0,0)
  mov o1.xyzw, l(0,0,0,0)
  mov o2.xyzw, l(0,0,0,0)
  mov o3.xyzw, l(0,0,0,0)
  mov o4.xyzw, l(0,0,0,0)
endif
ret
// Approximately 335 instruction slots used

