- glGetPerfMonitorCounterStringAMD (group->id,
- group->counter_ids[i],
- length + 1, NULL,
- group->counter_names[i]);
- }
-}
-
-static void
-metrics_group_info_fini (metrics_group_info_t *group)
-{
- unsigned i;
-
- for (i = 0; i < group->num_counters; i++)
- free (group->counter_names[i]);
-
- free (group->counter_types);
- free (group->counter_names);
- free (group->counter_ids);
-
- free (group->name);
-}
-
-/* A helper function, part of metrics_info_init below. */
-
-typedef enum {
- SHADER_ACTIVE,
- SHADER_STALL
-} shader_phase_t;
-
-static void
-_add_shader_stage (metrics_info_t *info, const char *name,
- GLuint group_index, GLuint counter_index,
- shader_phase_t phase)
-{
- shader_stage_info_t *stage;
- char *stage_name, *space;
- unsigned i;
-
- stage_name = xstrdup (name);
-
- /* Terminate the stage name at the first space.
- *
- * This is valid for counter names such as:
- *
- * "Vertex Shader Active Time"
- * or
- * "Vertex Shader Stall Time - Core Stall"
- */
- space = strchr (stage_name, ' ');
- if (space)
- *space = '\0';
-
- /* Look for an existing stage of the given name. */
- stage = NULL;
-
- for (i = 0; i < info->num_shader_stages; i++) {
- if (strcmp (info->stages[i].name, stage_name) == 0) {
- stage = &info->stages[i];
- break;
- }
- }
-
- if (stage == NULL) {
- info->num_shader_stages++;
- info->stages = xrealloc (info->stages,
- info->num_shader_stages *
- sizeof (shader_stage_info_t));
- stage = &info->stages[info->num_shader_stages - 1];
- stage->name = xstrdup (stage_name);
- stage->active_group_index = 0;
- stage->active_counter_index = 0;
- stage->stall_group_index = 0;
- stage->stall_counter_index = 0;
- }
-
- if (phase == SHADER_ACTIVE) {
- stage->active_group_index = group_index;
- stage->active_counter_index = counter_index;
- } else {
- stage->stall_group_index = group_index;
- stage->stall_counter_index = counter_index;
- }
-
- free (stage_name);