Search Unity

Performance question regarding sampling the depth texture vs tex2d

Discussion in 'General Graphics' started by o1o101, Aug 23, 2020.

  1. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hi guys,

    If a scene depth texture is already being generated, is sampling that depth texture in a shader any more expensive relative to sampling a regular texture 2d?

    If so, why and how significant is the difference?

    Platform - mid range iOS/Android
    URP

    Thanks in advance!
     
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    It depend on the hardware, and the pipeline implementation, so there is no straight answer. Some tile based GPU on mobile generally don't like sampling the depth, some like the new mali GPU have pixel storage cache: https://community.arm.com/developer...og/posts/pixel-local-storage-on-arm-mali-gpus But the pipelines implementation have to take advantage of that by not flushing the memory between pass. SO it's not a straightforward question.