KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
2.09k stars 569 forks source link

depth buffer fetch extension support in metal #1865

Open Starrring opened 2 years ago

Starrring commented 2 years ago

Is there anyway to access depth like ARM_shader_framebuffer_fetch_depth_stencil in IOS Platform? It seems that my question is similar with an existed issue(https://github.com/KhronosGroup/SPIRV-Cross/pull/1689) But it seems that the compiler must generate 2 overloads, is there anyway to mark if an input_attachment_location is depth or not now?

HansKristian-Work commented 2 years ago

Don't think Metal supports depth-stencil fetch at all.

cdavis5e commented 2 years ago

Yeah, it doesn't. Would you like me to ask Apple for it?

HansKristian-Work commented 2 years ago

Yeah, it doesn't. Would you like me to ask Apple for it?

I don't particularly care, depends on what MoltenVK developers want I guess.

Kinda surprised Metal doesn't support it though. It means deferred shading is broken by design.

Starrring commented 2 years ago

Yeah, it doesn't. Would you like me to ask Apple for it?

Hi,

It seems that Metal don't supports depth-stencil fetch. But if you have the oppotunity to ask Apple, maybe the same answer can make me give up completely.Appreciate for your and HansKristian's help!

TellowKrinkle commented 1 year ago

It's a hardware restriction. https://developer.apple.com/videos/play/wwdc2020-10632/?time=1553 "One important detail to highlight is that the tile memory stores color and depth attachments separately, so the depth is not directly accessible to a fragment shader. To work around this limitation, you can maintain the current fragment's depth in a dedicated color attachment to keep it available to all your fragment shaders."