// asmtool.py -I ../.. --auto-fix-vertex-halo --fix-unusual-halo-with-inconsistent-w-optimisation --fix-unity-reflection --fix-unity-frustum-world --only-autofixed ec74e3ef6ecd5edc-vs.txt
// 3DMigoto: ec74e3ef6ecd5edc |    Unity headers extracted from KyotoDeferredDecalMetallic.shader
//    Shader "Hidden/Decals/Metallic Deferred Decal" {
//      Properties {
//      [HideInInspector]  _MaterialId ("_MaterialId", Float) = 1.000000
//      [HideInInspector]  _Stencil ("_Stencil", Float) = 0.000000
//      [HideInInspector]  _CompFunction ("_Comp", Float) = 3.000000
//      [HideInInspector]  _SrcBlend ("__src", Float) = 1.000000
//      [HideInInspector]  _DstBlend ("__dst", Float) = 0.000000
//       _MasterAlphaScale ("Alpha Scale", Float) = 1.000000
//       _AlphaMask ("Diffuse", 2D) = "white" { }
//       _AlbedoTexture ("Albedo", 2D) = "white" { }
//       _Color ("Main Color", Color) = (1.000000,1.000000,1.000000,1.000000)
//       _CompMap ("Composite", 2D) = "white" { }
//       _CompositeScaleParameters ("Metal, Gloss, AO, Gloss Bias", Vector) = (1.000000,1.000000,1.000000,1.000000)
//       _BumpMap ("Normal Map", 2D) = "bump" { }
//       _BumpScale ("Normal Scale", Range(0.000000,10.000000)) = 1.000000
//       _EmissionMap ("Emissive Map", 2D) = "white" { }
//       _EmissionColor ("Emissive Color", Color) = (1.000000,1.000000,1.000000,1.000000)
//       _EmissionScale ("Emissive Scale", Float) = 1.000000
//       _NormalClippingBias ("Normal clip bias", Float) = 0.550000
//       _AlbedoAlpha ("Albedo Alpha", Float) = 1.000000
//       _SpecularAlpha ("Specular Alpha", Float) = 1.000000
//       _GlossAlpha ("Gloss Alpha", Float) = 1.000000
//       _NormalAlpha ("Normal Alpha", Float) = 1.000000
//       _AOAlpha ("AO Alpha", Float) = 1.000000
//      }
//      SubShader 1/1 {
//        LOD 300
//        Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
//        Pass 1/3 {
//          Name "DEFERRED"
//          Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
//          ZTest Always
//          ZWrite Off
//          Cull Front
//          Stencil {
//             Ref 16.000000
//             ReadMask 16.000000
//             WriteMask 16.000000
//             Comp Equal
//             Pass Zero
//             Fail Zero
//            }
//          Blend [_SrcBlend] [_DstBlend], Zero One
//          ColorMask RGB
//          GpuProgramID 13697
//          Program "vp" {
//            SubProgram "d3d11 " {
//              GpuProgramIndex 0
//            }
//          }
//        }
//      }
//    }
//
// Unity 5.3 headers extracted from KyotoDeferredDecalMetallic.shader.decompressed:
//   API d3d11
//   Shader model vs_4_0
//   undeciphered1: 201510240 10 0 0
//   undeciphered2: 1 0 2 0 0 0
//   undeciphered3: 13 3 0 0 2 1 3 4
//   ConstBuffer "UnityPerCamera" 144
//   Vector 80 [_ProjectionParams]
//   ConstBuffer "UnityPerDraw" 352
//   Matrix 0 [glstate_matrix_mvp]
//   Matrix 192 [unity_ObjectToWorld]
//   BindCB "UnityPerCamera" 0
//   BindCB "UnityPerDraw" 1
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://github.com/DarkStarSword/3d-fixes

//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
//   using 3Dmigoto v1.3.12 on Thu Dec 06 16:59:10 2018
//
//
// Buffer Definitions:
//
// cbuffer UnityPerCamera
// {
//
//   float4 _Time;                      // Offset:    0 Size:    16 [unused]
//   float4 _SinTime;                   // Offset:   16 Size:    16 [unused]
//   float4 _CosTime;                   // Offset:   32 Size:    16 [unused]
//   float4 unity_DeltaTime;            // Offset:   48 Size:    16 [unused]
//   float3 _WorldSpaceCameraPos;       // Offset:   64 Size:    12 [unused]
//   float4 _ProjectionParams;          // Offset:   80 Size:    16
//   float4 _ScreenParams;              // Offset:   96 Size:    16 [unused]
//   float4 _ZBufferParams;             // Offset:  112 Size:    16 [unused]
//   float4 unity_OrthoParams;          // Offset:  128 Size:    16 [unused]
//
// }
//
// cbuffer UnityPerDraw
// {
//
//   float4x4 glstate_matrix_mvp;       // Offset:    0 Size:    64
//   float4x4 glstate_matrix_modelview0;// Offset:   64 Size:    64 [unused]
//   float4x4 glstate_matrix_invtrans_modelview0;// Offset:  128 Size:    64 [unused]
//   float4x4 unity_ObjectToWorld;      // Offset:  192 Size:    64
//   float4x4 unity_WorldToObject;      // Offset:  256 Size:    64 [unused]
//   float4 unity_LODFade;              // Offset:  320 Size:    16 [unused]
//   float4 unity_WorldTransformParams; // Offset:  336 Size:    16 [unused]
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// UnityPerCamera                    cbuffer      NA          NA    0        1
// UnityPerDraw                      cbuffer      NA          NA    1        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION                 0   xyzw        0     NONE   float   xyzw
// NORMAL                   0   xyz         1     NONE   float
// TEXCOORD                 0   xy          2     NONE   float   xy
// TEXCOORD                 1   xy          3     NONE   float
// TANGENT                  0   xyzw        4     NONE   float
// COLOR                    0   xyzw        5     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   xyz         3     NONE   float   xyz
// TEXCOORD                 3   xyzw        4     NONE   float   xyzw
//
vs_4_0
dcl_constantbuffer cb0[6], immediateIndexed
dcl_constantbuffer cb1[14], immediateIndexed
dcl_input v0.xyzw
dcl_input v2.xy
dcl_output_siv o0.xyzw, position
dcl_output o1.xyzw
dcl_output o2.xyzw
dcl_output o3.xyz
dcl_output o4.xyzw
dcl_temps 3
//
// Initial variable locations:
//   v0.x <- v.vertex.x; v0.y <- v.vertex.y; v0.z <- v.vertex.z; v0.w <- v.vertex.w;
//   v1.x <- v.normal.x; v1.y <- v.normal.y; v1.z <- v.normal.z;
//   v2.x <- v.uv0.x; v2.y <- v.uv0.y;
//   v3.x <- v.uv1.x; v3.y <- v.uv1.y;
//   v4.x <- v.tangent.x; v4.y <- v.tangent.y; v4.z <- v.tangent.z; v4.w <- v.tangent.w;
//   v5.x <- v.color.x; v5.y <- v.color.y; v5.z <- v.color.z; v5.w <- v.color.w;
//   o4.x <- <decalVertDeferred return value>.ambientOrLightmapUV.x; o4.y <- <decalVertDeferred return value>.ambientOrLightmapUV.y; o4.z <- <decalVertDeferred return value>.ambientOrLightmapUV.z; o4.w <- <decalVertDeferred return value>.ambientOrLightmapUV.w;
//   o3.x <- <decalVertDeferred return value>.orientation.x; o3.y <- <decalVertDeferred return value>.orientation.y; o3.z <- <decalVertDeferred return value>.orientation.z;
//   o2.x <- <decalVertDeferred return value>.screenUv.x; o2.y <- <decalVertDeferred return value>.screenUv.y; o2.z <- <decalVertDeferred return value>.screenUv.z; o2.w <- <decalVertDeferred return value>.screenUv.w;
//   o1.x <- <decalVertDeferred return value>.uv.x; o1.y <- <decalVertDeferred return value>.uv.y; o1.z <- <decalVertDeferred return value>.uv.z; o1.w <- <decalVertDeferred return value>.uv.w;
//   o0.x <- <decalVertDeferred return value>.pos.x; o0.y <- <decalVertDeferred return value>.pos.y; o0.z <- <decalVertDeferred return value>.pos.z; o0.w <- <decalVertDeferred return value>.pos.w
//

// 3DMigoto StereoParams:
dcl_resource_texture2d (float,float,float,float) t125

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

#line 65 "KyotoDeferredDecalInput.cginc"
mul r0.xyzw, v0.yyyy, cb1[1].xyzw
mad r0.xyzw, cb1[0].xyzw, v0.xxxx, r0.xyzw
mad r0.xyzw, cb1[2].xyzw, v0.zzzz, r0.xyzw
mad r0.xyzw, cb1[3].xyzw, v0.wwww, r0.xyzw  // r0.x <- o.pos.x; r0.y <- o.pos.y; r0.z <- o.pos.z; r0.w <- o.pos.w

#line 70
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 ec74e3ef6ecd5edc-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

mov o1.xy, v2.xyxx
mov o1.zw, l(0,0,0,0)

#line 727 "UnityCG.cginc"
mul r0.y, r0.y, cb0[5].x

#line 731
mul r1.xzw, r0.xxwy, l(0.500000, 0.000000, 0.500000, 0.500000)  // r1.x <- o.x; r1.z <- o.w

#line 70 "KyotoDeferredDecalInput.cginc"
mov o2.zw, r0.zzzw

#line 731 "UnityCG.cginc"
add o2.xy, r1.zzzz, r1.xwxx

#line 69 "KyotoDeferredDecalInput.cginc"
dp3 r0.x, cb1[13].xyzx, cb1[13].xyzx
rsq r0.x, r0.x
mul o3.xyz, r0.xxxx, cb1[13].xyzx
mov o4.xyzw, l(0,0,0,0)
ret
// Approximately 16 instruction slots used