[Mesa-dev] Per-sample shading and its effect on interpolation
Ilia Mirkin
imirkin at alum.mit.edu
Mon Jul 7 22:04:49 PDT 2014
Hello,
I've discussed this with Chris a bunch, but wanted to also get other
people's take on this.
The way I interpret things is that when ARB_sample_shading's
provisions are met, it's as if each fragment input were to have been
declared with a 'sample' attribute in an ARB_gpu_shader5 world. This
seems fairly straightforward -- all varyings are interpolated at the
sample location.
However what happens if you declare one varying with 'sample', another
with 'centroid', and another "plain". Having any sample varyings
forces everything into per-sample mode, but should the other varyings
be interpolated at the sample location, or at the centroid/pixel
center? And what happens to interpolateAtCentroid()?
>From ARB_gs5:
If MULTISAMPLE is enabled and the current program object includes a
fragment shader with one or more input variables qualified with "sample
in", the data associated with those variables will be assigned
independently. The values for each sample must be evaluated at the
location of the sample. The data associated with any other variables not
qualified with "sample in" need not be evaluated independently for each
sample.
When I was doing my implementation for nvc0, I went out of my way to
interpolate at the "correct" locations. Should I dump that and just
interpolate "centroid" the same way as "sample" even when per-sample
shading? I just looked at some traces from NVIDIA blob driver, and
that's what it seems to do.
Thanks,
-ilia
More information about the mesa-dev
mailing list