// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed 1a0bdccc4897291f-vs.txt
// 3DMigoto: 1a0bdccc4897291f | Matched 42 variants of 1 shaders: VolumetricFogAndMist/VolumetricFog
//
//                 Unity headers extracted from VolumetricFogAndMist_VolumetricFog
//                 Shader "VolumetricFogAndMist/VolumetricFog" {
//                   SubShader 1/1 {
// 0000ffffffc:        Pass 1/5 {
// 00000000003: 1:     Pass 1/5 {
// 3fff0000000: 1:     Pass 2/5 {
// 00000000003: 2:     Pass 3/5 {
// 3fff0000000: 2:     Pass 4/5 {
// 00000000001: 4:     Pass 5/5 {
//                       ZWrite Off
//                       Program "vp" {
//                         SubProgram "d3d11" {
//                         }
//                       }
//                     }
//                   }
//                 }
//
//              Unity 5.3 headers extracted from VolumetricFogAndMist_VolumetricFog:
//                API d3d11
//                Shader model vs_4_0
//                undeciphered1: 201609010 19 0 0
//                undeciphered1a: 2
// 00000020000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT0" "FOG_TRANSPARENCY_BLEND_PASS" }
// 01000010000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT0" }
// 00000080000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT1" "FOG_TRANSPARENCY_BLEND_PASS" }
// 02000040000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT1" }
// 00000200000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT2" "FOG_TRANSPARENCY_BLEND_PASS" }
// 04000100000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT2" }
// 00000800000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT3" "FOG_TRANSPARENCY_BLEND_PASS" }
// 08000400000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT3" }
// 00002000000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT4" "FOG_TRANSPARENCY_BLEND_PASS" }
// 10001000000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT4" }
// 00008000000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT5" "FOG_TRANSPARENCY_BLEND_PASS" }
// 20004000000:   Keywords { "FOG_DISTANCE_ON" "FOG_POINT_LIGHT5" }
// 00000008000:   Keywords { "FOG_DISTANCE_ON" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00800004000:   Keywords { "FOG_DISTANCE_ON" }
// 00000000008:   Keywords { "FOG_POINT_LIGHT0" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00020000004:   Keywords { "FOG_POINT_LIGHT0" }
// 00000000020:   Keywords { "FOG_POINT_LIGHT1" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00040000010:   Keywords { "FOG_POINT_LIGHT1" }
// 00000000080:   Keywords { "FOG_POINT_LIGHT2" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00080000040:   Keywords { "FOG_POINT_LIGHT2" }
// 00000000200:   Keywords { "FOG_POINT_LIGHT3" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00100000100:   Keywords { "FOG_POINT_LIGHT3" }
// 00000000800:   Keywords { "FOG_POINT_LIGHT4" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00200000400:   Keywords { "FOG_POINT_LIGHT4" }
// 00000002000:   Keywords { "FOG_POINT_LIGHT5" "FOG_TRANSPARENCY_BLEND_PASS" }
// 00400001000:   Keywords { "FOG_POINT_LIGHT5" }
// 00000000002:   Keywords { "FOG_TRANSPARENCY_BLEND_PASS" }
//                undeciphered2: 1 0 4 0 0 0
//                undeciphered3: 9 2 0 0 3 4
// 00000004001:   ConstBuffer "$Globals" 304
// 00000008002:   ConstBuffer "$Globals" 320
// 0000003000c:   ConstBuffer "$Globals" 336
// 000000c0030:   ConstBuffer "$Globals" 368
// 00810000000:   ConstBuffer "$Globals" 384
// 000003000c0:   ConstBuffer "$Globals" 400
// 01020000000:   ConstBuffer "$Globals" 416
// 00000c00300:   ConstBuffer "$Globals" 432
// 02040000000:   ConstBuffer "$Globals" 448
// 00003000c00:   ConstBuffer "$Globals" 464
// 04080000000:   ConstBuffer "$Globals" 480
// 0000c003000:   ConstBuffer "$Globals" 496
// 08100000000:   ConstBuffer "$Globals" 512
// 10200000000:   ConstBuffer "$Globals" 544
// 20400000000:   ConstBuffer "$Globals" 576
//                Vector 32 [_MainTex_TexelSize]
//                Vector 48 [_MainTex_ST]
//                Matrix 96 [_ClipToWorld]
//                ConstBuffer "UnityPerCamera" 144
//                Vector 64 [_WorldSpaceCameraPos] 3
//                Vector 80 [_ProjectionParams]
//                ConstBuffer "UnityPerDraw" 160
//                Matrix 0 [unity_ObjectToWorld]
//                ConstBuffer "UnityPerFrame" 384
//                Matrix 272 [unity_MatrixVP]
//                BindCB "$Globals" 0
//                BindCB "UnityPerCamera" 1
//                BindCB "UnityPerDraw" 2
//                BindCB "UnityPerFrame" 3
//
// 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 Apr 21 17:52:30 2019
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyz
// TEXCOORD                 0   xy          1     NONE   float   xy
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xyzw
// TEXCOORD                 0   xy          1     NONE   float   xy
// TEXCOORD                 1     zw        1     NONE   float     zw
// TEXCOORD                 2   xyz         2     NONE   float   xyz
//
vs_4_0
dcl_constantbuffer cb0[10], immediateIndexed
dcl_constantbuffer cb1[9], immediateIndexed
dcl_constantbuffer cb2[4], immediateIndexed
dcl_constantbuffer cb3[24], immediateIndexed
dcl_input v0.xyz
dcl_input v1.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xy
dcl_output o1.zw
dcl_output o2.xyz
dcl_temps 4

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

ld_indexable(texture2d)(float,float,float,float) r2.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 1a0bdccc4897291f-vs.txt

mul r2.w, -r2.x, r2.y
mad r3.xyz, -r2.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 r0.xyzw, r0.xyzw, cb2[3].xyzw
mul r1.xyzw, r0.yyyy, cb3[18].xyzw
mad r1.xyzw, cb3[17].xyzw, r0.xxxx, r1.xyzw
mad r1.xyzw, cb3[19].xyzw, r0.zzzz, r1.xyzw
mad r0.xyzw, cb3[20].xyzw, r0.wwww, r1.xyzw
mov o0.xyzw, r0.xyzw

// 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 1a0bdccc4897291f-vs.txt
ne r2.w, r0.w, l(1.0)
if_nz r2.w
  add r2.w, r0.w, -r2.y
  mad r0.x, r2.w, r2.x, r0.x
endif

div r0.xy, r0.xyxx, r0.wwww
lt r0.z, cb0[2].y, l(0.000000)
mad r1.xyz, v1.xyxx, cb0[3].xyxx, cb0[3].zwzz
add r0.w, -r1.y, l(1.000000)
movc o1.w, r0.z, r0.w, r1.y
mov o1.xyz, r1.xyzx
mul r0.y, r0.y, cb1[5].x
mul r1.xyzw, r0.yyyy, cb0[7].xyzw
mad r0.xyzw, cb0[6].xyzw, r0.xxxx, r1.xyzw
add r0.xyzw, r0.xyzw, cb0[8].xyzw
add r0.xyzw, r0.xyzw, cb0[9].xyzw
div r0.xyz, r0.xyzx, r0.wwww
add o2.xyz, r0.xyzx, -r3.xyzx
ret
// Approximately 0 instruction slots used