How to access current depth buffer value

On a platform that supports GL_ARM_shader_framebuffer_fetch_depth_stencil
when writing shaders in HLSL, how can I access the previous fragment depth in the fragment shader?

We don’t support this ARM extension, AFAIK. Only GL_EXT_shader_framebuffer_fetch.

So it’s impossible with Unity?

It’s impossible with Unity in HLSL.
You can write a GLSL shader.
Keep in mind that this extension is not supported on GPUs from other vendors (so only devices with ARM Mali GPUs will be able to use this shader).

No that’s not true. Modern Adrenos (in particular Oculus Quest 2) supports it - Adreno’s are pretty much one of the most important mobile gpus currently - so would be great if Unity could add support for this feature :slight_smile:

Any luck with this. Was the arm call fast enough.
This article suggest that the extensions might be slow.

Nevermind, he references that exact extension if you open the link.

Are there any examples of how to do this stuff in Unity? Writing a simple GLSL shader that uses a vulkan extension like ARM_shader_framebuffer_fetch_depth_stencil posted above? Searching around but haven’t found anything yet.

The information’s… scarce :slight_smile:

Hm that’s probably enough to go on, but it would be nice if that page had a simple full shader.