// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 980b240062a9214b-vs.txt
// 3DMigoto: 980b240062a9214b | Matched 8 variants of 1 shaders: PF/Particles
//
//        Unity headers extracted from PF_Particles
//        Shader "PF/Particles" {
//          CustomEditor "ParticlesShaderGUI"
//          SubShader 1/1 {
//            LOD 100
//            Tags { "QUEUE"="Transparent+30" "RenderType"="Transparent" }
//            Pass 1/1 {
//              Tags { "LIGHTMODE"="FORWARDBASE" "QUEUE"="Transparent+30" "RenderType"="Transparent" "SHADOWSUPPORT"="true" }
//              ZWrite [_ZWrite]
//              Program "vp" {
//                SubProgram "d3d11" {
//                }
//              }
//            }
//          }
//        }
//
//     Unity 5.3 headers extracted from PF_Particles:
//       API d3d11
//       Shader model vs_4_0
//       undeciphered1: 201802150 35 0 0
//       undeciphered1a: 3
// 80:   Keywords { "DIRECTIONAL" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 01:   Keywords { "DIRECTIONAL" "LIGHTPROBE_SH" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 10:   Keywords { "DIRECTIONAL" "LIGHTPROBE_SH" "VERTEXLIGHT_ON" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 02:   Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 04:   Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" "LIGHTPROBE_SH" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 40:   Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" "LIGHTPROBE_SH" "VERTEXLIGHT_ON" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 20:   Keywords { "DIRECTIONAL" "SHADOWS_SCREEN" "VERTEXLIGHT_ON" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
// 08:   Keywords { "DIRECTIONAL" "VERTEXLIGHT_ON" "ALPHAPREMULTIPLY_ON" "INVERT_OPACITY_FALLOFF" "OPACITY_FALLOFF" }
//       undeciphered2: 1 0 5 0 0 0
//       undeciphered3: 27 4 0 0 1 1 3 3 4 5
//       ConstBuffer "$Globals" 2768
//       Vector 96 [_MainTex_ST]
//       Vector 192 [_FogOfWarMask_ST]
//       Vector 2400 [_UV0Speed] 2
//       Float 2452 [_HDRColorScale]
//       Float 2600 [_TexSheetEnabled]
//       Float 2656 [_TimeEditor]
//       Float 2660 [_VirtualOffset]
//       Float 2664 [_OpacityFalloff]
//       ConstBuffer "UnityPerCamera" 144
//       Vector 0 [_Time]
//       Vector 64 [_WorldSpaceCameraPos] 3
//       ConstBuffer "UnityPerDraw" 176
//       Matrix 0 [unity_ObjectToWorld]
//       Matrix 64 [unity_WorldToObject]
//       ConstBuffer "UnityPerFrame" 368
//       Matrix 80 [glstate_matrix_projection]
//       Matrix 272 [unity_MatrixVP]
//       ConstBuffer "PFCommonBuffer" 240
//       Vector 48 [_TintColor]
//       BindCB "$Globals" 0
//       BindCB "UnityPerCamera" 1
//       BindCB "UnityPerDraw" 2
//       BindCB "UnityPerFrame" 3
//       BindCB "PFCommonBuffer" 4
//
// Headers extracted with DarkStarSword's extract_unity55_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v1.3.16 on Sun Aug 23 06:52:00 2020
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float   xyz
// COLOR                    0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 0   xyzw        3     NONE   float   xyzw
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// COLOR                    0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 0   xyzw        2     NONE   float   xyzw
// TEXCOORD                 3   xyzw        3     NONE   float   xyzw
// TEXCOORD                10   xyzw        4     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[167], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[7], immediateIndexed
dcl_constantbuffer cb3[23], immediateIndexed
dcl_constantbuffer cb4[4], immediateIndexed
dcl_input v0.xyzw
dcl_input v1.xyz
dcl_input v2.xyzw
dcl_input v3.xyzw
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyzw
dcl_output o4.xyzw
dcl_temps 5

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125
dcl_constantbuffer cb10[4], immediateIndexed

ld_indexable(texture2d)(float,float,float,float) r3.xyzw, l(0, 0, 0, 0), t125.xyzw


// Unity reflection/specular fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 980b240062a9214b-vs.txt

mul r3.w, -r3.x, r3.y
mad r4.xyz, -r3.wwww, cb10[0].xyzw, cb1[4].xyzw

mul r0.xyzw, v0.yyyy, cb2[1].xyzw
mad r0.xyzw, cb2[0].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb2[2].xyzw, v0.zzzz, r0.xyzw
add r1.xyzw, r0.xyzw, cb2[3].xyzw
mad r0.xyz, cb2[3].xyzx, v0.wwww, r0.xyzx
mul r2.xyzw, r1.yyyy, cb3[18].xyzw
mad r2.xyzw, cb3[17].xyzw, r1.xxxx, r2.xyzw
mad r2.xyzw, cb3[19].xyzw, r1.zzzz, r2.xyzw
mad r1.xyzw, cb3[20].xyzw, r1.wwww, r2.xyzw

// Relocated to here with asmtool.py
mov o0.xyw, r1.xyxw

// Automatic vertex shader halo fix inserted with DarkStarSword's asmtool.py:
// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 980b240062a9214b-vs.txt
ne r3.w, r1.w, l(1.0)
if_nz r3.w
  add r3.w, r1.w, -r3.y
  mad r1.x, r3.w, r3.x, r1.x
endif

mad r2.xy, cb3[7].zwzz, cb0[166].yyyy, r1.zwzz
div r0.w, r2.x, r2.y
mul o0.z, r1.w, r0.w

// mov o0.xyw, r1.xyxw // Relocated from here with asmtool.py

mul r1.xyzw, v2.xyzw, cb4[3].xyzw
mov r2.x, cb0[153].y
mov r2.w, l(1.000000)
mul o1.xyzw, r1.xyzw, r2.xxxw
mad r1.xy, v3.xyxx, cb0[6].xyxx, cb0[6].zwzz
add r0.w, cb0[166].x, cb1[0].y
mad o2.xy, cb0[150].xyxx, r0.wwww, r1.xyxx
lt r0.w, l(0.000000), cb0[162].z
movc o2.zw, r0.wwww, v3.zzzw, v3.xxxy
mad o3.xy, r0.xzxx, cb0[12].xyxx, cb0[12].zwzz
add r0.xyz, -r0.xyzx, r4.xyzx
mov o3.zw, l(0,0,0,0)
dp3 r0.w, r0.xyzx, r0.xyzx
rsq r0.w, r0.w
mul r0.xyz, r0.wwww, r0.xyzx
dp3 r1.x, v1.xyzx, cb2[4].xyzx
dp3 r1.y, v1.xyzx, cb2[5].xyzx
dp3 r1.z, v1.xyzx, cb2[6].xyzx
dp3 r0.w, r1.xyzx, r1.xyzx
rsq r0.w, r0.w
mul r1.xyz, r0.wwww, r1.xyzx
dp3 r0.x, r0.xyzx, r1.xyzx
add r0.x, -|r0.x|, l(1.000000)
max r0.x, r0.x, l(0.000000)
log r0.x, r0.x
mul r0.x, r0.x, cb0[166].z
exp o4.w, r0.x
mov o4.xyz, l(0,0,0,0)
ret
// Approximately 0 instruction slots used