[Mesa-dev] [PATCH 3/8] mesa: Add interpolation override bitfields.
brianp at vmware.com
Mon Oct 24 15:58:10 PDT 2011
On 10/24/2011 03:38 PM, Paul Berry wrote:
> This patch adds the bitfields InterpOverridesFlat,
> InterpOverridesSmooth, and InterpOverridesNoperspective to
> gl_fragment_program. These bitfields keep track of which fragment
> shader inputs are overridden with the GLSL "flat", "smooth", and
> "noperspective" interpolation qualifiers.
The names of those fields seems a little confusing to me. For
example, "InterpOverridesFlat" sounds like a field that overrides flat
shading with something else.
How about just "InterpFlat", "InterpSmooth", etc?
Or, how about an enum that indicates the interpolation mode for each
fragment shader input? Something like this:
INTERP_DEFAULT, /* I _think_ we need a default mode, right? */
enum interp_mode InterpMode[FRAG_ATTRIB_MAX];
This would also prevent a non-sensical state where a particular bit is
accidentally set in more than one of the masks.
Finally, maybe use "CONSTANT", "LINEAR" and "PERSPECTIVE" instead of
"FLAT", "NO_PERSPECTIVE" and "SMOOTH". That's what we have in gallium.
> For GLSL fragment shaders, these fields are populated by the
> do_set_program_inouts() function. For non-GLSL fragment programs,
> these bitfields are zero.
> In addition, there are three new Mesa functions for determining how
> fragment shader inputs should be interpolated, taking into account the
> current shade model: _mesa_compute_frag_attribs_flat(),
> _mesa_compute_frag_attribs_smooth(), and
> _mesa_compute_frag_attribs_noperspective(). These functions are
> equivalent to ir_variable::determine_interpolation_mode(), except that
> they operate on all fragment shader inputs as a bitfield, rather than
> a single fragment shader input by itself.
More information about the mesa-dev