On 08/08/2014 12:31 AM, Kenneth Graunke wrote: > The lower_vertex_id pass converts uses of the gl_VertexID system value > to the gl_BaseVertex and gl_VertexIDMESA system values. Since > gl_VertexID is no longer accessed, it would not be considered active. > > Of course, it should be, since the shader uses gl_VertexID.
Right... hmm. Between this and your comments on patch 3, I think we're going to have some additional challenges implementing GL_ARB_shader_draw_parameters... all surrounding various abuse of gl_BaseVertex. I have a couple ideas for handling that, but I don't think it will require enough re-work to warrant delaying this code any further. Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> > Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> > --- > src/mesa/main/shader_query.cpp | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > Avoids regressing Piglit's gl-get-active-attrib-returns-all-inputs when > enabling lowering later in the series. > > diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp > index 4871d09..c395a78 100644 > --- a/src/mesa/main/shader_query.cpp > +++ b/src/mesa/main/shader_query.cpp > @@ -93,6 +93,7 @@ is_active_attrib(const ir_variable *var) > * and gl_InstanceID." > */ > return var->data.location == SYSTEM_VALUE_VERTEX_ID || > + var->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE || > var->data.location == SYSTEM_VALUE_INSTANCE_ID; > > default: > @@ -128,12 +129,22 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint > desired_index, > > foreach_in_list(ir_instruction, node, ir) { > const ir_variable *const var = node->as_variable(); > + const char *var_name = var->name; > > if (!is_active_attrib(var)) > continue; > > if (current_index == desired_index) { > - _mesa_copy_string(name, maxLength, length, var->name); > + /* Since gl_VertexID may be lowered to gl_VertexIDMESA, we need to > + * consider gl_VertexIDMESA as gl_VertexID for purposes of checking > + * active attributes. > + */ > + if (var->data.mode == ir_var_system_value && > + var->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) { > + var_name = "gl_VertexID"; > + } > + > + _mesa_copy_string(name, maxLength, length, var_name); > > if (size) > *size = (var->type->is_array()) ? var->type->length : 1; > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev