It's returning random values, because RESOURCE_VAR() is casting
different objects into ir_variable pointers.
This updates _mesa_count_active_attribs to filter the resources with the
same logic used in _mesa_longest_attribute_name_length.
https://bugs.freedesktop.org/show_bug.cgi?id=90207
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
struct gl_program_resource *res = shProg->ProgramResourceList;
unsigned count = 0;
for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) {
- if (is_active_attrib(RESOURCE_VAR(res)))
- count++;
+ if (res->Type == GL_PROGRAM_INPUT &&
+ res->StageReferences & (1 << MESA_SHADER_VERTEX) &&
+ is_active_attrib(RESOURCE_VAR(res)))
+ count++;
}
return count;
}