SPIRV-Cross/reference/shaders-msl/frag/sample-mask-in-and-out.fixed-sample-mask.frag
Tomek Ponitka 18f23c47d9 Enabling setting a fixed sampleMask in Metal fragment shaders.
In Metal render pipelines don't have an option to set a sampleMask
parameter, the only way to get that functionality is to set the
sample_mask output of the fragment shader to this value directly.
We also need to take care to combine the fixed sample mask with the
one that the shader might possibly output.
2020-07-24 11:19:46 +02:00

21 lines
381 B
GLSL

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct main0_out
{
float4 FragColor [[color(0)]];
uint gl_SampleMask [[sample_mask]];
};
fragment main0_out main0(uint gl_SampleMaskIn [[sample_mask]])
{
main0_out out = {};
out.FragColor = float4(1.0);
out.gl_SampleMask = gl_SampleMaskIn;
out.gl_SampleMask &= 34;
return out;
}