The later takes a type parameter so we can match uniforms or attributes/inputs.
Used by the GL_ACTIVE_ATTRIBUTE_MAX_LENGTH and GL_ACTIVE_UNIFORM_MAX_LENGTH
queries. Fixes problem reported by Brad King in VTK.
/**
- * Find longest name of any parameter in list.
+ * Find longest name of all uniform parameters in list.
*/
GLuint
-_mesa_parameter_longest_name(const struct gl_program_parameter_list *list)
+_mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
+ enum register_file type)
{
GLuint i, maxLen = 0;
if (!list)
return 0;
for (i = 0; i < list->NumParameters; i++) {
- GLuint len = _mesa_strlen(list->Parameters[i].Name);
- if (len > maxLen)
- maxLen = len;
+ if (list->Parameters[i].Type == type) {
+ GLuint len = _mesa_strlen(list->Parameters[i].Name);
+ if (len > maxLen)
+ maxLen = len;
+ }
}
return maxLen;
}
GLint *posOut, GLuint *swizzleOut);
extern GLuint
-_mesa_parameter_longest_name(const struct gl_program_parameter_list *list);
+_mesa_longest_parameter_name(const struct gl_program_parameter_list *list,
+ enum register_file type);
+
#endif /* PROG_PARAMETER_H */
*params = shProg->Attributes ? shProg->Attributes->NumParameters : 0;
break;
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
- *params = _mesa_parameter_longest_name(shProg->Attributes);
+ *params = _mesa_longest_parameter_name(shProg->Attributes, PROGRAM_INPUT);
break;
case GL_ACTIVE_UNIFORMS:
*params = shProg->Uniforms ? shProg->Uniforms->NumParameters : 0;
break;
case GL_ACTIVE_UNIFORM_MAX_LENGTH:
- *params = _mesa_parameter_longest_name(shProg->Uniforms);
+ *params = _mesa_longest_parameter_name(shProg->Uniforms, PROGRAM_UNIFORM);
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");