暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EdgeAdaptiveSpatialUpsampling.shader 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. Shader "Hidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling"
  2. {
  3. HLSLINCLUDE
  4. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  5. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Filtering.hlsl"
  6. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  7. #include "Packages/com.unity.render-pipelines.universal/Shaders/PostProcessing/Common.hlsl"
  8. float4 _SourceSize;
  9. #define FSR_INPUT_TEXTURE _BlitTexture
  10. #define FSR_INPUT_SAMPLER sampler_LinearClamp
  11. #include "Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/Shaders/FSRCommon.hlsl"
  12. half4 FragEASU(Varyings input) : SV_Target
  13. {
  14. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  15. float2 uv = UnityStereoTransformScreenSpaceTex(input.texcoord);
  16. uint2 integerUv = uv * _ScreenParams.xy;
  17. half3 color = ApplyEASU(integerUv);
  18. // Convert to linearly encoded color before we pass our output over to RCAS
  19. #if UNITY_COLORSPACE_GAMMA
  20. color = GetSRGBToLinear(color);
  21. #else
  22. color = Gamma20ToLinear(color);
  23. #endif
  24. #if _ENABLE_ALPHA_OUTPUT
  25. half alpha = SAMPLE_TEXTURE2D_X_LOD(FSR_INPUT_TEXTURE, FSR_INPUT_SAMPLER, uv, 0.0).a;
  26. #else
  27. half alpha = 1.0;
  28. #endif
  29. return half4(color, alpha);
  30. }
  31. ENDHLSL
  32. /// Shader that performs the EASU (upscaling) component of the two part FidelityFX Super Resolution technique
  33. /// The second part of the technique (RCAS) is handled in the FinalPost shader
  34. /// Note: This shader requires shader target 4.5 because it relies on texture gather instructions
  35. SubShader
  36. {
  37. Tags { "RenderType" = "Opaque" "RenderPipeline" = "UniversalPipeline"}
  38. LOD 100
  39. ZTest Always ZWrite Off Cull Off
  40. Pass
  41. {
  42. Name "EASU"
  43. HLSLPROGRAM
  44. #pragma vertex Vert
  45. #pragma fragment FragEASU
  46. #pragma target 4.5
  47. #pragma multi_compile_local_fragment _ _ENABLE_ALPHA_OUTPUT
  48. ENDHLSL
  49. }
  50. }
  51. Fallback Off
  52. }