Brak opisu
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.

DeclareDepthTexture.hlsl 934B

123456789101112131415161718192021222324252627
  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. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/DynamicScalingClamping.hlsl"
  5. TEXTURE2D_X_FLOAT(_CameraDepthTexture);
  6. float4 _CameraDepthTexture_TexelSize;
  7. // 2023.3 Deprecated. This is for backwards compatibility. Remove in the future.
  8. #define sampler_CameraDepthTexture sampler_PointClamp
  9. float SampleSceneDepth(float2 uv, SAMPLER(samplerParam))
  10. {
  11. uv = ClampAndScaleUVForBilinear(UnityStereoTransformScreenSpaceTex(uv), _CameraDepthTexture_TexelSize.xy);
  12. return SAMPLE_TEXTURE2D_X(_CameraDepthTexture, samplerParam, uv).r;
  13. }
  14. float SampleSceneDepth(float2 uv)
  15. {
  16. return SampleSceneDepth(uv, sampler_PointClamp);
  17. }
  18. float LoadSceneDepth(uint2 pixelCoords)
  19. {
  20. return LOAD_TEXTURE2D_X(_CameraDepthTexture, pixelCoords).r;
  21. }
  22. #endif