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
1.96k stars 549 forks source link

MSL: Add option to force depth write in fragment shaders #2331

Closed aitor-lunarg closed 1 month ago

aitor-lunarg commented 1 month ago

Metal writes to the depth/stencil attachment before fragment shader execution if the execution does not modify the depth value. However, Vulkan expects the write to happen after fragment shader execution. To circumvent the issue we add a simple depth passthrough if the user opts in. Only required when the depth/stencil attachment is used as input attachment at the same time. It seems Metal does not correctly detect the dependency.

Required for https://github.com/KhronosGroup/MoltenVK/issues/2232