SPIRV-Cross/shaders-msl/frag/sample-position-func.frag
Chip Davis 39bc101e82 MSL: Handle the SamplePosition builtin.
This is somewhat tricky, because in MSL this value is obtained through a
function, `get_sample_position()`. Since the call expression is an
rvalue, it can't be passed by reference, so functions get a copy
instead.

This was the last piece preventing us from turning on sample-rate
shading support in MoltenVK.
2018-09-13 09:34:28 -05:00

16 lines
210 B
GLSL

#version 450
layout(location = 0) in flat int index;
layout(location = 0) out vec4 FragColor;
vec4 getColor(int i)
{
return vec4(gl_SamplePosition, i, 1.0);
}
void main()
{
FragColor = getColor(index);
}