// "VIVE SDK 
// © 2020 HTC Corporation. All Rights Reserved.
//
// Unless otherwise required by copyright law and practice,
// upon the execution of HTC SDK license agreement,
// HTC grants you access to and use of the VIVE SDK(s).
// You shall fully comply with all of HTC’s SDK license agreement terms and
// conditions signed by you and all SDK and API requirements,
// specifications, and documentation provided by HTC to You."

Shader "VIVE/OpenXR/CompositionLayer/UnderlayAlphaZero"
{
	Properties
	{
		_MainTex("Texture", 2D) = "white" {}
		_ColorScale("Color Scale", Color) = (1,1,1,1)
		_ColorBias("Color Bias", Color) = (0,0,0,0)
	}

	SubShader
	{
		Tags {"Queue" = "Transparent" "RenderType" = "Transparent"}
		LOD 500

		ZWrite On
		Blend Zero OneMinusSrcAlpha

		Pass
		{
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag

			#pragma multi_compile_local _ COLOR_SCALE_BIAS_ENABLED

			#include "UnityCG.cginc"

			struct appdata
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
			};

			struct v2f
			{
				float2 uv : TEXCOORD0;
				float4 vertex : SV_POSITION;
			};

			sampler2D _MainTex;
			float4 _MainTex_ST;

			fixed4 _ColorScale;
			fixed4 _ColorBias;

			v2f vert(appdata v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.uv = TRANSFORM_TEX(v.uv, _MainTex);
				return o;
			}

			fixed4 frag(v2f i) : SV_Target
			{
				fixed4 col = tex2D(_MainTex, i.uv);

#ifdef COLOR_SCALE_BIAS_ENABLED

				col *= _ColorScale.a;
				col += _ColorBias.a;

#endif

				return col;
			}
			ENDCG
		}
	}
}
