AVProVideo-Internal-Preview.shader 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Shader "AVProVideo/Internal/Preview"
  2. {
  3. Properties
  4. {
  5. _MainTex("Texture", any) = "" {}
  6. }
  7. SubShader
  8. {
  9. Tags { "ForceSupported" = "True" }
  10. Blend SrcAlpha OneMinusSrcAlpha
  11. Lighting Off
  12. Cull Off
  13. ZWrite Off
  14. ZTest Always
  15. Pass
  16. {
  17. Name "ALPHA BLEND"
  18. CGPROGRAM
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. #pragma target 2.0
  22. #include "UnityCG.cginc"
  23. #include "../AVProVideo.cginc"
  24. struct appdata_t {
  25. float4 vertex : POSITION;
  26. fixed4 color : COLOR;
  27. float2 texcoord : TEXCOORD0;
  28. UNITY_VERTEX_INPUT_INSTANCE_ID
  29. };
  30. struct v2f {
  31. float4 vertex : SV_POSITION;
  32. fixed4 color : COLOR;
  33. float2 texcoord : TEXCOORD0;
  34. float2 clipUV : TEXCOORD1;
  35. UNITY_VERTEX_OUTPUT_STEREO
  36. };
  37. uniform sampler2D _MainTex;
  38. uniform sampler2D _GUIClipTexture;
  39. uniform bool _ManualTex2SRGB;
  40. uniform float4 _MainTex_ST;
  41. uniform fixed4 _Color;
  42. uniform float4x4 unity_GUIClipTextureMatrix;
  43. v2f vert (appdata_t v)
  44. {
  45. v2f o;
  46. UNITY_SETUP_INSTANCE_ID(v);
  47. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  48. o.vertex = UnityObjectToClipPos(v.vertex);
  49. float3 eyePos = UnityObjectToViewPos(v.vertex);
  50. o.clipUV = mul(unity_GUIClipTextureMatrix, float4(eyePos.xy, 0, 1.0));
  51. o.color = v.color;
  52. o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
  53. return o;
  54. }
  55. fixed4 frag (v2f i) : SV_Target
  56. {
  57. fixed4 colTex = tex2D(_MainTex, i.texcoord);
  58. if (_ManualTex2SRGB)
  59. colTex.rgb = LinearToGamma(colTex.rgb);
  60. fixed4 col = colTex * i.color;
  61. col.a *= tex2D(_GUIClipTexture, i.clipUV).a;
  62. return col;
  63. }
  64. ENDCG
  65. }
  66. }
  67. Fallback off
  68. }