c7ce92a95b
Some Metal devices have a bug where `simd_is_helper_thread()` won't return true after a fragment has been discarded. We can work around this by manually setting `gl_HelperInvocation` upon discarding a fragment. This is fairly unintrusive, so it is enabled by default. I've made it an option so that, when the bug is fixed, we can disable it.
26 lines
517 B
GLSL
26 lines
517 B
GLSL
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct main0_out
|
|
{
|
|
float FragColor [[color(0)]];
|
|
};
|
|
|
|
fragment main0_out main0()
|
|
{
|
|
main0_out out = {};
|
|
bool gl_HelperInvocation = {};
|
|
gl_HelperInvocation = simd_is_helper_thread();
|
|
bool _12 = gl_HelperInvocation;
|
|
float _15 = float(_12);
|
|
out.FragColor = _15;
|
|
gl_HelperInvocation = true, discard_fragment();
|
|
bool _16 = gl_HelperInvocation;
|
|
float _17 = float(_16);
|
|
out.FragColor = _17;
|
|
return out;
|
|
}
|
|
|