View Full Version : Behavior of gl_SampleMaskIn for per-sample shading across vendors

05-06-2016, 04:48 PM
Short and sweet (since I'm not sure who might see this...)

I believe I've found a variance across Intel, AMD, and Nvidia drivers regarding gl_SampleMaskIn and it's behavior when performing sample-rate shading (when enabling GL_SAMPLE_SHADING.) Nvidia appears to only set the single corresponding bit to the current sample (gl_SampleMaskIn[0] == (1<<gl_SampleID)) and Intel and AMD leave gl_SampleMaskIn set according to the coverage of the input primitive.

The spec seems a little unclear here:
"When per-sample shading is active due to the use of a fragment input qualified by
sample or due to the use of the gl_SampleID or gl_SamplePosition variables, only the
bit for the current sample is set in gl_SampleMaskIn. When state specifies multiple fragment
shader invocations for a given fragment, the sample mask for any single fragment
shader invocation may specify a subset of the covered samples for the fragment. In
this case, the bit corresponding to each covered sample will be set in exactly one
fragment shader invocation."

...so I'm not sure whose interpretation is correct.

Happy to hear thoughts on this.

[I don't have exact driver revs handy but I'm using relatively recent (late 2015 / early 2016) hardware and drivers.]