// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors 2a955e4c6fb7d151-vs_replace.txt
// 3DMigoto: 2a955e4c6fb7d151 | Matched 62 variants of 6 shaders: PlayWay Water/Depth/Water Depth, PlayWay Water/Standard, PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS _VOLUMETRIC_LIGHTING _WATER_FOAM_WS _WATER_REFRACTION _WAVES_FFT, PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS _VOLUMETRIC_LIGHTING _WATER_REFRACTION _WAVES_FFT, PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS_HQ _VOLUMETRIC_LIGHTING _WATER_FOAM_WS _WATER_REFRACTION _WAVES_FFT, PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS_HQ _VOLUMETRIC_LIGHTING _WATER_REFRACTION _WAVES_FFT
//
// 3fffffffc0000000:    Unity headers extracted from Depth.shader
// 000000000000003f:    Unity headers extracted from PlayWay Water Variation #-16807626.shader
// 0000000000000fc0:    Unity headers extracted from PlayWay Water Variation #-1747073184.shader
// 000000000003f000:    Unity headers extracted from PlayWay Water Variation #1252587827.shader
// 0000000000fc0000:    Unity headers extracted from PlayWay Water Variation #2084531273.shader
// 000000003f000000:    Unity headers extracted from PlayWay Water.shader
// 3fffffffc0000000:    Shader "PlayWay Water/Depth/Water Depth" {
// 000000003f000000:    Shader "PlayWay Water/Standard" {
// 0000000000000fc0:    Shader "PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS _VOLUMETRIC_LIGHTING _WATER_FOAM_WS _WATER_REFRACTION _WAVES_FFT" {
// 0000000000fc0000:    Shader "PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS _VOLUMETRIC_LIGHTING _WATER_REFRACTION _WAVES_FFT" {
// 000000000000003f:    Shader "PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS_HQ _VOLUMETRIC_LIGHTING _WATER_FOAM_WS _WATER_REFRACTION _WAVES_FFT" {
// 000000000003f000:    Shader "PlayWay Water/Variations/Water _ALPHABLEND_ON _CUBEMAP_REFLECTIONS _INCLUDE_SLOPE_VARIANCE _NORMALMAP _PLANAR_REFLECTIONS_HQ _VOLUMETRIC_LIGHTING _WATER_REFRACTION _WAVES_FFT" {
//                        Properties {
// 000000003fffffff:       _Color ("Color", Color) = (1,1,1,1)
// 000000003fffffff:       _MainTex ("Albedo", 2D) = "white" { }
// 000000003fffffff:       _DepthColor ("Depth Color", Color) = (0,0.012,0.05,1)
// 000000003fffffff:       _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.5
// 000000003fffffff:       _Glossiness ("Smoothness", Range(0,1)) = 0.5
// 000000003fffffff:       _SpecColor ("Specular", Color) = (0.2,0.2,0.2,1)
// 000000003fffffff:       _BumpScale ("Bump Scale", Vector) = (1,1,0,0)
// 000000003fffffff:       _BumpMap ("Normal Map", 2D) = "bump" { }
// 000000003fffffff:       _DisplacementNormalsIntensity ("Displacement Normals Intensity", Float) = 1.4
// 000000003fffffff:       _GlobalNormalMap ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalNormalMap1 ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalNormalMap2 ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalNormalMap3 ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalDisplacementMap ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalDisplacementMap1 ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalDisplacementMap2 ("", 2D) = "black" { }
// 000000003fffffff:       _GlobalDisplacementMap3 ("", 2D) = "black" { }
// 000000003fffffff:       _DisplacementsScale ("Horizontal Displacement Scale", Float) = 1
// 000000003fffffff:       _OcclusionStrength ("Strength", Range(0,1)) = 1
// 000000003fffffff:       _OcclusionMap ("Occlusion", 2D) = "white" { }
// 000000003fffffff:       _EmissionColor ("Color", Color) = (0,0,0,1)
// 000000003fffffff:       _EmissionMap ("Emission", 2D) = "white" { }
//                         _SubtractiveMask ("", 2D) = "black" { }
//                         _AdditiveMask ("", 2D) = "black" { }
// 000000003fffffff:       _DetailAlbedoMap ("Detail Albedo x2", 2D) = "grey" { }
// 000000003fffffff:       _DetailNormalMapScale ("Scale", Float) = 1
// 000000003fffffff:       _DetailNormalMap ("Normal Map", 2D) = "bump" { }
// 000000003fffffff:       _DetailFadeFactor ("", Float) = 2
// 000000003fffffff:       _PlanarReflectionTex ("Planar Reflection", 2D) = "black" { }
// 000000003fffffff:       _PlanarReflectionPack ("Planar reflection (distortion, intensity, offset Y, unused)", Vector) = (1,0.45,-0.3,0)
// 000000003fffffff:       _LightSmoothnessMul ("Light Smoothness Multiplier", Float) = 1
// 000000003fffffff:       _WrapSubsurfaceScatteringPack ("Wrap SSS", Vector) = (0.2,0.833333,0.5,0.66666)
// 000000003fffffff:       _SpecularFresnelBias ("Specular Fresnel Bias", Float) = 0.02041
// 000000003fffffff:       _RefractionDistortion ("Refraction Distortion", Float) = 0.55
// 000000003fffffff:       _RefractionMaxDepth ("Refraction Max Depth", Float) = -1
// 3fffffffc0000000:       _DisplacedHeightMaps ("", 2D) = "black" { }
// 000000003fffffff:       _WaterTileSize ("Heightmap Tile Size", Vector) = (180,18,600,1800)
// 000000003fffffff:       _WaterTileOffsets ("Tile Offsets", Vector) = (0,0,0,0)
// 3fffffffc0000000:       _WaterTileSize ("Heightmap Tile Size", Vector) = (180,18,600,1800)
// 3fffffffc0000000:       _SurfaceOffset ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _WaterTileSizeScales ("", Vector) = (0.63241,0.113151,3.16513,10.2651)
// 000000003fffffff:       _Foam ("Foam (intensity, cutoff)", Vector) = (0.1,0.375,0,0)
// 000000003fffffff:       _FoamTex ("Foam texture ", 2D) = "black" { }
// 000000003fffffff:       _FoamNormalMap ("Foam Normal Map", 2D) = "bump" { }
// 000000003fffffff:       _FoamNormalScale ("Foam Normal Scale", Float) = 2.2
// 000000003fffffff:       _FoamTiling ("Foam Tiling", Vector) = (5.4,5.4,1,1)
// 000000003fffffff:       _FoamSpecularColor ("Foam Specular Color", Color) = (1,1,1,1)
// 000000003fffffff:       _EdgeBlendFactorInv ("Edge Blend Factor", Float) = 0.3333
// 000000003fffffff:       _FoamMapWS ("", 2D) = "black" { }
// 000000003fffffff:       _AbsorptionColor ("", Color) = (0.35,0.04,0.001,1)
// 000000003fffffff:       _ReflectionColor ("", Color) = (1,1,1,1)
// 000000003fffffff:       _LocalDisplacementMap ("", 2D) = "black" { }
// 000000003fffffff:       _LocalSlopeMap ("", 2D) = "black" { }
// 000000003fffffff:       _DisplacedHeightMaps ("", 2D) = "black" { }
// 000000003fffffff:       _SubsurfaceScatteringPack ("Subsurface Scattering", Vector) = (1,0.15,1.65,0)
// 000000003fffffff:       _SlopeVariance ("", 3D) = "black" { }
// 000000003fffffff:       _TesselationFactor ("Tesselation Factor", Float) = 14
// 000000003fffffff:       _MaxDisplacement ("", Float) = 10
// 000000003fffffff:       _SurfaceOffset ("", Vector) = (0,0,0,1)
//                         _WaterId ("", Vector) = (128,256,0,0)
// 000000003fffffff:       _WaterStencilId ("", Float) = 0
// 000000003fffffff:       _WaterStencilIdInv ("", Float) = 0
// 000000003fffffff:       _GerstnerOrigin ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAmp0 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrOff0 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrFrq0 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAB0 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrCD0 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAmp1 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrOff1 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrFrq1 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAB1 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrCD1 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAmp2 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrOff2 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrFrq2 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAB2 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrCD2 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAmp3 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrOff3 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrFrq3 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAB3 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrCD3 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAmp4 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrOff4 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrFrq4 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrAB4 ("", Vector) = (0,0,0,0)
// 000000003fffffff:       _GrCD4 ("", Vector) = (0,0,0,0)
// 000000003fffffff:      [HideInInspector]  _Cull ("_Cull", Float) = 2
// 000000003fffffff:      [HideInInspector]  _Mode ("__mode", Float) = 0
// 000000003fffffff:      [HideInInspector]  _SrcBlend ("__src", Float) = 1
// 000000003fffffff:      [HideInInspector]  _DstBlend ("__dst", Float) = 0
//                        }
// 000000003fffffff:      SubShader 1/3 {
// 3fffffffc0000000:      SubShader 1/5 {
// 000000003fffffff:        LOD 300
// 3fffffffc0000000:        Tags { "CustomType"="Water" }
// 3fffffffc0000000:        Pass 1/1 {
// 000000003fffffff:        Tags { "QUEUE"="Transparent-1" "RenderType"="Opaque" "PerformanceChecks"="False" "CustomType"="Water" }
// 3fffffffc0000000:          Tags { "CustomType"="Water" }
// 000000003fffffff:        GrabPass {
// 000000003fffffff:          "_RefractionTex"
// 3fffffffc0000000:          ZTest Always
// 3fffffffc0000000:          Cull Off
// 000000003fffffff:         }
// 3fffffffc0000000:          GpuProgramID 39528
// 000000000f3cf3cf:        Pass 1/4 {
// 0000000030c30c30:        Pass 2/4 {
// 000000000f3cf3cf:          Name "FORWARD"
// 0000000030c30c30:          Name "FORWARD_DELTA"
// 0000000030c30c30:          Tags { "LIGHTMODE"="ForwardAdd" "QUEUE"="Transparent-1" "RenderType"="Opaque" "PerformanceChecks"="False" "CustomType"="Water" }
// 000000000f3cf3cf:          Tags { "LIGHTMODE"="ForwardBase" "QUEUE"="Transparent-1" "RenderType"="Opaque" "PerformanceChecks"="False" "CustomType"="Water" }
// 000000000f3cf3cf:          ZTest Less
// 0000000030c30c30:          ZWrite Off
// 000000003fffffff:          Cull [_Cull]
// 0000000030c30c30:          Blend [_SrcBlend] One
// 000000000f3cf3cf:          Blend [_SrcBlend] [_DstBlend]
// 0000000000000c00:          GpuProgramID 109139
// 0000000030000000:          GpuProgramID 115066
// 0000000000000030:          GpuProgramID 122618
// 000000000000f000:          GpuProgramID 12869
// 0000000000c00000:          GpuProgramID 130912
// 000000000f000000:          GpuProgramID 26561
// 000000000000000f:          GpuProgramID 29814
// 00000000003c0000:          GpuProgramID 37684
// 00000000000003c0:          GpuProgramID 48893
// 0000000000030000:          GpuProgramID 70875
//                            Program "vp" {
//                              SubProgram "d3d11 " {
// 0000000041041041:              GpuProgramIndex 0
// 0000000082082082:              GpuProgramIndex 1
// 0000010000000000:              GpuProgramIndex 10
// 0000020010410410:              GpuProgramIndex 11
// 0000040000000000:              GpuProgramIndex 12
// 0000080000000000:              GpuProgramIndex 13
// 0000100000000000:              GpuProgramIndex 14
// 0000200000000000:              GpuProgramIndex 15
// 0000400020820820:              GpuProgramIndex 16
// 0000800000000000:              GpuProgramIndex 17
// 0001000000000000:              GpuProgramIndex 18
// 0002000000000000:              GpuProgramIndex 19
// 0000000104104104:              GpuProgramIndex 2
// 0004000000000000:              GpuProgramIndex 20
// 0008000000000000:              GpuProgramIndex 21
// 0010000000000000:              GpuProgramIndex 22
// 0020000000000000:              GpuProgramIndex 23
// 0040000000000000:              GpuProgramIndex 24
// 0080000000000000:              GpuProgramIndex 25
// 0100000000000000:              GpuProgramIndex 26
// 0200000000000000:              GpuProgramIndex 27
// 0400000000000000:              GpuProgramIndex 28
// 0800000000000000:              GpuProgramIndex 29
// 0000000208208208:              GpuProgramIndex 3
// 1000000000000000:              GpuProgramIndex 30
// 2000000000000000:              GpuProgramIndex 31
// 0000000400000000:              GpuProgramIndex 4
// 0000000800000000:              GpuProgramIndex 5
// 0000001000000000:              GpuProgramIndex 6
// 0000002000000000:              GpuProgramIndex 7
// 0000004000000000:              GpuProgramIndex 8
// 0000008000000000:              GpuProgramIndex 9
//                              }
//                            }
//                          }
//                        }
//                      }
//
// 3fffffffc0000000: Unity 5.3 headers extracted from Depth.shader.decompressed:
// 000000000000003f: Unity 5.3 headers extracted from PlayWay Water Variation #-16807626.shader.decompressed:
// 0000000000000fc0: Unity 5.3 headers extracted from PlayWay Water Variation #-1747073184.shader.decompressed:
// 000000000003f000: Unity 5.3 headers extracted from PlayWay Water Variation #1252587827.shader.decompressed:
// 0000000000fc0000: Unity 5.3 headers extracted from PlayWay Water Variation #2084531273.shader.decompressed:
// 000000003f000000: Unity 5.3 headers extracted from PlayWay Water.shader.decompressed:
//                     API d3d11
//                     Shader model vs_5_0
//                     undeciphered1: 201509030 14 0 0
// 0000000008000000:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "VERTEXLIGHT_ON" "_WATER_BACK" }
// 0000000002000000:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "VERTEXLIGHT_ON" "_WATER_FRONT" }
// 0000000000208208:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "VERTEXLIGHT_ON" "_WAVES_FFT" "_WATER_BACK" }
// 0000000000082082:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "VERTEXLIGHT_ON" "_WAVES_FFT" "_WATER_FRONT" }
// 0000000004000000:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "_WATER_BACK" }
// 0000000001000000:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "_WATER_FRONT" }
// 0000000000104104:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "_WAVES_FFT" "_WATER_BACK" }
// 0000000000041041:   Keywords { "DIRECTIONAL" "SHADOWS_OFF" "LIGHTMAP_OFF" "DIRLIGHTMAP_OFF" "DYNAMICLIGHTMAP_OFF" "_WAVES_FFT" "_WATER_FRONT" }
// 0000000020000000:   Keywords { "DIRECTIONAL" "_WATER_BACK" }
// 0000000010000000:   Keywords { "DIRECTIONAL" "_WATER_FRONT" }
// 0000000000820820:   Keywords { "DIRECTIONAL" "_WAVES_FFT" "_WATER_BACK" }
// 0000000000410410:   Keywords { "DIRECTIONAL" "_WAVES_FFT" "_WATER_FRONT" }
// 0000000400000000:   Keywords { "_BOUNDED_WATER" }
// 0000000800000000:   Keywords { "_TRIANGLES" "_BOUNDED_WATER" }
// 0000002000000000:   Keywords { "_TRIANGLES" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0000000200000000:   Keywords { "_TRIANGLES" "_WAVES_ALIGN" }
// 0000000080000000:   Keywords { "_TRIANGLES" }
// 0000001000000000:   Keywords { "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0000000100000000:   Keywords { "_WAVES_ALIGN" }
// 0004000000000000:   Keywords { "_WAVES_FFT" "_BOUNDED_WATER" }
// 0008000000000000:   Keywords { "_WAVES_FFT" "_TRIANGLES" "_BOUNDED_WATER" }
// 0020000000000000:   Keywords { "_WAVES_FFT" "_TRIANGLES" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0002000000000000:   Keywords { "_WAVES_FFT" "_TRIANGLES" "_WAVES_ALIGN" }
// 0000800000000000:   Keywords { "_WAVES_FFT" "_TRIANGLES" }
// 0010000000000000:   Keywords { "_WAVES_FFT" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0001000000000000:   Keywords { "_WAVES_FFT" "_WAVES_ALIGN" }
// 0400000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_BOUNDED_WATER" }
// 0800000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_TRIANGLES" "_BOUNDED_WATER" }
// 2000000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_TRIANGLES" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0200000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_TRIANGLES" "_WAVES_ALIGN" }
// 0080000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_TRIANGLES" }
// 1000000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0100000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" "_WAVES_ALIGN" }
// 0040000000000000:   Keywords { "_WAVES_FFT" "_WAVES_GERSTNER" }
// 0000400000000000:   Keywords { "_WAVES_FFT" }
// 0000040000000000:   Keywords { "_WAVES_GERSTNER" "_BOUNDED_WATER" }
// 0000080000000000:   Keywords { "_WAVES_GERSTNER" "_TRIANGLES" "_BOUNDED_WATER" }
// 0000200000000000:   Keywords { "_WAVES_GERSTNER" "_TRIANGLES" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0000020000000000:   Keywords { "_WAVES_GERSTNER" "_TRIANGLES" "_WAVES_ALIGN" }
// 0000008000000000:   Keywords { "_WAVES_GERSTNER" "_TRIANGLES" }
// 0000100000000000:   Keywords { "_WAVES_GERSTNER" "_WAVES_ALIGN" "_BOUNDED_WATER" }
// 0000010000000000:   Keywords { "_WAVES_GERSTNER" "_WAVES_ALIGN" }
// 0000004000000000:   Keywords { "_WAVES_GERSTNER" }
//                     undeciphered2: 1 0 3 0 0
//                     undeciphered3: 3 2 0 0 1 2
//                     ConstBuffer "$Globals" 1312
//                     Float 1296 [_TesselationFactor]
//                     ConstBuffer "UnityPerCamera" 144
//                     Vector 64 [_WorldSpaceCameraPos] 3
//                     Vector 80 [_ProjectionParams]
//                     ConstBuffer "UnityPerDraw" 352
//                     Matrix 192 [_Object2World]
//                     BindCB "$Globals" 0
//                     BindCB "UnityPerCamera" 1
//                     BindCB "UnityPerDraw" 2
//
// 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.38 on Thu Feb 09 12:25:50 2017
cbuffer cb2 : register(b2)
{
  float4 cb2[16];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[9];
}

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




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



cbuffer UnityPerDraw : register(b11) {
	float4x4 glstate_matrix_mvp;
	float4x4 glstate_matrix_modelview0;
	float4x4 glstate_matrix_invtrans_modelview0;
	#define UNITY_MATRIX_MVP glstate_matrix_mvp
	#define UNITY_MATRIX_MV glstate_matrix_modelview0
	#define UNITY_MATRIX_IT_MV glstate_matrix_invtrans_modelview0

	uniform float4x4 _Object2World;
	uniform float4x4 _World2Object;
	uniform float4 unity_LODFade; // x is the fade value ranging within [0,1]. y is x quantized into 16 levels
	uniform float4 unity_WorldTransformParams; // w is usually 1.0, or -1.0 for odd-negative scale transforms
}


#include <matrix.hlsl>

void main( 
  float4 v0 : POSITION0,
  float3 v1 : NORMAL0,
  out float4 o0 : INTERNALTESSPOS0,
  out float o1 : TEXCOORD0,
  out float3 p1 : NORMAL0)
{
  float4 r0;
  uint4 bitmask, uiDest;
  float4 fDest;

float4 stereo = StereoParams.Load(0);
float separation = stereo.x, convergence = stereo.y, eye = stereo.z;

// Unity reflection/specular fix inserted with DarkStarSword's hlsltool.py:
// hlsltool.py -I ../112 --auto-fix-vertex-halo --fix-unity-reflection --only-autofixed --no-validate --ignore-other-errors 2a955e4c6fb7d151-vs_replace.txt
float4 _WorldSpaceCameraPos = cb1[4];
float4 clip_space_adj = float4(-separation * convergence, 0, 0, 0);
float4 local_space_adj = mul(inverse(glstate_matrix_mvp), clip_space_adj);
float4 world_space_adj = mul(_Object2World, local_space_adj);
_WorldSpaceCameraPos.xyz -= world_space_adj.xyz;

  r0.xyzw = cb2[13].xyzw * v0.yyyy;
  r0.xyzw = cb2[12].xyzw * v0.xxxx + r0.xyzw;
  r0.xyzw = cb2[14].xyzw * v0.zzzz + r0.xyzw;
  r0.xyzw = cb2[15].xyzw * v0.wwww + r0.xyzw;
  o0.xyzw = r0.xyzw;
  r0.xyz = -_WorldSpaceCameraPos.xyz + r0.xyz;
  r0.x = dot(r0.xyz, r0.xyz);
  r0.x = sqrt(r0.x);
  r0.x = -cb1[5].y + r0.x;
  r0.y = cb1[5].z + -cb1[5].y;
  r0.x = r0.x / r0.y;
  r0.x = 1 + -r0.x;
  r0.x = max(0.00999999978, r0.x);
  r0.x = min(1, r0.x);
  o1.x = cb0[81].x * r0.x;
  p1.xyz = v1.xyz;
  return;
}
