[hgiMetal] Runtime test for fragment discard return
A previous fix made sure to return from the fragment shader main
function after executing discard_fragment() in order to avoid
undesired side effects from buffer writes, e.g. when collecting
translucent fragments for Order Independent Translucent (OIT)
rendering.
This introduces a runtime check to disable this early return on
systems where it can cause other problems with performance or
functionality.
This follows the pattern used directly in the lines above
to detect and implement a similar sort of workaround for
AMD Vega GPU devices. Ideally, we'd check for something
like MTLGPUFamilyApple9 feature support or inspect the device
architecture name, but we also want to maintain build
compatibility with earlier versions of Xcode and the macOS SDK.
(Internal change:
2314233)