// 3DMigoto: 7e721d898489269e | Matched 3 variants of 3 shaders: Hidden/Internal-Flare, Hidden/Internal-GUITexture, Hidden/Internal-Halo
//
// 1:    Unity headers extracted from Internal-Flare.shader
// 2:    Unity headers extracted from Internal-GUITexture.shader
// 4:    Unity headers extracted from Internal-Halo.shader
// 1:    Shader "Hidden/Internal-Flare" {
// 2:    Shader "Hidden/Internal-GUITexture" {
// 4:    Shader "Hidden/Internal-Halo" {
// 2:      Properties {
// 2:       _MainTex ("Texture", any) = "" { }
// 2:      }
// 2:      Fallback Off
//         SubShader 1/1 {
// 2:        Tags { "ForceSupported"="true" "RenderType"="Overlay" }
// 5:        Tags { "RenderType"="Overlay" }
//           Pass 1/1 {
// 2:          Tags { "ForceSupported"="true" "RenderType"="Overlay" }
// 5:          Tags { "RenderType"="Overlay" }
// 3:          ZTest Always
//             ZWrite Off
//             Cull Off
// 1:          Blend One One
// 4:          Blend OneMinusDstColor One
// 2:          Blend SrcAlpha OneMinusSrcAlpha
// 5:          ColorMask RGB
// 2:          GpuProgramID 1535
// 1:          GpuProgramID 29745
// 4:          GpuProgramID 61728
//             Program "vp" {
//               SubProgram "d3d11 " {
//                 GpuProgramIndex 1
//               }
//             }
//           }
//         }
//       }
//
// 1: Unity 5.3 headers extracted from Internal-Flare.shader.decompressed:
// 2: Unity 5.3 headers extracted from Internal-GUITexture.shader.decompressed:
// 4: Unity 5.3 headers extracted from Internal-Halo.shader.decompressed:
//      API d3d11
//      Shader model vs_4_0
//      undeciphered1: 201510240 5 0 0
//      undeciphered2: 1 0 2 0 0 0
//      undeciphered3: 13 3 0 0 2 1 3 4
//      ConstBuffer "$Globals" 112
// 1:   Vector 96 [_FlareTexture_ST]
// 4:   Vector 96 [_HaloFalloff_ST]
// 2:   Vector 96 [_MainTex_ST]
//      ConstBuffer "UnityPerDraw" 352
//      Matrix 0 [glstate_matrix_mvp]
//      BindCB "$Globals" 0
//      BindCB "UnityPerDraw" 1
//
// Headers extracted with DarkStarSword's extract_unity53_shaders.py
// https://raw.githubusercontent.com/DarkStarSword/3d-fixes/master/extract_unity53_shaders.py

// ---- Created with 3Dmigoto v1.2.42 on Sun Nov 06 16:57:26 2016
cbuffer cb1 : register(b1)
{
  float4 cb1[4];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[7];
}




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main( 
  float4 v0 : POSITION0,
  float4 v1 : COLOR0,
  float2 v2 : TEXCOORD0,
  out float4 o0 : SV_POSITION0,
  out float4 o1 : COLOR0,
  out float2 o2 : TEXCOORD0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = cb1[1].xyzw * v0.yyyy;
  r0.xyzw = cb1[0].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb1[2].xyzw * v0.zzzz + r0.xyzw;
  o0.xyzw = cb1[3].xyzw + r0.xyzw;
  o1.xyzw = v1.xyzw;
  o2.xy = v2.xy * cb0[6].xy + cb0[6].zw;

// This shader has the correct depth from Unity, but the driver heuristics are
// inconsistent. Apply the stereo correction, then normalise the output to W ==
// convergence to prevent the driver from adjusting it. Only normalise when the
// effect is in front of the camera and convergence is not 0 to prevent bad
// things happening.

float4 stereo = StereoParams.Load(0);
if (stereo.y && o0.w > 0) { // Only normalise in front of the camera & with stereo enabled
	o0.x += stereo.x * (o0.w - stereo.y);
	o0 = o0 / o0.w * stereo.y;
}

  return;
}
