summaryrefslogtreecommitdiffstats
authorDon Pellegrino <don@drexel.edu>2009-07-07 20:26:59 (GMT)
committer Don Pellegrino <don@drexel.edu>2009-07-07 20:26:59 (GMT)
commit5fb9b85f6043f985de3397b724553a830f0393e4 (patch) (unidiff)
treef0bd53a770c4ae66358fbf35c2549af895555cf6
parent4d1d3121118c90206445542c48c7c7c6dffa8772 (diff)
downloadexp005-5fb9b85f6043f985de3397b724553a830f0393e4.zip
exp005-5fb9b85f6043f985de3397b724553a830f0393e4.tar.gz
exp005-5fb9b85f6043f985de3397b724553a830f0393e4.tar.bz2
Code to test the use of the AMD Performance Monitor OpenGL
Extensions. This test failed as it seems that the non-free Linux driver from AMD does not include an implementation of the extension functions.
-rw-r--r--src/util/amd_performance_monitor/ati_counter_info.h13
-rw-r--r--src/util/amd_performance_monitor/ati_get_group_and_counter_list.c36
-rw-r--r--src/util/amd_performance_monitor/ati_get_group_and_counter_list.h13
3 files changed, 62 insertions, 0 deletions
diff --git a/src/util/amd_performance_monitor/ati_counter_info.h b/src/util/amd_performance_monitor/ati_counter_info.h
new file mode 100644
index 0000000..36fdfdc
--- a/dev/null
+++ b/src/util/amd_performance_monitor/ati_counter_info.h
@@ -0,0 +1,13 @@
1#ifndef ATI_COUNTER_INFO_H
2#define ATI_COUNTER_INFO_H
3
4#include <GL/glut.h>
5
6typedef struct
7{
8 GLuint *counterList;
9 int numCounters;
10 int maxActiveCounters;
11} ATI_Counter_Info;
12
13#endif // ATI_COUNTER_INFO_H
diff --git a/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c
new file mode 100644
index 0000000..cb6419b
--- a/dev/null
+++ b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.c
@@ -0,0 +1,36 @@
1#include "ati_get_group_and_counter_list.h"
2#include <stdlib.h>
3
4extern void glGetPerfMonitorGroupsAMD (int* numGroups, int groupsSize,
5 void *groups);
6
7void
8ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups,
9 ATI_Counter_Info ** counterInfo)
10{
11 GLint n;
12 GLuint *groups;
13 ATI_Counter_Info *counters;
14
15 glGetPerfMonitorGroupsAMD (&n, 0, NULL);
16 groups = (GLuint *) malloc (n * sizeof (GLuint));
17 glGetPerfMonitorGroupsAMD (NULL, n, groups);
18 *numGroups = n;
19
20 *groupsList = groups;
21 counters = (ATI_Counter_Info *) malloc (sizeof (ATI_Counter_Info) * n);
22 for (int i = 0; i < n; i++)
23 {
24 glGetPerfMonitorCountersAMD (groups[i], &counters[i].numCounters,
25 &counters[i].maxActiveCounters, 0, NULL);
26 counters[i].counterList = (GLuint *) malloc (counters[i].numCounters *
27 sizeof (int));
28 glGetPerfMonitorCountersAMD (groups[i], NULL, NULL,
29 counters[i].numCounters,
30 counters[i].counterList);
31 }
32
33 *counterInfo = counters;
34
35 return;
36}
diff --git a/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h
new file mode 100644
index 0000000..e30096e
--- a/dev/null
+++ b/src/util/amd_performance_monitor/ati_get_group_and_counter_list.h
@@ -0,0 +1,13 @@
1#ifndef ATI_GET_GROUP_AND_COUNTER_LIST_H
2#define ATI_GET_GROUP_AND_COUNTER_LIST_H
3
4#include "ati_counter_info.h"
5
6/*
7 * Code from
8 * http://www.opengl.org/registry/specs/AMD/performance_monitor.txt
9 */
10void ati_get_group_and_counter_list (GLuint ** groupsList, int *numGroups,
11 ATI_Counter_Info ** counterInfo);
12
13#endif // ATI_GET_GROUP_AND_COUNTER_LIST_H

Valid XHTML 1.0 Strict

Copyright © 2009 Don Pellegrino All Rights Reserved.