Blit.shader 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. Shader "Hidden/Universal Render Pipeline/Blit"
  2. {
  3. SubShader
  4. {
  5. Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline"}
  6. LOD 100
  7. Pass
  8. {
  9. Name "Blit"
  10. ZTest Always
  11. ZWrite Off
  12. Cull Off
  13. HLSLPROGRAM
  14. // Required to compile gles 2.0 with standard srp library
  15. #pragma prefer_hlslcc gles
  16. #pragma exclude_renderers d3d11_9x
  17. #pragma vertex Vertex
  18. #pragma fragment Fragment
  19. #pragma multi_compile _ _LINEAR_TO_SRGB_CONVERSION
  20. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  21. #ifdef _LINEAR_TO_SRGB_CONVERSION
  22. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  23. #endif
  24. struct Attributes
  25. {
  26. float4 positionOS : POSITION;
  27. float2 uv : TEXCOORD0;
  28. };
  29. struct Varyings
  30. {
  31. half4 positionCS : SV_POSITION;
  32. half2 uv : TEXCOORD0;
  33. };
  34. TEXTURE2D(_BlitTex);
  35. SAMPLER(sampler_BlitTex);
  36. Varyings Vertex(Attributes input)
  37. {
  38. Varyings output;
  39. output.positionCS = TransformObjectToHClip(input.positionOS.xyz);
  40. output.uv = input.uv;
  41. return output;
  42. }
  43. half4 Fragment(Varyings input) : SV_Target
  44. {
  45. half4 col = SAMPLE_TEXTURE2D(_BlitTex, sampler_BlitTex, input.uv);
  46. #ifdef _LINEAR_TO_SRGB_CONVERSION
  47. col = LinearToSRGB(col);
  48. #endif
  49. return col;
  50. }
  51. ENDHLSL
  52. }
  53. }
  54. }