No Description
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.

CoreCopy.shader 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Shader "Hidden/CoreSRP/CoreCopy"
  2. {
  3. SubShader
  4. {
  5. Tags { "RenderType" = "Opaque" }
  6. ZClip Off
  7. ZTest Off
  8. ZWrite Off Cull Off
  9. Pass
  10. {
  11. Name "Copy"
  12. HLSLPROGRAM
  13. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  14. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
  15. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureXR.hlsl"
  16. #include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
  17. #pragma vertex Vert
  18. #pragma fragment CopyFrag
  19. // Declares the framebuffer input as a texture 2d containing half.
  20. FRAMEBUFFER_INPUT_FLOAT(0);
  21. // Out frag function takes as input a struct that contains the screen space coordinate we are going to use to sample our texture. It also writes to SV_Target0, this has to match the index set in the UseTextureFragment(sourceTexture, 0, …) we defined in our render pass script.
  22. float4 CopyFrag(Varyings input) : SV_Target0
  23. {
  24. // read the current pixel from the framebuffer
  25. float2 uv = input.texcoord.xy;
  26. // read previous subpasses directly from the framebuffer.
  27. half4 color = LOAD_FRAMEBUFFER_INPUT(0, input.positionCS.xy);
  28. // Modify the sampled color
  29. return color;
  30. }
  31. ENDHLSL
  32. }
  33. Tags { "RenderType" = "Opaque" }
  34. ZClip Off
  35. ZTest Off
  36. ZWrite Off Cull Off
  37. Pass
  38. {
  39. Name "CopyMS"
  40. HLSLPROGRAM
  41. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  42. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl"
  43. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/TextureXR.hlsl"
  44. #include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
  45. #pragma vertex Vert
  46. #pragma fragment CopyFragMS
  47. #pragma target 4.5
  48. #pragma require msaatex
  49. // Declares the framebuffer input as a texture 2d containing half.
  50. FRAMEBUFFER_INPUT_FLOAT_MS(0);
  51. // Out frag function takes as input a struct that contains the screen space coordinate we are going to use to sample our texture. It also writes to SV_Target0, this has to match the index set in the UseTextureFragment(sourceTexture, 0, …) we defined in our render pass script.
  52. float4 CopyFragMS(Varyings input, uint sampleID : SV_SampleIndex) : SV_Target0
  53. {
  54. // read the current pixel from the framebuffer
  55. float2 uv = input.texcoord.xy;
  56. // read previous subpasses directly from the framebuffer.
  57. half4 color = LOAD_FRAMEBUFFER_INPUT_MS(0, sampleID, input.positionCS.xy);
  58. // Modify the sampled color
  59. return color;
  60. }
  61. ENDHLSL
  62. }
  63. }
  64. }