[Mesa-dev] [PATCH 3/5] glsl: Mark gl_ViewportIndex and gl_Layer varyings as flat.
Kenneth Graunke
kenneth at whitecape.org
Mon Oct 26 17:29:02 PDT 2015
On Monday, October 26, 2015 05:02:07 PM Ian Romanick wrote:
> On 10/26/2015 11:03 AM, Kenneth Graunke wrote:
> > Integer varyings need to be flat qualified - all others were already.
> > I think we just missed this. Presumably some hardware passes this via
> > sideband and ignores attribute interpolation, so no one has noticed.
> >
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> > Cc: Chris Forbes <chrisf at ijw.co.nz>
> > ---
> > src/glsl/builtin_variables.cpp | 39 ++++++++++++++++++++++++++-------------
> > 1 file changed, 26 insertions(+), 13 deletions(-)
> >
> > diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp
> > index a6ad105..07aacd4 100644
> > --- a/src/glsl/builtin_variables.cpp
> > +++ b/src/glsl/builtin_variables.cpp
> > @@ -887,16 +887,22 @@ builtin_variable_generator::generate_uniforms()
> > void
> > builtin_variable_generator::generate_vs_special_vars()
> > {
> > + ir_variable *var;
> > +
> > if (state->is_version(130, 300))
> > add_system_value(SYSTEM_VALUE_VERTEX_ID, int_t, "gl_VertexID");
> > if (state->ARB_draw_instanced_enable)
> > add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t, "gl_InstanceIDARB");
> > if (state->ARB_draw_instanced_enable || state->is_version(140, 300))
> > add_system_value(SYSTEM_VALUE_INSTANCE_ID, int_t, "gl_InstanceID");
> > - if (state->AMD_vertex_shader_layer_enable)
> > - add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
> > - if (state->AMD_vertex_shader_viewport_index_enable)
> > - add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
> > + if (state->AMD_vertex_shader_layer_enable) {
> > + var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
> > + var->data.interpolation = INTERP_QUALIFIER_FLAT;
> > + }
> > + if (state->AMD_vertex_shader_viewport_index_enable) {
> > + var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
> > + var->data.interpolation = INTERP_QUALIFIER_FLAT;
> > + }
> > if (compatibility) {
> > add_input(VERT_ATTRIB_POS, vec4_t, "gl_Vertex");
> > add_input(VERT_ATTRIB_NORMAL, vec3_t, "gl_Normal");
> > @@ -954,11 +960,16 @@ builtin_variable_generator::generate_tes_special_vars()
> > void
> > builtin_variable_generator::generate_gs_special_vars()
> > {
> > - add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
> > - if (state->is_version(410, 0) || state->ARB_viewport_array_enable)
> > - add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
> > + ir_variable *var;
> > +
> > + var = add_output(VARYING_SLOT_LAYER, int_t, "gl_Layer");
> > + var->data.interpolation = INTERP_QUALIFIER_FLAT;
> > + if (state->is_version(410, 0) || state->ARB_viewport_array_enable) {
> > + var = add_output(VARYING_SLOT_VIEWPORT, int_t, "gl_ViewportIndex");
> > + var->data.interpolation = INTERP_QUALIFIER_FLAT;
> > + }
> > if (state->is_version(400, 0) || state->ARB_gpu_shader5_enable)
> > - add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID");
> > + var = add_system_value(SYSTEM_VALUE_INVOCATION_ID, int_t, "gl_InvocationID");
>
> Shouldn't this set var->data.interpolation? It looks like you only made
> half the change.
I actually meant to leave that alone, as I don't think it makes sense to
set interpolation modes on system values (they aren't varyings!). Good
catch, though, I got a bit overzealous in my "var" adding :)
I've dropped that one line of diff locally. Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151026/8b9785ea/attachment.sig>
More information about the mesa-dev
mailing list