KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Apache License 2.0
4.63k stars 402 forks source link

Enforce fragment shader execution when operations with side effects are present before discard #2233

Closed aitor-lunarg closed 6 days ago

aitor-lunarg commented 1 month ago

Failing CTS tests:

dEQP-VK.fragment_operations.early_fragment.discard_no_early_fragment_tests_depth

Test has a fragment shader with side effects and a discard operation after. However, fragments get prematurely discarded under certain circumstances as an optimization (when they shouldn't).

We can circumvent this issue by making the discard operation "optional" whenever a side effect operation is present before the discard. Equivalent Metal code for the following GLSL: if (!gl_HelperInvocation) discard;

So, similar to #2232 I believe this is an oversight from Metal's end. MoltenVK should provide a short term solution for this case, and hopefully Metal fixes this issue in the long term.