DeclareDepthTexture.hlsl 509 B

1234567891011121314151617
  1. #ifndef UNITY_DECLARE_DEPTH_TEXTURE_INCLUDED
  2. #define UNITY_DECLARE_DEPTH_TEXTURE_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  4. TEXTURE2D_X_FLOAT(_CameraDepthTexture);
  5. SAMPLER(sampler_CameraDepthTexture);
  6. float SampleSceneDepth(float2 uv)
  7. {
  8. return SAMPLE_TEXTURE2D_X(_CameraDepthTexture, sampler_CameraDepthTexture, UnityStereoTransformScreenSpaceTex(uv)).r;
  9. }
  10. float LoadSceneDepth(uint2 uv)
  11. {
  12. return LOAD_TEXTURE2D_X(_CameraDepthTexture, uv).r;
  13. }
  14. #endif