[Mesa-dev] gallium and GL interpolation intersection issue
airlied at gmail.com
Mon Jan 9 05:35:05 PST 2012
Okay so we have a gallium/GL/GLSL problem with interpolation, lets see
if I can describe the issue:
In the beginning there was GL interpolation rules, glShadeModel was
the only information you had.
Then came GLSL which allowed overriding the GL defaults using specifiers.
So the gl_FrontColor variant, if left unspecified would take the value
of the glShadeModel, if specified
it would over-rule the current ShadeModel setting.
So we end up something like this
if (glFrontColor attrib > 0) result = glFrontColor_attrib; else result
Now when we convert to gallium we lose the unspecified interpolation,
and we generate a default interpolation
attribute, which should usually be SMOOTH. Now we've no idea then
inside the gallium drivers whether this smooth
is due to an explicit smooth at the GLSL level which we can't
override, or whether this smooth is something that we really
wanted to be overruled by the ShadeModel bit.
Now as discussed previously most hardware has support for the
ShadeModel bit so generating multiple shaders
for the unspecified case would be suboptimal for it.
So the options I see are:
(a) do it anyways, apply the patch I had earlier that derives the
setting at the glsl->tgsi translation stage, and pretty
much ignore it.
(b) add unspecified interpolation support for Color inputs, only
colors are affected by this, and since TGSI supports
Colors we should probably support all the features of the GL Color
Anyone any other ideas?
More information about the mesa-dev