1df47db6ba
Using the `PostDepthCoverage` mode specifies that the `gl_SampleMaskIn` variable is to contain the computed coverage mask following the early fragment tests, which this mode requires and implicitly enables. Note that unlike Vulkan and OpenGL, Metal places this on the sample mask input itself, and furthermore does *not* implicitly enable early fragment testing. If it isn't enabled explicitly with an `[[early_fragment_tests]]` attribute, the compiler will error out. So we have to enable that mode explicitly if `PostDepthCoverage` is enabled but `EarlyFragmentTests` isn't. For Metal, only iOS supports this; for some reason, Apple has yet to implement it on macOS, even though many desktop cards support it.
18 lines
338 B
GLSL
18 lines
338 B
GLSL
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
|
|
|
struct main0_out
|
|
{
|
|
float4 FragColor [[color(0)]];
|
|
};
|
|
|
|
[[ early_fragment_tests ]] fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask, post_depth_coverage]])
|
|
{
|
|
main0_out out = {};
|
|
out.FragColor = float4(float(gl_SampleMaskIn));
|
|
return out;
|
|
}
|
|
|