Sample a texture when drawing a point primitive

For some reason could not find information about this on google. In OpenGL, I know I can sample a texture when drawing a GL_POINT by using gl_PointCoord. I would like to know if there is an equivalent in metal (some way to get the texture coordinates at the shader when drawing a point primitive).

Replies

Something like:

fragment float4 fragment_func(texture2d<half> colorTexture [[texture(0)]],
                              float2 pointCoord [[point_coord]]) {
  constexpr sampler textureSampler (mag_filter::linear,
                                    min_filter::linear);
  const half4 colorSampler = colorTexture.sample(textureSampler, pointCoord);
  return float4(colorSampler);
}